SUBTOTAL, OFFSET, and bogus results

%3CLINGO-SUB%20id%3D%22lingo-sub-3275755%22%20slang%3D%22en-US%22%3ESUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3275755%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20formula...%3CBR%20%2F%3E%3DOFFSET(Values%2C0%2C0%2CSEQUENCE(10))%3C%2FP%3E%3CP%3E...%3CEM%3EValues%3C%2FEM%3E%20is%20a%20column%20of%20ten%20numbers.%20And%20the%20formula%20returns%20ten%20%23VALUE!%20errors%2C%20presumably%20because%20Excel%20can't%20(yet%3F)%20manage%20an%20array%20of%20arrays.%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20it%20DOES%20retain%20that%20two%20dimensional%20array%2C%20because%20this%20formula%20spills%20three%20values%3A%3CBR%20%2F%3E%3DINDEX(OFFSET(t.Value%2C0%2C0%2CSEQUENCE(10))%2C3%2C1)%3CBR%20%2F%3E%3CBR%20%2F%3EAnd%20if%20I%20wrap%20SUBTOTAL%20around%20the%20OFFSET%20formula%2C%20I%20get%20the%20results%20I%20expect.%20But%20I%20don't%20get%20them%20for%20AGGREGATE.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EHow%20is%20SUBTOTAL%20able%20to%20provide%20an%20array%20of%20cumulative%20results%20(for%20SUBTOTAL-9)%20while%20AGGREGATE%20doesn't%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3275755%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3280713%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3280713%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EActually%20it%20returns%20array%20of%20references%20on%20the%20ranges.%20Result%20depends%20on%20what%20we%20do%20with%20that%20array.%20If%20land%20into%20the%20grid%20we%20resolve%20reference%20and%20actually%20that%20is%2C%20yes%2C%20array%20of%20arrays%20of%20different%20size.%3C%2FP%3E%0A%3CP%3EHowever%2C%20we%20may%20take%20one%20element%20from%20such%20array%20and%20it%20returns%20it%20as%20an%20array%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20607px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362573iF9D865CEA332105D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAnd%2C%20as%20we%20see%2C%20SUBTOTAL%20also%20works%20with%20such%20array.%20It%20aggregates%20each%20referenced%20range%20and%20returns%20an%20array%20of%20results.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3280603%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3280603%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoesn't%26nbsp%3B%3CSPAN%3E%3DOFFSET(Values%2C0%2C0%2CSEQUENCE(10))%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ereturn%20an%20array%20of%20arrays%20that%20are%20different%20sizes%3F%20In%20my%20experience%2C%20excel%20won't%20return%20an%20array%20where%20the%20individual%20rows%20or%20columns%20are%20variable%20sizes%20to%20the%20worksheet.%20But%2C%20wrapping%20it%20with%20subtotal%20or%20index%20returns%20an%20array%20that%20is%20consistently%20sized%2C%20so%20that%20works.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI'm%20not%20yet%20familiar%20with%20the%20new%20lambda%20functions%2C%20so%20don't%20know%20if%20there%20is%20a%20way%20to%20try%20to%20resize%20the%20individual%20rows%2Fcolumns%20so%20they're%20all%20consistent%20and%20fill%20in%20the%20empty%20elements%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3280432%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3280432%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAGGRERGATE%20has%20reference%20and%20array%20forms%20and%20works%20natively%20with%20arrays%20only%20for%20functions%20starting%20from%20%2314%20and%20above.%20For%20example%2C%20both%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DAGGREGATE(14%2C%2C%7B1%2C2%2C3%7D%2C%201)%0A%3DAGGREGATE(15%2C%2CSEQUENCE(5)%2C2)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ework%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3279315%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3279315%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThat's%20an%20interesting%20insight.%20But%20it's%20hard%20to%20generalize%20from%20it.%20For%20example%2C%20AGGREGATE's%20third%20argument%20specifies%20an%20array%20option.%20But%20as%20with%20SUBTOTAL%2C%20these%20fail%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3DAGGREGATE(9%2C%2C%7B1%2C2%2C3%7D)%3CBR%20%2F%3E%3DAGGREGATE(9%2C%2CSEQUENCE(5))%3CBR%20%2F%3E%3CBR%20%2F%3E(I%20tried%20adding%20a%20dummy%20%5Bk%5D%20value%20as%20the%20fourth%20argument%2C%20but%20that%20was%20no%20help.)%3CBR%20%2F%3E%3CBR%20%2F%3EFun%20stuff!%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3278149%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3278149%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThey%20have%20different%20logic%20inside.%20SUBTOTAL%20works%20with%20references%2C%20OFFSET%20returns%20references%20and%20combination%20works.%3C%2FP%3E%0A%3CP%3ESUM%20works%20with%20arrays%20(or%20ranges%20auto-lifted%20to%20arrays)%2C%3C%2FP%3E%0A%3CP%3EFor%20example%20let%20say%20we%20have%20%3DSEQUENCE(5)%20in%20A1%3C%2FP%3E%0A%3CP%3E%3DSUBTOTAL(9%2C%20A1%23)%20works%3C%2FP%3E%0A%3CP%3E%3DSUBTOTAL(9%2C%20SEQUENCE(5)%20)%20doesn't%20work%3C%2FP%3E%0A%3CP%3ESUM%20works%20with%20both.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20only%20try%20to%20say%20that%20ranges%20and%20arrays%20are%20different%20things.%20Internal%20logic%20in%20%22old%22%20could%20be%20different%20and%20they%20differently%20use%20auto-lifting.%20In%20Pre-DA%20Excel%20that%20was%20not%20critical.%20Similar%20as%20we%20didn't%20care%20about%20implicit%20intersection.%20In%20DA%20Excel%20we%20see%20different%20behavior%2C%20sometimes%20unexpected.%20We%20may%20only%20take%20it%20as%20it%20is%2C%20I%20don't%20think%20Microsoft%20will%20re-write%20developed%20for%2030%2B%20year%20by%20different%20people%20and%20teams%20functions.%20Easier%20to%20develop%20new%20Excel%20from%20scratch.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20for%26nbsp%3B%3DSUM(%20OFFSET(%20values%2C0%2C0%2CSEQUENCE(10)%20)%20)%20-%20can't%20say%20I%20understand%20the%20logic.%20It%20calculates%20number%20of%20entities%20in%20values%20multiplied%20on%20first%20element%20value.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3277751%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3277751%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%3CBR%20%2F%3EWith%20regard%20to%20SUM%2C%20there's%20no%20reason%20why%20it%20shouldn't%20work%20like%20SUBTOTAL%20in%20this%20instance.%3CBR%20%2F%3E%3CBR%20%2F%3EThat%20is%2C%20this%20formula%20SHOULD%20be%20able%20to%20work%20like%20SUBTOTAL%20does%3A%3CBR%20%2F%3E%3DSUM(OFFSET(Values%2C0%2C0%2CSEQUENCE(10)%2C1))%3CBR%20%2F%3E%3CBR%20%2F%3EAnd%20then%2C%20if%20we%20wanted%20the%20grand%20total%20(which%20is%20meaningless%20in%20this%20case)%2C%20we%20could%20use%3A%3CBR%20%2F%3E%3DSUM(SUM(OFFSET(Values%2C0%2C0%2CSEQUENCE(10)%2C1)))%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276724%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276724%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESUM%20and%20AGGREGATE%20takes%20array%20of%20arrays%20as%20entire%20array%20and%20return%20an%20error.%20Why%20SUBTOTAL%20works%20with%20each%20subarray%20separately%20I'm%20not%20sure%2C%20will%20try%20to%20ask%20other%20people.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276684%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276684%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%3CBR%20%2F%3EThe%20logic%20behind%20it%20is%20what%20I%20was%20hoping%20to%20discover.%20LOGICALLY%2C%20it%20shouldn't%20work%20any%20differently%20than%20SUM%2C%20which%20returns%20the%20grand%20total%20of%20all%20ten%20arrays%E2%80%94because%20there%20are%20no%20hidden%20rows%20in%20arrays.%20And%20LOGICALLY%2C%20it%20shouldn't%20work%20any%20differently%20than%20AGGREGATE.%20(Both%209%20and%20109%20work%20with%20SUBTOTAL.)%3CBR%20%2F%3E%3CBR%20%2F%3EI'm%20delighted%20that%20it%20DOES%20work.%20But%20I%20sure%20wish%20I%20knew%20why.%20Right%20now%2C%20the%20only%20thing%20that%20makes%20any%20sense%20is%20that%20whoever%20coded%20the%20function%20used%20an%20approach%20that%20accidentally%20produced%20SUBTOTAL's%20unique%20results%20when%20used%20with%20an%20array%20of%20arrays.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276663%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276663%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1319311%22%20target%3D%22_blank%22%3E%40Starrysky1988%3C%2FA%3E%3CBR%20%2F%3EActually%2C%20no.%20The%20width%20is%20an%20optional%20argument.%20By%20default%2C%20it%20has%20the%20shape%20of%20reference%2C%20which%20is%20Values%20in%20this%20case.%20So%2C%20because%20Values%20is%20a%20single%20column%2C%20the%20width%20parameter%20isn't%20needed.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276230%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276230%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20guess%20OFFSET%20with%20SEQUENCE%20returns%20array%20of%20references%20on%20A1%2C%20A1%3AA2%2C%20A1%3AA3%2C%20etc.%20Itself%20it's%20yes%2C%20array%20of%20arrays%2C%20but%20SUBTOTAL%20correctly%20aggregates%20each%20of%20them%20and%20return%20array%20of%20results.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAGGREGATE%20takes%20entire%20array%20of%20arrays%20and%20returns%20an%20error.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDon't%20know%20what%20is%20the%20logic%20behind.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276012%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276012%22%20slang%3D%22en-US%22%3EYou%20need%20to%20correct%20in%20your%20offset%20function.%20Width%20that%20represent%20how%20many%20columns%20is%20missing%20in%20the%20formula.%3CBR%20%2F%3E%3DOFFSET(reference%2C%20rows%2C%20cols%2C%20%5Bheight%5D%2C%20%5Bwidth%5D)%3CBR%20%2F%3EThe%20formula%20must%20be%20as%20below.%3CBR%20%2F%3E%3DOFFSET(Values%2C0%2C0%2CSEQUENCE(10)%2C1)%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3389828%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3389828%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20happened%20across%20this%20blog%20and%20it%20reminded%20me%20of%20this%20post%2C%20as%20you%20mentioned%20excel%20being%20able%20to%20handle%20an%20%22array%20of%20arrays%22.%20So%2C%20I%20thought%20I%20would%20leave%20it%20here%20in%20case%20you've%20not%20yet%20come%20across%20it.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.flexyourdata.com%2Fblog%2Fwhat-is-a-thunk-in-an-excel-lambda-function%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.flexyourdata.com%2Fblog%2Fwhat-is-a-thunk-in-an-excel-lambda-function%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20it%20would%20appear%20an%20array%20of%20subtotals%20can%20be%20done%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMB17_0-1652821453044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372588i1903FB57F6EA3677%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JMB17_0-1652821453044.png%22%20alt%3D%22JMB17_0-1652821453044.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3392132%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3392132%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F232597%22%20target%3D%22_blank%22%3E%40Charley%20Kyd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20late%20post%20here%20but%20I%20thought%20it%20might%20be%20of%20interest%20that%20AGGREGATE%20actually%20can%20process%20OFFSET%20with%20array%20arguments%20in%204th%2C%205th%2C%20...%20just%20not%203rd%20position%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%201052px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lori_m_0-1652867971254.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372785i4C829ACBEB50DC14%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22lori_m_0-1652867971254.png%22%20alt%3D%22lori_m_0-1652867971254.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ENote%3A%3C%2FP%3E%3CP%3E-%20Arguments%20taking%20references%20can%20be%20detected%20by%20stepping%20through%20evaluate%20formula.%3C%2FP%3E%3CP%3E-%20Arguments%20taking%20arrays%20show%20as%20arrays%20in%20the%20formula%20arguments%20dialog.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20this%20info%20we%20can%20generate%20a%20'function%20signature'%20(ref%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.lambdadays.org%2Fstatic%2Fupload%2Fmedia%2F161673641592992lambdadaysfeb21corrected.pdf%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EYellow%20(lambdadays.org)%3C%2FA%3E%26nbsp%3B)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EAGGREGATE%3A%20(Number%2CNumber%2C%20%7BRange%2CArray%7D%2C%20Range%2C%20Range%2C%20...)%20-%26gt%3B%20Number%0ASUBTOTAL%3A%20(Number%2C%20Range%2C%20Range%2C%20Range%2C%20...)%20-%26gt%3B%20Number%0ASUM%3A%20(%7BNumber%2C%20Range%2C%20Array%7D%2C%20%7BNumber%2C%20Range%2C%20Array%7D%2C%20...)%20-%26gt%3B%20Number%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20appears%20that%20when%20a%20formula%20like%20OFFSET(A1%3AA3%2C%2C%2C%7B1%3B2%3B3%7D)%20is%20passed%20to%20an%20argument%20that%20accepts%20only%20ranges%20it%20processes%20the%20array%20of%20ranges%20%7BA1%3BA1%3AA2%3BA1%3AA3%7D%20by%20'auto-lifting'%20giving%20an%20array%20of%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20other%20hand%20if%20the%20same%20OFFSET%20formula%20is%20passed%20to%20an%20argument%20that%20takes%20arrays%2C%20the%20array%20argument%20is%20processed%20an%20array%20of%20values%20and%20produces%20a%20single%20erroneous%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20take%20is%20that%20arrays%20of%20ranges%20should%20be%20deprecated%20in%20365%20as%20there%20are%20alternative%20ways%20to%20achieve%20the%20same%20results%20with%20Dynamic%20Arrays%20that%20are%20non-volatile%20and%20work%20with%20arrays%20not%20just%20ranges.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3393277%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3393277%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20VSTACK%20it's%20bit%20easier%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIFNA(%20DROP(%0A%20%20%20%20%20%20%20%20%20%20%20%20REDUCE(0%2C%20SEQUENCE(%20ROWS(values))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20LAMBDA(a%2Cv%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20VSTACK(a%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TRANSPOSE(SCAN(%2C%20INDEX(values%2C%20SEQUENCE(v)%20)%2C%20LAMBDA(a%2Cv%2Ca%2Bv)%20)%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20)%2C%201%20)%2C%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20613px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372834i6E5A230B6E1DD8A7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENot%20sure%20why%20simple%20REDUCE%20repeats%20accumulator%20in%20first%20row%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIFNA(%0A%20%20%20%20%20%20%20REDUCE(0%2C%20SEQUENCE(%20ROWS(values))%2C%0A%20%20%20%20%20%20%20%20%20%20%20LAMBDA(a%2Cv%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20IF(%20v%20%3D%20SEQUENCE(v)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TRANSPOSE(SCAN(%2C%20INDEX(values%2C%20SEQUENCE(v)%20)%2C%20LAMBDA(a%2Cv%2Ca%2Bv)%20)%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20a%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20)%2C%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372835iF11129B53DAAB8DF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%2C%20perhaps%20you%20may%20explain%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3393313%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3393313%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20a%20comment%2C%20auto-lifting%20is%20an%20issue%20in%20DA%20Excel%2C%20never%20know%20for%20sure%20when%20and%20how%20it%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3393727%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3393727%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInteresting%20behaviour%2C%20I%20hadn't%20noticed%20that%20before...%3CBR%20%2F%3EFor%201x2%20array%2C%20scalars%20can%20get%20propagated%20using%20similar%20IF%20logic%3A%3C%2FP%3E%3CP%3E%3DIF(%7B1%3B2%7D%3D1%2C1%2C%7B2%2C3%7D)%3C%2FP%3E%3CP%3ECompare%20with%20VSTACK%20which%20has%20a%20%23N%2FA%20in%20place%20of%20the%201%20in%202x2%20result%20matrix%3A%3C%2FP%3E%3CP%3E%3DVSTACK(1%2C%7B2%2C3%7D)%3C%2FP%3E%3CP%3EPerhaps%20this%20is%20related%20to%20the%20REDUCE%20results%3F%20I%20didn't%20check%20the%20formula%20logic%20thoroughly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20yes%20it's%20true%20'auto-lifting'%20is%20subject%20to%20basically%20the%20same%20restrictions%20in%20365%20versions%20-%20though%20a%20few%20functions%20like%20INDEX%20work%20more%20consistently%20now.%20We%20also%20now%20have%20the%20MAP%20function%20for%20use%20in%20cases%20where%20'auto-lifting'%20doesn't%20happen%20eg%20SUM%20and%20AGGREGATE%20-%20or%20perhaps%20SCAN%2C%20etc.%20to%20optimise%20for%20speed..%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3394111%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3394111%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20IF()%20with%20array%20reserves%20space%20for%20max%20of%20parameters%20and%20fill%20it%20with%20one%20which%20meets%20condition.%20But%20in%20our%20case%20on%20first%20step%20that's%20like%3C%2FP%3E%0A%3CP%3E%3DIF(%20%7BTRUE%7D%2C%2011%2C%2011)%20and%20it%20shall%20be%20single%20value%20returned.%3C%2FP%3E%0A%3CP%3EREDUCE()%20with%20first%20parameter%20has%20n%2B1%20steps%20compare%20to%20n%20steps%20if%20parameter%20is%20omitted%2C%20perhaps%20here%20we%20have%20two%20elements%20array%20space.%3C%2FP%3E%0A%3CP%3EWill%20play%20with%20it%20more.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3394555%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3394555%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20maybe%20it's%20the%20second%20iteration%20in%20the%20REDUCE%20that%20is%20causing%20the%20problem%20-%20giving%20the%20two%20element%20array%20space%3F%20I%20guess%20that%20might%20be%20confirmed%20by%20gradually%20increasing%20the%20size%20of%20the%20input%20array%201%2C2%2C3...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20I'm%20certainly%20not%20clear%20on%20all%20the%20details%20either%20but%20the%20Simon%20Peyton%20Jones%20video%20clarified%20some%20of%20the%20key%20aspects%20of%20array%20processing%20for%20me.%20In%20particular%20one%20of%20the%20slides%20in%20the%20presentation%20states%20the%20following%20rule%2C%20the%20last%20of%20these%20bullet%20points%20is%20referred%20to%20as%20auto-lifting%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%E2%80%A2%20%3CSTRONG%3EAuto-lifting%2Fcoercion%20rule%3A%3C%2FSTRONG%3E%20when%20computing%20F(X)%2C%20and%20the%20value%20of%20X%20is%20%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Enot%20acceptable%20to%20F%20(based%20on%20its%20signature)%20then%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%E2%80%A2%20If%20X%20is%20a%20reference%2C%20de-reference%20it%2C%20and%20try%20again%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%E2%80%A2%20If%20X%20is%20a%20string%2C%20parse%20it%20to%20a%20number%20and%20try%20again%20e.g.%20SQRT(%20%E2%80%9C4.5%E2%80%9D%20)%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%E2%80%A2%20If%20X%20is%20an%20array%2C%20apply%20F%20to%20each%20element%20of%20the%20array.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20practice%20the%20function%20tools%20can%20give%20clues%20about%20the%20signature.%20The%20suggestion%20above%20resulted%20from%20trying%20lots%20of%20different%20types%20of%20test%20values%20in%20the%20function%20argument%20dialog%20(array%2C%20number%2C%20string%2C%20bool)%2C%20then%20Evaluate%20Formula%20can%20be%20used%20to%20check%20if%20a%20function%20takes%20references.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3396160%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3396160%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20I've%20seen%20that%20rule%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.lambdadays.org%2Fstatic%2Fupload%2Fmedia%2F161673641592992lambdadaysfeb21corrected.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EYellow%20(lambdadays.org)%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EHowever%2C%20%3DN(A1%3AI1)%20returns%20first%20element%3B%20%3DN(%2BA1%3AI1)%20returns%20spill.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3397759%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3397759%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20believe%20the%20same%20rule%20applies%20in%20this%20case%20too.%20Stepping%20through%20Evaluate%20Formula%3A%3C%2FP%3E%3CP%3E1.%20%3D%2BN(A1%3AB1)%20-%26gt%3B%20%2B1%3CBR%20%2F%3E2.%20%3D%2BN(%2BA1%3AB1)%20-%26gt%3B%20%2BN(%2B%7B1%2C2%7D)%20-%26gt%3B%20%2B%7B1%2C2%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBased%20on%20trial%20results%2C%20signature%20appears%20to%20be%3A%3C%2FP%3E%3CP%3EN%3A%20(%7Brange%2C%20number%7D)%20-%26gt%3B%20number%3CBR%20%2F%3E%2B%20(unary)%3A%20(%7Bnumber%2C%20text%2C%20bool%7D)%20-%26gt%3B%20%7Bnumber%2C%20text%2C%20bool%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20applying%20coercion%2Fauto-lifting%20rule%3A%3C%2FP%3E%3CP%3E1.%20The%20range%20parameter%20is%20amenable%20to%20the%20N%20function%20and%20the%20first%20element%20is%20returned.%3C%2FP%3E%3CP%3E2.%20The%20range%20parameter%20is%20not%20amenable%20to%20%2B%20and%20the%20result%20is%20dereferenced%20to%20an%20array%20(or%20value%20in%20older%20versions%20that%20use%20implicit%20intersection).%20The%20array%20is%20then%20passed%20to%20N%2C%20via%20auto-lifting.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20can%20try%20substituting%20N%20with%20ABS%2C%20which%20doesn't%20accept%20ranges%20so%20dereferencing%20is%20automatic%2C%20or%20IMABS%2C%20which%20accepts%20references%20of%20single%20cells%20only%20so%20%2B%20is%20also%20needed%20to%20auto-lift%20to%20array.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat's%20just%20my%20understanding%20which%20may%20not%20be%20100%25%20reliable.%20It%20would%20be%20nice%20to%20have%20documentation%20of%20function%20type%20info%20made%20available%20as%20part%20of%20the%20documentation.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%2C%20XLM%20functions%20use%20this%20same%20function%20specification%20-%20ARGUMENT%20and%20RESULT%20parameters%20are%20summed%20over%20types%3A%20number(1)%2C%20text(2)%2C%20bool(4)%2C%20reference(8)%2C%20error(16)%2C%20array(64)%2C%20eg%2095%20%3Dany%20type.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3429272%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3429272%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20anyone%20interested%2C%20I%20just%20noticed%20the%20new%20TAKE%20function%20can%20return%20arrays%20of%20references%20just%20like%20OFFSET%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DSUBTOTAL(9%2CTAKE(A1%3AA10%2CSEQUENCE(10)))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20guess%20I%20might%20take%20back%20what%20I%20said%20earlier%20as%20this%20could%20be%20a%20reasonably%20efficient%20approach%20for%20running%20sums%20and%20isn't%20volatile.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS.%20Also%20to%20clarify%20above%20description%2C%20the%20N%20function%20seems%20to%20be%20designed%20to%20take%20references%20and%20return%20the%20first%20value%20from%20the%20first%20area%20in%20the%20range.%20Note%20Evaluate%20Formula%20shows%20fixed%20references%20when%20clicking%20Evaluate%20button%3A%20N((A1%2CA3))%20-%26gt%3B%20N((%24A%241%2C%24A%243))%20whereas%20other%20operations%20like%20ABS%20and%20%2B%20force%20the%20range%20to%20be%20converted%20to%20values%20according%20to%20the%20auto-lift%20rule%20or%20else%20return%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3430265%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3430265%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20interesting%2C%20great%20finding.%20DROP%20also%20returns%20references%2C%20not%20sure%20what%20could%20be%20the%20practical%20case.%3C%2FP%3E%0A%3CP%3EN()%20-%20I%20guess%20same%20behavior%2C%20I%20mean%20references%2C%20for%20some%20other%20functions.%20For%20example%3C%2FP%3E%0A%3CP%3EEDATE(TODAY()%2C%20(A1%2C%20A3)%20)%20%3D%26gt%3B%20EDATE(TODAY()%2C%20(%24A%241%2C%20%24A%243)%20)%20on%20evaluation.%2030%20years%20old%20design%2C%20good%20enough%20before%20dynamic%20arrays%20come.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20the%20way%2C%20with%20help%20of%20other%20people%20found%20how%20to%20remove%20duplicate%20of%20the%20value%20for%20REDUCE%20in%20first%20line.%20The%20problem%20is%20in%20seconds%20step%20due%20to%20IF(%20%7B...%7D%2C%20expanding.%20Without%20Beta%20functions%20correct%20result%20is%20returned%20by%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIFERROR(%0A%20%20%20REDUCE(0%2C%20SEQUENCE(%20ROWS(values))%2C%0A%20%20%20%20%20LAMBDA(a%2Cv%2C%0A%20%20%20%20%20%20%20IF(%20v%20%3D%20SEQUENCE(v)%2C%0A%20%20%20%20%20%20%20%20%20TRANSPOSE(SCAN(%2C%20INDEX(values%2C%20SEQUENCE(v)%20)%2C%20LAMBDA(a%2Cv%2Ca%2Bv)%20)%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20INDEX(%20a%2C%20SEQUENCE(v)%2C%20SEQUENCE(%2Cv)%20)%0A%20%20%20%20%20%20%20)%0A%20%20%20%20)%0A%20%20%20)%2C%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eother%20words%20to%20take%20exact%20accumulator%20size%20for%20the%20step%26nbsp%3B%20a%20%3D%26gt%3B%26nbsp%3BINDEX(%20a%2C%20SEQUENCE(v)%2C%20SEQUENCE(%2Cv)%20)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375215i84AA27D0500D31EF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3432782%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3432782%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat's%20a%20better%20approach%20for%20non-beta%20version%20%E2%80%93%20I%20am%20bookmarking%20for%20future%20reference%E2%80%A6%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERE%3A%20N()%20-%20I%20should%20have%20included%20%E2%80%98text%E2%80%99%20and%20%E2%80%98bool%E2%80%99%20as%20inputs%20in%20the%20function%20signature%20before.%20Input%20values%20like%20%E2%80%9Ca%E2%80%9D%20and%20TRUE%20can%20be%20input%20into%20the%20function%20arguments%20dialog%20to%20verify.%20I%20also%20just%20noticed%20that%20the%20input%20type%20shows%20%E2%80%98any%E2%80%99%20initially%20and%20follows%20same%20conventions%20as%20ARGUMENT%20function%20displaying%20the%20lowest%20number%20type%20or%20%E2%80%98any%E2%80%99%20by%20default%20to%20indicate%20number%2C%20text%20or%20bool.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20reference%2C%20I'm%20attaching%20a%20comprehensive%20function%20list%20which%20was%20built%20a%20few%20years%20ago%20using%20XLM%20and%20includes%20formatting%20for%20%3CSTRONG%3Earray%3C%2FSTRONG%3E%2C%20%3CEM%3Ereference%3C%2FEM%3E%2C%20or%20%3CU%3Evalue%3C%2FU%3E%20(number%2C%20text%2C%20bool%20or%20unformatted%20for%20scalar%20only).%20Functions%20can%20be%20grouped%20according%20to%20rules%20such%20as%3C%2FP%3E%3CP%3E-%20In%20pre-DA%20versions%20underlined%20%3CU%3Einputs%3C%2FU%3E%2F%3CU%3Eoutputs%3C%2FU%3E%20generally%20need%20CSE%20entry%20(eg%20IF%2C%20TRANSPOSE)%20while%20regular%20inputs%20with%20bold%20outputs%20need%20array%20coercion%20(e.g.%20INDEX%2C%20VLOOKUP).%3C%2FP%3E%3CP%3E-%20In%20all%20versions%2C%20functions%20with%20reference%20%3CEM%3Einputs%3C%2FEM%3E%2F%3CEM%3Eoutputs%3C%2FEM%3E%20can%20process%20arrays%20of%20references%20(e.g.%20OFFSET%2C%20TAKE)%20but%20those%20that%20also%20allow%20value%20%3CU%3E%3CEM%3Einputs%3C%2FEM%3E%3C%2FU%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3Erequire%20%2B%20to%20auto-lift%20ranges%20to%20arrays%20(e.g.%20EDATE%2C%20N).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20list%20currently%20only%20includes%20Pre-DA%20functions%20%E2%80%93%20I%E2%80%99ll%20look%20to%20update%20at%20some%20point%20soon%E2%80%A6%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3433100%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3433100%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20great%20summary%20of%20functions%2C%20thank%20you%20for%20sharing.%20Need%20some%20time%20to%20play%20with%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3435403%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3435403%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288074%22%20target%3D%22_blank%22%3E%40lori_m%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%2C%20with%20your%20TAKE()%20finding%20our%20sample%20could%20be%20simplified%20to%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DREDUCE(0%2C%20SEQUENCE(%20ROWS(values)%20)%2C%0A%20%20%20%20%20LAMBDA(a%2Cv%2C%0A%20%20%20%20%20%20%20IF(%20v%20%3D%20SEQUENCE(v)%2C%0A%20%20%20%20%20%20%20%20%20SUBTOTAL(%209%2C%20TAKE(%20values%2C%20SEQUENCE(%2Cv)%20)%20)%2C%0A%20%20%20%20%20%20%20%20%20EXPAND(%20a%2C%20v%2C%20v%2C%20%22%22)%20%20%20%20)%0A%20)%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%20only%20these%20are%20Beta%20functions%20and%20works%20with%20ranges%20only.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3437774%22%20slang%3D%22en-US%22%3ERe%3A%20SUBTOTAL%2C%20OFFSET%2C%20and%20bogus%20results%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3437774%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENice%20technique%20using%20EXPAND.%20Maybe%20more%20mundanely%2C%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIF(SEQUENCE(ROWS(values))%26gt%3B%3DSEQUENCE(%2CROWS(values))%2C%0ASUBTOTAL(%209%2C%20TAKE(%20values%2C%20SEQUENCE(%2CROWS(values))))%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

In this formula...
=OFFSET(Values,0,0,SEQUENCE(10))

...Values is a column of ten numbers. And the formula returns ten #VALUE! errors, presumably because Excel can't (yet?) manage an array of arrays.

However, it DOES retain that two dimensional array, because this formula spills three values:
=INDEX(OFFSET(t.Value,0,0,SEQUENCE(10)),3,1)

And if I wrap SUBTOTAL around the OFFSET formula, I get the results I expect. But I don't get them for AGGREGATE.


How is SUBTOTAL able to provide an array of cumulative results (for SUBTOTAL-9) while AGGREGATE doesn't? 

26 Replies
You need to correct in your offset function. Width that represent how many columns is missing in the formula.
=OFFSET(reference, rows, cols, [height], [width])
The formula must be as below.
=OFFSET(Values,0,0,SEQUENCE(10),1)

@Charley Kyd 

My guess OFFSET with SEQUENCE returns array of references on A1, A1:A2, A1:A3, etc. Itself it's yes, array of arrays, but SUBTOTAL correctly aggregates each of them and return array of results.

 

AGGREGATE takes entire array of arrays and returns an error.

 

Don't know what is the logic behind.

@Starrysky1988
Actually, no. The width is an optional argument. By default, it has the shape of reference, which is Values in this case. So, because Values is a single column, the width parameter isn't needed.
@Sergei Baklan
The logic behind it is what I was hoping to discover. LOGICALLY, it shouldn't work any differently than SUM, which returns the grand total of all ten arrays—because there are no hidden rows in arrays. And LOGICALLY, it shouldn't work any differently than AGGREGATE. (Both 9 and 109 work with SUBTOTAL.)

I'm delighted that it DOES work. But I sure wish I knew why. Right now, the only thing that makes any sense is that whoever coded the function used an approach that accidentally produced SUBTOTAL's unique results when used with an array of arrays.

@Charley Kyd 

SUM and AGGREGATE takes array of arrays as entire array and return an error. Why SUBTOTAL works with each subarray separately I'm not sure, will try to ask other people.

@Sergei Baklan
With regard to SUM, there's no reason why it shouldn't work like SUBTOTAL in this instance.

That is, this formula SHOULD be able to work like SUBTOTAL does:
=SUM(OFFSET(Values,0,0,SEQUENCE(10),1))

And then, if we wanted the grand total (which is meaningless in this case), we could use:
=SUM(SUM(OFFSET(Values,0,0,SEQUENCE(10),1)))

@Charley Kyd 

They have different logic inside. SUBTOTAL works with references, OFFSET returns references and combination works.

SUM works with arrays (or ranges auto-lifted to arrays),

For example let say we have =SEQUENCE(5) in A1

=SUBTOTAL(9, A1#) works

=SUBTOTAL(9, SEQUENCE(5) ) doesn't work

SUM works with both.

 

I only try to say that ranges and arrays are different things. Internal logic in "old" could be different and they differently use auto-lifting. In Pre-DA Excel that was not critical. Similar as we didn't care about implicit intersection. In DA Excel we see different behavior, sometimes unexpected. We may only take it as it is, I don't think Microsoft will re-write developed for 30+ year by different people and teams functions. Easier to develop new Excel from scratch.

 

As for =SUM( OFFSET( values,0,0,SEQUENCE(10) ) ) - can't say I understand the logic. It calculates number of entities in values multiplied on first element value. 

 

 

@Sergei Baklan

That's an interesting insight. But it's hard to generalize from it. For example, AGGREGATE's third argument specifies an array option. But as with SUBTOTAL, these fail:

=AGGREGATE(9,,{1,2,3})
=AGGREGATE(9,,SEQUENCE(5))

(I tried adding a dummy [k] value as the fourth argument, but that was no help.)

Fun stuff!




@Charley Kyd 

AGGRERGATE has reference and array forms and works natively with arrays only for functions starting from #14 and above. For example, both

=AGGREGATE(14,,{1,2,3}, 1)
=AGGREGATE(15,,SEQUENCE(5),2)

work

@Charley Kyd 

 

Doesn't =OFFSET(Values,0,0,SEQUENCE(10)) return an array of arrays that are different sizes? In my experience, excel won't return an array where the individual rows or columns are variable sizes to the worksheet. But, wrapping it with subtotal or index returns an array that is consistently sized, so that works.

 

I'm not yet familiar with the new lambda functions, so don't know if there is a way to try to resize the individual rows/columns so they're all consistent and fill in the empty elements?

 

@JMB17 

Actually it returns array of references on the ranges. Result depends on what we do with that array. If land into the grid we resolve reference and actually that is, yes, array of arrays of different size.

However, we may take one element from such array and it returns it as an array

image.png

And, as we see, SUBTOTAL also works with such array. It aggregates each referenced range and returns an array of results.

 

@Charley Kyd 

 

I happened across this blog and it reminded me of this post, as you mentioned excel being able to handle an "array of arrays". So, I thought I would leave it here in case you've not yet come across it. 

 

https://www.flexyourdata.com/blog/what-is-a-thunk-in-an-excel-lambda-function/

 

So, it would appear an array of subtotals can be done:

 

JMB17_0-1652821453044.png

 

@Charley Kyd 

A late post here but I thought it might be of interest that AGGREGATE actually can process OFFSET with array arguments in 4th, 5th, ... just not 3rd position:

 

lori_m_0-1652867971254.png

Note:

- Arguments taking references can be detected by stepping through evaluate formula.

- Arguments taking arrays show as arrays in the formula arguments dialog.

 

From this info we can generate a 'function signature' (ref: Yellow (lambdadays.org) )

 

 

AGGREGATE: (Number,Number, {Range,Array}, Range, Range, ...) -> Number
SUBTOTAL: (Number, Range, Range, Range, ...) -> Number
SUM: ({Number, Range, Array}, {Number, Range, Array}, ...) -> Number

 

 

 

It appears that when a formula like OFFSET(A1:A3,,,{1;2;3}) is passed to an argument that accepts only ranges it processes the array of ranges {A1;A1:A2;A1:A3} by 'auto-lifting' giving an array of results.

 

On the other hand if the same OFFSET formula is passed to an argument that takes arrays, the array argument is processed an array of values and produces a single erroneous result.

 

My take is that arrays of ranges should be deprecated in 365 as there are alternative ways to achieve the same results with Dynamic Arrays that are non-volatile and work with arrays not just ranges.

@JMB17 

With VSTACK it's bit easier

=IFNA( DROP(
            REDUCE(0, SEQUENCE( ROWS(values)),
                 LAMBDA(a,v,
                    VSTACK(a,
                       TRANSPOSE(SCAN(, INDEX(values, SEQUENCE(v) ), LAMBDA(a,v,a+v) )   )
                     )
               )
            ), 1 ), "")

image.png

Not sure why simple REDUCE repeats accumulator in first row

=IFNA(
       REDUCE(0, SEQUENCE( ROWS(values)),
           LAMBDA(a,v,
               IF( v = SEQUENCE(v),
                   TRANSPOSE(SCAN(, INDEX(values, SEQUENCE(v) ), LAMBDA(a,v,a+v) )   ),
                   a
               )
           )
       ), "")

image.png

@lori_m , perhaps you may explain

@lori_m 

As a comment, auto-lifting is an issue in DA Excel, never know for sure when and how it works.

@Sergei Baklan 

Interesting behaviour, I hadn't noticed that before...
For 1x2 array, scalars can get propagated using similar IF logic:

=IF({1;2}=1,1,{2,3})

Compare with VSTACK which has a #N/A in place of the 1 in 2x2 result matrix:

=VSTACK(1,{2,3})

Perhaps this is related to the REDUCE results? I didn't check the formula logic thoroughly.

 

And yes it's true 'auto-lifting' is subject to basically the same restrictions in 365 versions - though a few functions like INDEX work more consistently now. We also now have the MAP function for use in cases where 'auto-lifting' doesn't happen eg SUM and AGGREGATE - or perhaps SCAN, etc. to optimise for speed..

@lori_m 

Yes, IF() with array reserves space for max of parameters and fill it with one which meets condition. But in our case on first step that's like

=IF( {TRUE}, 11, 11) and it shall be single value returned.

REDUCE() with first parameter has n+1 steps compare to n steps if parameter is omitted, perhaps here we have two elements array space.

Will play with it more.

@Sergei Baklan 

 

Yes, maybe it's the second iteration in the REDUCE that is causing the problem - giving the two element array space? I guess that might be confirmed by gradually increasing the size of the input array 1,2,3...

 

And I'm certainly not clear on all the details either but the Simon Peyton Jones video clarified some of the key aspects of array processing for me. In particular one of the slides in the presentation states the following rule, the last of these bullet points is referred to as auto-lifting:

 

Auto-lifting/coercion rule: when computing F(X), and the value of X is
not acceptable to F (based on its signature) then
• If X is a reference, de-reference it, and try again
• If X is a string, parse it to a number and try again e.g. SQRT( “4.5” )
• If X is an array, apply F to each element of the array.

 

 

In practice the function tools can give clues about the signature. The suggestion above resulted from trying lots of different types of test values in the function argument dialog (array, number, string, bool), then Evaluate Formula can be used to check if a function takes references.

@lori_m 

Yes, I've seen that rule here Yellow (lambdadays.org)

However, =N(A1:I1) returns first element; =N(+A1:I1) returns spill.