SOLVED

Can SCAN() and BYROW() be combined?

%3CLINGO-SUB%20id%3D%22lingo-sub-3255132%22%20slang%3D%22en-US%22%3ECan%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255132%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fscan-function-d58dfd11-9969-4439-b2dc-e7062724de29%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Esupport%20page%20for%20SCAN()%20contains%20the%20following%20example%3A%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22914422ab-f843-49ba-b0de-082385f9cd11%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355217i0A1390EC080F4FBB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22914422ab-f843-49ba-b0de-082385f9cd11%22%20alt%3D%22914422ab-f843-49ba-b0de-082385f9cd11%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22%22%3E%3DSCAN(%22%22%2CA1%3AC2%2CLAMBDA(a%2Cb%2Ca%26amp%3Bb))%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20general%20issue%20is%20combining%20BYROW()%20or%20BYCOLUMN()%20with%20other%20functions%2C%20but%20I'll%20illustrate%20it%20with%20this%20SCAN()%20example%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20does%20one%20SCAN()%20row%20by%20row%20such%20that%20the%20output%20it%20something%20like%3A%3C%2FP%3E%3CP%3Ea%2C%20ab%2C%20abc%3C%2FP%3E%3CP%3Ed%2C%20de%2C%20def%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DBYROW(A1%3AC2%2CLAMBDA(row%2CSCAN(%22%22%2Crow%2CLAMBDA(a%2Cb%2Ca%26amp%3Bb))))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edoesn't%20work...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3255132%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-3272097%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3272097%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%3CP%3EYour%20recommendation%20was%20spot%20on.%26nbsp%3B%20The%20outcome%20seems%20to%20be%20that%20the%20formula%20now%20available%20will%20have%20one%20dimension%20that%20grows%20quadratically%20whilst%20the%20other%20may%20be%20linear.%26nbsp%3B%20The%20formula%20you%20suggested%20and%20attributed%20to%26nbsp%3B%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%3Bgrows%20linearly%20as%20the%20number%20of%20rows%20increases%20and%20beats%20the%20formulae%20I%20was%20playing%20with%20hands%20down%3B%20it%20should%20get%20to%20a%20million%20rows%20with%20calculation%20times%20under%201s!%3C%2FP%3E%3CP%3ESimilar%20behavior%20is%20achieved%20by%20the%20variation%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20REDUCE(INDEX(data%2C%2C1)%2C%20BYCOL(data%2CThunk%CE%BB)%2C%0A%20%20%20%20%20%20LAMBDA(acc%2C%CF%91%2C%20HSTACK(acc%2CTAKE(acc%2C%2C-1)%2B%CF%91()))%0A%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20hadn't%20spent%20enough%20time%20on%20the%20final%20posts%20of%20the%20first%20sheet%20because%20I%20was%20going%20to%20use%20Charles%20Williams's%20timing%20routines%20and%20the%20Microsoft%20Research%20timed%20regression%20tests%20made%20the%20workbook%20very%20slow.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3268565%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3268565%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELol...%20until%20Microsoft%20comes%20up%20with%20a%20better%20alternative%2C%20I'd%20suggest%20using%20the%26nbsp%3B%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%20formulation%20or%20something%20like%20below%20on%20longer%20arrays%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DREDUCE(INDEX(data%2C%2C1)%2C%0A%20%20%20%20%20SEQUENCE(COLUMNS(data)-1)%2C%0A%20%20%20%20%20LAMBDA(acc%2Ci%2C%0A%20%20%20%20%20%20%20%20%20HSTACK(acc%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20INDEX(acc%2C%2Ci)%26amp%3BINDEX(data%2C%2Ci%2B1)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20)))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EWhich%20performs%20better%20would%20depend%20on%20array%20dimensions%2C%20I'd%20think%20the%20method%20that%20stacks%20along%20the%20smaller%20of%20the%20row%20or%20column%20dimensions%20would%20be%20preferable.%20The%20othe%20advantage%20of%20thunks%20and%20the%20above%20method%20is%20that%20vector%20accumulation%20is%20supported.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%2C%20previous%20timing%20results%20that%20I%20posted%20would%20need%20to%20be%20updated%20by%20removing%20the%20'vstack'%20name%20-%20turns%20out%20that%20prototype%20function%20was%20slowing%20things%20down%20a%20lot.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3268520%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3268520%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20tags%20to%20the%20previous%20post%20were%20the%20creation%20of%20the%20cat!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3268516%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3268516%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20created%20another%20approach%20to%20the%20problem%20in%20which%20many%20rows%20are%20stepped%20through%20the%20SCAN%20as%20a%20block%20(by%20again%20using%20thunks)%20and%20then%20displayed%20using%20MAKEARRAY.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20ExpandV%CE%BB(SCAN(%2CtestdataV%CF%91%2CConcatThunk%CE%BB))%0A%0AWhere%0AConcatThunk%CE%BB%20%3D%20LAMBDA(a%CF%91%2Cb%CF%91%2CThunk%CE%BB(a%CF%91()%26amp%3Bb%CF%91()))%3B%0A%0AtestdataV%CF%91%20%3D%20BYCOL(testdata%2C%20Thunk%CE%BB)%3B%0A%0AExpandV%CE%BB%20%3D%20LAMBDA(d%CF%91%2C%0A%20%20%20%20MAKEARRAY(n%2C10%2C%20LAMBDA(r%2Cc%2C%20INDEX(INDEX(d%CF%91%2C1%2Cc)()%2Cr%2C1)))%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20then%20performed%20some%20timing%20runs%20using%2010%20columns%20but%20a%20varying%20number%20of%20rows.%3C%2FP%3E%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%20513px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358971i681903FD8A33E7D5%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%2FP%3E%3CP%3EWhat%20is%20troubling%20is%20that%20both%20this%20solution%20and%20the%20earlier%20one%20are%20of%20Order%201.7%20(I%20am%20more%20used%20to%20seeing%20integer%20values).%26nbsp%3B%20The%20earlier%20REDUCE%20formula%20appears%20to%20be%20more%20efficient%20than%20that%20using%20MAKEARRAY%20but%2C%20either%20way%2C%20the%20growth%20means%20that%20the%20approaches%20are%20not%20usable%20once%20the%20row%20count%20goes%20into%20the%201000s%20(in%20which%20case%20the%20time%20for%20a%20recalculation%20exceeds%201s).%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20conclusion%20is%20that%20the%20array%20of%20array%20problem%20needs%20to%20the%20addressed%20by%20Microsoft.%26nbsp%3B%20Otherwise%20we%20are%20likely%20to%20find%20ourselves%20in%20a%20situation%20of%20falling%20back%20on%20copy%20fill%20which%20will%20be%20a%20real%20joy%20when%20resizing%20calculations%20that%20are%20running%20into%20the%20100%2C000s%20of%20rows!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3268082%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3268082%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%3EDear%26nbsp%3BMr.%20Sergei%20Baklan%2C%3C%2FP%3E%3CP%3EThanks%20for%20your%20highlight%20and%20I've%20learnt%20something%20from%20it.%20The%20formula%20now%20is%20perfect.%3C%2FP%3E%3CP%3EWhat%20I%20like%20the%20most%20using%20Excel%20is%20the%20art%20of%20combining%20of%20different%20Excel%20Functions.%3C%2FP%3E%3CP%3EIf%20we%20are%20using%20old%20version%20of%20Excel%202016%20onwards%2C%20we%20can%20just%20simply%20use%20%22Concat%22%20function%20as%20below%20and%20copy%20and%20paste%20to%20the%20cell%20we%20want.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Starrysky1988_0-1648396341303.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358844i414F88835A565864%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Starrysky1988_0-1648396341303.png%22%20alt%3D%22Starrysky1988_0-1648396341303.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ESometimes%2C%20we%20make%20things%20easy%2C%20but%20sometimes%20we%20make%20them%20difficult.%3C%2FP%3E%3CP%3EMay%20be%20we%20want%20to%20save%20a%20few%20second%20of%20extra%20work%20and%20always%20want%20dynamic%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3268049%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3268049%22%20slang%3D%22en-US%22%3E%3CP%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%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'd%20suggest%20to%20modify%20a%20bit%20which%20allows%20to%20work%20both%20with%20ranges%20and%20arrays.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EByRR%20%3D%20LAMBDA(A%2C%0A%20%20%20%20MAKEARRAY(%0A%20%20%20%20%20%20%20%20rows(A)%2C%0A%20%20%20%20%20%20%20%20columns(A)%2C%0A%20%20%20%20%20%20%20%20LAMBDA(%20n%2C%20m%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20CONCAT(%20INDEX(%20A%2C%20n%2C%20SEQUENCE(m)%20)%20)%0A%20%20%20%20)%0A%20%20%20%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerformance%20is%20bit%20better%20than%20with%20thunks%20or%20makearray()%20which%20uses%20scan().%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%20308px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358833i96EFF0FDCEABB4BB%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%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267940%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267940%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAFE%20is%20not%20working%20in%20my%20Excel%20and%20I%20just%20use%20name%20manager.%26nbsp%3B%3C%2FP%3E%3CP%3EbyR%20%3D%20LAMBDA(L%2CMAKEARRAY(ROWS(L)%2CCOLUMNS(L)%2CLAMBDA(r%2Cc%2CCONCAT(INDIRECT(ADDRESS(r%2C1)%26amp%3B%22%3A%22%26amp%3BADDRESS(r%2Cc))))))%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Starrysky1988_0-1648376196282.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358785i8EEEA73976A06AF3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Starrysky1988_0-1648376196282.png%22%20alt%3D%22Starrysky1988_0-1648376196282.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThe%20formula%20above%20will%20only%20work%20if%20the%20list%20is%20started%20from%20cell%20A1.%3C%2FP%3E%3CP%3ETo%20get%20the%20dynamic%20result%2C%20I've%20added%20another%20helper%20name%20that%20represents%20the%20first%20cell%20in%20the%20list.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Starrysky1988_6-1648384617876.png%22%20style%3D%22width%3A%201599px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358794i7E08BB748ADD17B7%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Starrysky1988_6-1648384617876.png%22%20alt%3D%22Starrysky1988_6-1648384617876.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267918%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267918%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%3EOops%2C%20I%20didn't%20open%20the%20link%20within%20your%20file.%20Yes%2C%20looks%20like%20unchanged%20samples%20from%20the%20prototype.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPrioritization%20is%20never%20simple%20task.%20I%20guess%20Microsoft%20decides%20such%20compromises%20every%20few%20months%20(have%20no%20idea%20about%20their%20planning%20process).%20If%20to%20simplify%2C%20like%20make%20Evaluate%20Formula%20box%20resizable%20or%20introduce%20few%20other%20lambda%20functions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20another%20guess%20on%20first%20place%20is%20what%20demanded%20by%20corporate%20business%20which%20gives%2085%25%20(third%20guess)%20of%20income.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnyway%2C%20sooner%20or%20later%20nested%20arrays%20shall%20appear.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267909%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267909%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%3EThe%20timer%20code%20is%20courtesy%20of%20the%20MS%20Research%20team%20and%20was%20used%20for%20prototyping%20some%20of%20the%20new%20functions.%20Without%20access%20to%20the%20new%20functions%20I%20substituted%20the%20vstack%20prototype%20function%20from%20that%20link%20and%20got%20the%20results%20shown%20in%20attachment%20which%20are%20a%20little%20disappointing%20and%20I'm%20sure%20thunk%20results%20could%20be%20improved%20significantly%20though%20unlikely%20ever%20to%20match%20the%20faster%20alternatives%20listed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20no%20idea%20how%20much%20effort%20would%20be%20required%20to%20address%20the%20nested%20arrays%20error%20but%20community%20feedback%20like%20this%20can%20only%20help%20bump%20it%20up%20the%20priority%20list!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267754%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267754%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%3ENo%2C%20I%20need%20to%20find%20some%20time%20to%20work%20through%20Lori's%20solution.%26nbsp%3B%20I%20did%20some%20timing%20runs%20with%20my%20solution%20using%20100x100%20and%20200x50%20grids%20of%20single%20characters%20using%20Charles%20Williams's%20profiler.%26nbsp%3B%20The%20latter%20was%20worse%20for%20a%20range%20recalc.%20with%20timings%20of%20350ms%20rather%20than%20250ms.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267514%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267514%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%3C%2FP%3E%0A%3CP%3E%26nbsp%3BAfraid%20implementation%20of%20array%20of%20arrays%20requires%20re-building%20of%20calc%20engine%20architecture.%20Other%20words%20create%20new%20Excel%2C%20if%20not%20from%20scratch%20but%20close%20to%20that.%20Perhaps%20I'm%20wrong%2C%20just%20my%20impression.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOther%20way%20is%20to%20built%20in%20workarounds%20like%20we%20use%20now%20in%20built-in%20functions%2C%20but%20that%20will%20be%20quite%20narrow%20solution%20which%20works%20for%20concrete%20cases%20only.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnyway%2C%20I%20believe%20this%20or%20that%20solution%20will%20be%20found%20and%20we'll%20see%20array%20of%20arrays%20one%20day.%26nbsp%3B%20Such%20functionality%20is%20quite%20demanded%20for%20new%20Excel.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267512%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267512%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%2C%20I%20had%20no%20doubt%20you%20will%20use%20thunks.%20Did%20you%20try%20to%20integrate%20with%26nbsp%3B%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%3Btimer%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267459%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267459%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAgreed%2C%20the%20previous%20post%20was%20intended%20to%20be%20fully%20in%20support%20of%20the%20OP%20and%20to%20reiterate%20that%20the%20proposed%20BYROW%20formula%20should%20really%20be%20made%20to%20work%20in%20a%20future%20update%20if%20possible.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'd%20really%20prefer%20that%20nested%20arrays%20were%20converted%20to%202d%20arrays%20natively.%20Google%20sheets%20does%20this%20eg%3A%3CBR%20%2F%3E%3D%7B%7B1%2C2%7D%3B%7B3%2C4%7D%7D%20-%26gt%3B%20%7B1%2C2%3B3%2C4%7D%3CBR%20%2F%3E%3D%7B%7B1%2C2%7D%2C%7B3%2C4%7D%7D%20-%26gt%3B%20%7B1%2C2%2C3%2C4%7D%3CBR%20%2F%3Eso%20no%20need%20for%20separate%20VSTACK%20%2F%20HSTACK%20functions.%20I%20gather%20from%20the%20response%20you%20received%20from%20the%20development%20team%20that%20backward%20compatibility%20makes%20such%20an%20update%20more%20challenging%20however.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267344%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267344%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%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3Bwas%20pretty%20irritated%20by%20the%20message%20%22Nested%20arrays%20are%20not%20supported%22%2C%20and%20I%20believe%20rightly%20so.%26nbsp%3B%20Most%20Excel%20errors%20report%20an%20error%20on%20the%20part%20of%20the%20user%2Fdeveloper.%26nbsp%3B%20This%20one%20is%20different.%26nbsp%3B%20The%20%3CU%3Ecorrect%3C%2FU%3E%20answer%20to%20a%20wide%20class%20of%20problems%20to%20which%20one%20might%20with%20to%20apply%20dynamic%20array%20methods%20%3CU%3Eis%3C%2FU%3E%20the%20array%20of%20arrays.%26nbsp%3B%20This%20error%20is%20nothing%20to%20do%20with%20the%20user%2C%20it%20is%20simply%20flagging%20up%20a%20deficiency%20in%20the%20code%3B%20one%20which%20may%20not%20have%20mattered%20in%20the%20past%20but%20which%20is%20now%20centre%20stage.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20a%20minimum%2C%20BYROW%2C%20BYCOL%20and%20MAKEARRAY%20should%20address%20this%20limitation%20and%20convert%20the%20'column%20of%20row%20arrays'%20to%20the%20equivalent%202D%20array%20without%20involving%20the%20user%20in%20workarounds.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267302%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267302%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%20have%20seen%20the%20posts%20but%20have%20yet%20to%20work%20through%20them%20in%20detail.%26nbsp%3B%20Meanwhile%20I%20have%20tried%20VSTACK%20as%20an%20alternative%20to%20MAKEARRAY%2C%20but%20still%20using%20Thunks.%26nbsp%3B%20The%20worksheet%20formula%20relies%20on%20a%20number%20of%20other%20named%20Lambda%20functions.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20Expand%CE%BB(BYROW(data%2CScan%CE%BB))%0A%0AScan%CE%BB%0A%3D%20LAMBDA(row%2CThunk%CE%BB(SCAN(%22%22%2Crow%2CConcat%CE%BB)))%3B%0A%0AConcat%CE%BB%20%0A%3D%20LAMBDA(a%2Cb%2Ca%26amp%3Bb)%3B%0A%0AExpand%CE%BB%20%0A%3D%20LAMBDA(d%CF%91%2C%0A%20%20%20%20REDUCE(%2Cd%CF%91%2CLAMBDA(acc%CF%91%2C%CF%91%2CThunk%CE%BB(VSTACK(acc%CF%91()%2C%CF%91()))))()%0A%20%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3267132%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3267132%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%3EI%20could%20agree%2C%20but%20everything%20depends%20on%20goals%20and%20concrete%20scenario.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3266562%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3266562%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%3EYup%20looks%20pretty%20fast!%20In%20any%20case%2C%20native%20byrow%2Fbycol%20extended%20functions%20would%20get%20my%20vote%20to%20bypass%20the%20nested%20array%20error%20in%20general%2C%20as%20suggested%20in%20the%20original%20post.%20Then%20other%20methods%20-%20including%20thunks%20-%20could%20benefit%20from%20being%20able%20to%20process%20arrays%20of%20results%20more%20efficiently.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3266170%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3266170%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%3EI%20see%2C%20thank%20you.%20Here%20it%20is%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%20269px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358301i9FE64CBCF0C20AD5%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%2FP%3E%0A%3CP%3EBut%20that's%20the%20best%20result.%20Average%20one%20is%20about%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%20269px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358302i4A435582BBCA74A9%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%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3266001%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3266001%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%3EGreat%20-%20looks%20better.%20and%20likely%20faster%20too.%26nbsp%3B%26nbsp%3BFor%20timing%20maybe%20replace%20%22%22%20by%200%20(or%201)%20and%20'%26amp%3B'%20with%20'%2B'%20then%20update%20function%20name%20in%20timer%20formula.%20From%20the%20times%2C%20it%20looks%20like%20your%20system%20is%20running%20twice%20as%20fast!%20I%20needed%26nbsp%3Bto%20reduce%20to%20n%3D50%20to%20make%20it%20responsive%20enough%20on%20my%20setup.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3265753%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3265753%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%3EMy%20first%20attempt%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EreduceV%3D%0ALAMBDA(array%2C%0A%20%20%20%20DROP(%0A%20%20%20%20%20%20%20%20REDUCE(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20SEQUENCE(ROWS(array))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20LAMBDA(a%2C%20n%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20VSTACK(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20a%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SCAN(%2C%20CHOOSEROWS(array%2C%20n)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20LAMBDA(acc%2C%20v%2C%20acc%20%26amp%3B%20v))%0A%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)%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%201%0A%20%20%20%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ewhich%20gives%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%20269px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358216i7076AAC229C73CE5%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%2FP%3E%0A%3CP%3ENot%20sure%20how%20to%20integrate%20it%20with%20timer.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3265648%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3265648%22%20slang%3D%22en-US%22%3E%3CP%3EFollowing%20the%20announcement%20of%20the%20new%20array%20functions%2C%20I%20wondered%20if%20VSTACK%20or%20some%20other%20function%20could%20be%20put%20to%20use%20in%20this%20type%20of%20situation%20to%20extend%20BYROW%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20absence%20of%20a%20built-in%20function%2C%20maybe%20define%20instead%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EBYROWS%0A%3DLAMBDA(array%2Cfunction%2C%0A%20%20%20%20%20REDUCE(1%2C%0A%20%20%20%20%20%20%20%20%20SEQUENCE(ROWS(array))%2C%0A%20%20%20%20%20%20%20%20%20LAMBDA(A%2Ci%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20IF(SEQUENCE(i)%3Di%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20function(INDEX(array%2Ci%2C))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20A))))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewhich%20could%20be%20used%20in%20conjunction%20with%20SCAN%20as%20shown...%26nbsp%3B%3C%2FP%3E%3CP%3E(Out%20of%20interest%20I%20did%20rough%20timings%20of%20the%20various%20implementations%20on%20a%20100x100%20array)%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%22Screenshot%202022-03-24%20104213.png%22%20style%3D%22width%3A%20686px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358185i98B6B51133623027%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-24%20104213.png%22%20alt%3D%22Screenshot%202022-03-24%20104213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257744%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257744%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOK.%26nbsp%3B%20So%20I%20am%20beginning%20to%20get%20fed%20up%20with%20the%20arrays%20of%20arrays%20problem%20with%20the%20365%20lambda%20helper%20functions.%26nbsp%3B%20Isn't%20that%20what%20one%20uses%20spreadsheets%20for%3F%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fmerging-rows%2Fm-p%2F3257698%23M138349%22%20target%3D%22_blank%22%3ERe%3A%20merging%20rows%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%3CP%3EEvery%20table%20is%20a%20list%20of%20records.%26nbsp%3B%20Crosstabs%20are%20arrays%20of%20arrays.%26nbsp%3B%20I%20would%20say%20that%20up%20to%20%3CSTRONG%3E80%25%3C%2FSTRONG%3E%20of%20my%20workbooks%20would%20benefit%20from%20being%20able%20to%20handle%20arrays%20of%20arrays%20efficiently.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOK%2C%20thunks%20do%20offer%20a%20way%20around%20the%20problem%20and%20I%20am%20getting%20better%20at%20using%20them.%26nbsp%3B%20The%20attached%20workbook%20has%20Lambda%20functions%26nbsp%3B%3CSTRONG%3EThunk%CE%BB%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EExpandThunk%CE%BB%3C%2FSTRONG%3E%20that%20I%20have%20used%20to%20form%20and%20expand%20the%20arrays%20of%20thunks%2C%20but%20it%20is%20still%20a%20pain%20and%20I%20struggle%20to%20see%20how%20I%20would%20convince%20a%20normal%20Excel%20user%20that%20this%20is%20better%20than%20'%3CSTRONG%3E%3CEM%3Eand%20copy%20down%20(ugh!)%3C%2FEM%3E%3C%2FSTRONG%3E'.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256230%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256230%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22Who%20would%20have%20even%20thunk%20that%20would%20work%3F%22%26nbsp%3B%20Who%20indeed%3F%20(grin)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20wasn't%20immediately%20obvious%20to%20me%20that%20the%20concept%20could%20be%20of%20any%20use.%26nbsp%3B%20I%20sometimes%20think%20of%20it%20as%20the%20computing%20equivalent%20of%20the%20freeze%20dried%20survival%20meal.%26nbsp%3B%20In%20its%20packaged%20state%2C%20it%20doesn't%20look%20like%20food%20but%20add%20water%20and%20bring%20to%20the%20boil%20and%20it%20is%20reconstituted%20as%20if%20by%20magic.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EBefore%20making%20a%20determined%20effort%20to%20exploit%20Thunks%2C%20I%20had%20used%20basic%20Lambda%20functions%20for%20similar%20purpose%20with%20some%20success%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Efor%20example%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%22Array%CE%BB%22%0A%3D%20LAMBDA(k%2CINDEX(Array%2Ck))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ecan%20be%20passed%20as%20a%20Lambda%20variable%2C%20but%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20Array%CE%BB(%7B1%3B2%3B3%7D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewill%20return%20the%20first%203%20terms%20of%20the%20array.%26nbsp%3B%20This%20is%20actually%20useful%20when%20one%20is%20handling%20multidimensional%20arrays%20where%20expressions%20like%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20Array%CE%BB(3%2C1%2C2)%0A%0A%22Array%CE%BB%22%0A%3D%20LAMBDA(i%2Cj%2Ck%2C%20INDEX(Array%2Ci%2B10*(k-1)%2C%20j))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewill%20successfully%20use%20the%203%20indices%20pick%20terms%20from%20the%20grid.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Thunk%20is%20a%20bit%20more%20obscure%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%22Array%CF%91%22%0A%3D%20LAMBDA(Array)%0A%0A%22Thunk%CE%BB%22%0A%3D%20LAMBDA(x%2CLAMBDA(x))%0A%0A%22Array%CF%91%22%0A%3D%20Thunk%CE%BB(Array)%0A%0A%22Worksheet%20formula%22%0A%3D%20Array%CF%91()%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThe%20first%20term%20is%20a%20thunk%2C%20but%20used%20inside%20SCAN%20will%20return%20the%20array%20and%20not%20the%20thunk.%26nbsp%3B%20To%20do%20that%20one%20can%20define%20a%20Lambda%20function%20Thunk%CE%BB%20with%202%20Lambdas%20(thanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F933333%22%20target%3D%22_blank%22%3E%40tboulden%3C%2FA%3E).%26nbsp%3B%20Apply%20it%20to%20the%20array%20and%20it%20correctly%20returns%20the%20Thunk.%26nbsp%3B%20Add%20a%20null%20parameter%20string%20and%20you%20magically%20reconstitute%20the%20array%20(just%20like%20the%20pack%20of%20%22MaryJanesFarm%20Kettle%20Chili%22!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255997%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255997%22%20slang%3D%22en-US%22%3Eso%20i%20tried%20to%20follow%20the%20discussion.%20Can%20someone%20maybe%20describe%20what%20that%20Thunk%20function%20is%2Fdoes.%20It%20appears%20to%20be%20just%20a%20way%20to%20pass%20an%20array%20without%20it%20knowing%20it%20is%20passing%20an%20array%3F%20maybe%3F%20a%20lambda%20that%20returns%20a%20reference%20to%20a%20lambda%3F%20who%20would%20have%20even%20thunk%20that%20would%20work%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255976%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255976%22%20slang%3D%22en-US%22%3EFair%20enough%2C%20I%20think%20many%20other%20Excellers%20out%20there%20would%20agree%20with%20such%20sentiments!%20As%20per%20Peter's%20earlier%20comments%2C%20formula%20construction%20is%20starting%20to%20become%20more%20the%20domain%20of%20the%20developer%20community%20-%20similar%20examples%20of%20functional%20code%20abound%20on%20stackoverflow.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20post%20was%20more%20to%20illustrate%20how%20an%20array%20of%20results%20could%20be%20generated%20in%202d%20rather%20than%20an%20array%20of%201d-arrays%20which%20is%20not%20allowed.%20If%20similar%20updates%20were%20made%20to%20SCAN%2FBYROW%2Fetc%20functions%20one%20wouldn't%20need%20to%20resort%20to%20such%20headache-inducing%20formulas%20(though%20I'm%20sure%20the%20C%2B%2B%20source%20code%20of%20those%20functions%20would%20be%20many%20times%20worse!)%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255961%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255961%22%20slang%3D%22en-US%22%3E%3CP%3EWhile%20I%20understand%20(I%20hope)%20what%20you%20are%20saying%20and%20even%20agree%20with%20most%20of%20it%2C%20I'd%20like%20to%20respond%20to%20two%20statements%20you%20make%3A%3C%2FP%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3Ethe%20idea%20of%20exempting%20specific%20functions%20from%20the%20rules%20is%20not%20without%20precedent.%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EWhile%20I%20appreciate%20the%20power%20of%20precedent%2C%20the%20fact%20that%20a%20bad%20idea%20is%20not%20without%20precedent%20doesn't%20necessarily%20turn%20the%20idea%20from%20bad%20to%20good.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%26nbsp%3BWhat%20Joe%20would%20need%20is%20...%20confidence%20that%20any%20change%20will%20not%20cause%20backward%20compatibility%20issues.%3C%2FBLOCKQUOTE%3E%3CP%3EI'm%20afraid%20that%20ship%20has%20already%20sailed.%20As%20a%20matter%20of%20fact%2C%20it's%20not%20too%20farfetched%20to%20imagine%20that%20Excel%20will%20one%20day%20be%20forked%20into%20incompatible%20%3CEM%3EExcel%20Classic%3C%2FEM%3E%20and%20%3CEM%3EExcel%20New%20Age...%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255958%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255958%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20the%20kids%20nowadays%20say%2C%20SMH...%20Functions%20like%20that%20REDUCE()%20are%20some%20kind%20of%20abomination%3A%20six%20sub-functions%20(two%20of%20which%20are%20used%20twice)%2C%20eight%20sets%20of%20%22(%20)%22s%20and%20an%20endless%20stream%20of%20%22%2C%22.%20After%20a%20few%20of%20those%2C%20one's%20brain%20just%20shuts%20down%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255808%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255808%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20also%20tried%20to%20raise%20this%20point%20several%20times%20prior%20to%20release.%26nbsp%3B%20My%20hope%20was%20that%20something%20like%20this%20would%20work%20here%2C%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DSCAN(%7B%22%22%3B%22%22%7D%2Cdata%2CLAMBDA(a%2Cb%2Ca%26amp%3Bb)))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewhich%20would%20be%20a%20more%20efficient%20implementation%20of%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DREDUCE(%22%22%2C%0A%20%20%20%20%20SEQUENCE(COLUMNS(data))%2C%0A%20%20%20%20%20%20%20%20LAMBDA(acc%2Ci%2C%0A%20%20%20%20%20%20%20%20%20%20%20IF(SEQUENCE(%2Ci)%3Di%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20INDEX(acc%2C%2Ci-1)%26amp%3BINDEX(data%2C%2Ci)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20acc)))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EInstead%20a%20reusable%20'SCANBYROW'%20function%20can%20be%20implemented%20via%20one%20of%20the%20methods%20Peter%20suggested%2C%20or%20formula%20above%20but%20this%20is%20far%20from%20ideal.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255778%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255778%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20is%20no%20need%20to%20convince%20me%20that%20the%20limitation%20on%20array%20of%20arrays%2Franges%20is%20both%20over-restrictive%20and%20is%20now%20causing%20difficulties.%26nbsp%3B%20I%20have%20made%20such%20points%20in%20the%20past%20and%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9664%22%20target%3D%22_blank%22%3E%40JoeMcDaid%3C%2FA%3E%26nbsp%3Bexplained%20that%20Excel%20never%20has%20accepted%20such%20data%20objects%3B%20it%20is%20just%20that%20now%20one%20is%20far%20more%20likely%20to%20encounter%20this%20limitation.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20a%20more%20mundane%20level%2C%20one%20can%20see%20that%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20XLOOKUP(lookupVals%2CTable1%5BName%5D%2CTable1)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Efails%2C%20with%20the%20output%20truncated%2C%20whilst%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20INDEX(%0A%20%20%20%20%20Table1%2C%20%0A%20%20%20%20%20XMATCH(lookupVals%2CTable1%5BName%5D)%2C%0A%20%20%20%20%20XMATCH(Table1%5B%23Headers%5D%2CTable1%5B%23Headers%5D)%0A%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eworks%2C%20so%20the%20problem%20has%20earlier%20manifestations.%26nbsp%3B%20%26nbsp%3BWhat%20Joe%20would%20need%20is%20a%20compelling%20case%20for%20Microsoft%20to%20commit%20resources%20to%20the%20problem%20and%20confidence%20that%20any%20change%20will%20not%20cause%20backward%20compatibility%20issues.%26nbsp%3B%20My%20feeling%20is%20that%20it%20may%20be%20sufficient%20to%20deal%20with%20the%20problem%20within%20the%20restricted%20context%20of%20the%20BYROW%2C%20BYCOL%20and%20MAKEARRAY%20operators%2C%20in%20order%20to%20avoid%20wider%20unintended%20consequences.%26nbsp%3B%20After%20all%2C%20for%20years%2C%20SUMPRODUCT%20(and%2C%20I%20think%2C%20AGGREGATE%3F)%20broke%20the%20rules%20and%20allowed%20array%20calculation%20without%20needing%20CSE%20to%20override%20implicit%20intersection%2C%20so%20the%20idea%20of%20exempting%20specific%20functions%20from%20the%20rules%20is%20not%20without%20precedent.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20other%20thing%20you%20need%20is%20real-world%20examples%20which%20have%20been%20frustrated%20by%20the%20failure%20of%20the%20new%20helper%20functions%20to%20perform%20the%20tasks%20that%20they%20obviously%20should%20be%20capable%20of.%26nbsp%3B%20I%20think%20'send%20a%20frown'%20gets%20attention%2C%20especially%20if%20key%20words%20channel%20the%20query%20to%20the%20correct%20team.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20for%20the%20Python%20'include'%2C%20I%20would%20prefer%20to%20wait%20and%20see%20a%20solid%20level%20on%20performance%20at%20the%20level%20of%20program%20abstraction%20currently%20available%20to%20Excel%20developers%20before%20considering%20even%20more%20abstract%20layers%20of%20helper%20functions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20am%20currently%20doing%20is%20to%20examine%20the%20limitations%20and%20workarounds%2C%20as%20well%20as%20the%20new%20opportunities%2C%20trying%20to%20determine%20which%20routes%20provide%20best%20practice.%26nbsp%3B%20Nobody%20would%20be%20more%20pleased%20than%20I%2C%20if%20the%20need%20for%20'too%20clever%20by%20half'%20solutions%20were%20suddenly%20to%20disappear.%26nbsp%3B%20At%20least%2C%20the%20practice%20of%20building%20solutions%20with%20Lambda%20functions%20can%20conceal%20the%20detail%20and%20leave%20more%20coherent%20code%20at%20user%20level.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255672%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255672%22%20slang%3D%22en-US%22%3E%3CP%3EWell%2C%20I'm%20still%20trying%20to%20parse%20your%20function%20for%20%3CEM%3EcharArray%3C%2FEM%3E%20-%20I%20can%20already%20see%20that%20it%20involves%20a%20bunch%20of%20nested%20lambdas%20which%20in%20turn%20contain%20quite%20a%20number%20of%20functions%20(BYCOL%2C%20SCAN%2C%20MAKEARRAY%2C%20etc.)...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20think%20I'm%20qualified%20to%20have%20an%20opinion%20about%20whether%20Excel%20is%20now%20Turing-complete%20or%20not%20(whatever%20that%20practically%20means)%2C%20but%20this%20seems%20a%20lot%20of%20work%20for%20something%20that%20in%20Python%2C%20for%20example%2C%20can%20be%20accomplished%20in%20exactly%20two%20lines%2C%20one%20of%20which%20is%20an%20%3CEM%3Eimport%3C%2FEM%3E%20statement.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%2C%20I%20actually%20did%20see%20and%20read%20the%20discussion%20you%20link%20to%20-%20but%20didn't%20make%20the%20connection%3B%20I%20believe%20I%20was%20(and%20probably%20still%20am)%20so%20annoyed%20by%20the%20failure%20of%20BYROW%20to%20work%20with%20SCAN%2C%20I%20couldn't%20see%20what%20was%20right%20in%20front%20of%20me!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255631%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255631%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFound%20it!%26nbsp%3B%20This%20discussion%26nbsp%3B%20covers%20much%20the%20same%20ground%20as%20one%20I%20initiated%20in%20the%20past.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Faccumulating-arrays%2Fm-p%2F3045626%22%20target%3D%22_blank%22%3EAccumulating%20arrays%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20did%20have%20to%20create%20'%3CSTRONG%3EConcatThunk%CE%BB%3C%2FSTRONG%3E'%20by%20substituting%20a%20'%3CFONT%20color%3D%22%23006F9A%22%3E%3CSTRONG%3E%2B%3C%2FSTRONG%3E%3C%2FFONT%3E'%20by%20'%3CFONT%20color%3D%22%23006F9A%22%3E%3CSTRONG%3E%26amp%3B%3C%2FSTRONG%3E%3C%2FFONT%3E'.%20in%20order%20to%20apply%20the%20previous%20function%20to%20the%20new%20situation!%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20AccumulateThunk%CE%BB(charArray%2C%20charInit%2C%20ConcatThunk%CE%BB)%0A%0A%0Awhere%20%22ConcatThunk%CE%BB%22%20%0A%3D%20LAMBDA(acc%CF%91%2C%20str%CF%91%2C%20Thunk%CE%BB(acc%CF%91()%20%26amp%3B%20str%CF%91()))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255595%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255595%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20was%20as%20many%20as%201%20in%20a%201%2C000%20that%20met%20the%20ICAEW%20criteria%20of%20Excel%20knowledge!%3C%2FP%3E%3CP%3EAnyway%2C%20I%20think%20you%20are%20grossly%20underestimating%20your%20own%20ability.%26nbsp%3B%20If%20it%20is%20any%20consolation%2C%20from%20my%20initial%20assessment%20of%20your%20question%2C%20I%20had%20categorized%20you%20as%20an%20expert%20user.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20instance%2C%20I%20would%20have%20some%20sympathy%20with%20the%20decision%20to%20fall%20back%20on%20relative%20referencing%20though%2C%20since%20I%20never%20use%20direct%20cell%20references%20(other%20than%20within%20Name%20Manager%20to%20define%20the%20Names)%2C%20I%20might%20have%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20SCAN(%22%22%2CcurrentRow%2C%20LAMBDA(a%2Cb%2Ca%26amp%3Bb))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EWhere%20I%20might%20put%20the%20effort%20in%20generate%20a%20dynamic%20array%20is%20when%20there%20is%20a%20follow-up%20question%20of%20%22How%20many%20more%20times%20does%20the%20substring%20%22dog%22%20appear%20within%20the%205000%20rows%20than%20%22cat%22.%26nbsp%3B%20Another%20factor%20might%20be%20whether%20the%20entire%20model%20other%20than%20that%20single%20concatenation%20array%20were%20dynamic.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20question%20might%20be%2C%20%22If%20someone%20were%20to%20offer%20you%20a%20Lambda%20function%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20HAccumulate%CE%BB(initialisationColumn%2CarrayToAccumulate%2CFn%CE%BB)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewould%20you%20use%20it%3F%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255517%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255517%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20far%20as%20I%20can%20tell%2C%20I%20am%20not%20one%20of%20the%2010%2C000%20Excel%20users%20who%20rate%20as%20a%20developer%20by%20the%20ICAEW%20(referred%20to%20in%20your%20other%20answer)%2C%20but%20I%20%3CEM%3EAM%3C%2FEM%3E%20a%20long%20time%2C%20heavy%20user%20of%20Excel%20so%20I%20feel%20qualified%20to%20offer%20my%20two%20cents%20on%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHaving%20studied%20your%20approaches%20more%20closely%2C%20I%20have%20to%20say%20that%20I%20now%20tend%20to%20prefer%20your%20first%20approach%20(designated%20as%20%22%3CEM%3ESingle%20sequence%3C%2FEM%3E%22%20in%20your%20attachment).%20Still%2C%20the%20approach%20involves%20using%208%20different%20functions%20(SCAN%2C%20SEQUENCE%2C%20LABMDA%2C%20LET%2C%20QUOTIENT%2C%20MOD%2C%20INDEX%20and%20IF)!%3C%2FP%3E%3CP%3EThe%20solution%20proposed%20by%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%20-%20which%20also%20works%20-%20involves%20even%20more%20(LET%2C%26nbsp%3B%20ROWS%2C%20COLUMNS%2C%20TEXT%2C%26nbsp%3B%20SEQUENCE%2C%20SCAN%2C%20LAMBDA%2C%20IF%2C%20MOD%2C%20LEFT%20and%20MID)%20-%2011%20in%20total!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20eyeballing%20these%20solutions%20(let%20alone%20parsing%20them)%20would%20give%20your%20run-of-the-mill%20non-developer%20user%20a%20headache...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20imagine%20that%20type%20of%20user%20would%20do%20is%20just%20give%20up%20on%20spillable%20purity%2C%20use%20instead%3C%2FP%3E%3CP%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%3E%3DSCAN(%22%22%2CA1%3AC1%2CLAMBDA(a%2Cb%2Ca%26amp%3Bb))%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%3Eand%20then%20drag%20it%20down%20one%20row%20-%20and%20be%20done%20with%20the%20whole%20thing.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255444%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255444%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20still%20find%20this%20class%20of%20problem%20intensely%20difficult%20to%20get%20my%20head%20round%20and%20I%20am%20frequently%20guilty%20of%20'reinventing%20the%20wheel'.%26nbsp%3B%20Unless%20the%20solutions%20can%20be%20packaged%20in%20the%20form%20of%20meaningful%20Lambda%20functions%2C%20I%20suspect%20the%20methods%20lie%20well%20beyond%20the%20pay%20grade%20of%20the%20normal%20Excel%20developer%20-%20and%20that%20bearing%20in%20mind%20the%20assertion%20of%20the%20ICAEW%20that%20fewer%20than%201%20in%20a%201000%20Excel%20users%20would%20rate%20as%20a%20developer!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20sorts%20of%20thoughts%20float%20around.%26nbsp%3B%20For%20example%2C%20the%20accumulation%20may%20be%20by%20concatenation%20(text)%2C%20by%20addition%20(numbers)%20or%20even%20by%20multiplication%20(indices%20of%20multidimensional%20arrays).%26nbsp%3B%20Perhaps%20the%20operator%20itself%20should%20be%20a%20Lambda%20variable%20passed%20into%20the%20calculation%20framework%20as%20a%20parameter%20(Concatenate%CE%BB%2C%26nbsp%3BSum%CE%BB%2C%26nbsp%3BProduct%CE%BB).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20were%20unhappy%20with%20the%20requirement%20to%26nbsp%3B%3CSPAN%3Econcatenate%20the%20'index%20array'%20with%20the%20'array%20of%20values'.%26nbsp%3B%20To%20the%20best%20of%20my%20knowledge%2C%20there%20is%20no%20perfect%20solution.%26nbsp%3B%20For%20text%2C%20a%20comma-separated%20list%20could%20be%20used%20to%20hold%20the%20index%2Fvalue%20pair%2C%20for%20numbers%2C%20it%20could%20be%20a%20complex%20number.%26nbsp%3B%20A%20thunk%20provides%20a%20reasonably%20standard%2C%20if%20not%20simple%2C%20approach%20and%20I%20think%20a%20more%20normal%20Lambda%20function%20would%20also%20be%20possible%2C%20whereby%20Pair%CE%BB(1)%20is%20the%20index%20and%26nbsp%3BPair%CE%BB(2)%20the%20value%20(INDEX%20would%20be%20inside%20the%20Lambda%20function%20but%20the%20function%20itself%20can%20be%20passed%20as%20a%20scalar%20assuming%20the%20parameter%20is%20missing).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESomething%20else%20I%20forgot%20when%20identifying%20the%20possible%20approaches%2C%20was%20that%20the%20second%20approach%20of%20thunks%20has%20two%20distinct%20implementations.%26nbsp%3B%20One%20builds%20a%20column%20of%20thunks%2C%20each%20containing%20an%20accumulated%20row%2C%20whilst%20the%20other%20builds%20a%20row%20of%20thunks%2C%20each%20containing%20a%20column%20array.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW.%26nbsp%3B%20My%20use%20of%20'%3CSPAN%3E%CE%BB'%20within%20the%20naming%20might%20cause%20confusion%20for%20many%2C%20who%20do%20not%20use%20the%20Greek%20alphabet%20to%20express%20ideas%2C%20but%20name%20manager%20accepts%20the%20symbol%20as%20just%20another%20letter%20within%20the%20name.%26nbsp%3B%20Since%20it%20is%20not%20present%20as%20a%20character%20on%20an%20English%20language%20keyboard%2C%20I%20use%20Autocorrect%20to%20convert%20'%5Clambda'%20into%26nbsp%3B'%CE%BB'%2C%20rather%20like%20the%20equation%20editor%20in%20Word.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255346%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255346%22%20slang%3D%22en-US%22%3E%3CP%3Eit%20seems%20like%20your%20first%20concept%20was%20a%20cleaner%20method.%20Use%20scan%20and%20sequence%20to%20perform%20the%20scan%20and%20a%20'reset'%20for%20each%20row%20something%20like%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DLET(in%2CA2%3AC3%2C%0A%20%20%20%20%20r%2CROWS(in)%2C%0A%20%20%20%20%20c%2CCOLUMNS(in)%2C%0A%20%20%20%20%20s%2CTEXT(SEQUENCE(r%2Cc%2C0)%2C%22000%22)%26amp%3Bin%2C%0A%20%20%20%20%20SCAN(%22%22%2Cs%2CLAMBDA(acc%2Ck%2C%0A%20%20%20%20%20%20%20%20%20IF(MOD(--LEFT(k%2C3)%2Cc)%2Cacc%2C%22%22)%26amp%3BMID(k%2C4%2C999))%0A%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3Eok%20after%20trying%20the%20original%20idea%20of%20using%20an%20index()%20inside%20the%20lambda%20of%20the%20original%20in%20I%20got%20the%20nested%20error%20and%20had%20to%20modify%20to%20this%20'less%20attractive'%20version%20of%20concatenating%20the%20'index%20array'%20with%20the%20'array%20of%20values'.%3C%2FP%3E%3CP%3ESorry%20for%20the%20edit%2C%20I%20made%20a%20few%20tweaks%20to%20make%20it%20more%20generalized.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255294%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255294%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20see%20your%20point.%26nbsp%3B%20The%20best%20I%20can%20say%20is%20that%20the%20pitfalls%20are%20relatively%20few.%26nbsp%3B%3C%2FP%3E%3CP%3EA%20bit%20like%20traditional%20Excel%20where%20one%20tries%20to%20explain%20why%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20COUNTIFS(MONTH(date)%2C6))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Edoesn't%20work.%26nbsp%3B%20Because%20CONTIFS%20doesn't%20accept%20array%20parameters%20in%20place%20of%20a%20range%20reference%20always%20sounded%20a%20bit%20lame.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20present%20case%2C%20I%20got%20to%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20MAKEARRAY(2%2C3%2C%20Expand%CE%BB(%0A%20%20%20%20%20%20BYROW(data%2C%20LAMBDA(row%2CThunk%CE%BB(SCAN(%22%22%2C%20row%2C%20Concat%CE%BB))))%0A%20%20%20))%0A%0Awhere%0AExpand%CE%BB%0A%3D%20LAMBDA(%CF%91%2C%20%0A%20%20%20%20LAMBDA(r%2Cc%2C%20%0A%20%20%20%20%20%20%20%20INDEX(INDEX(%CF%91%2C%20r%2C1)()%2C%2Cc)%0A%20%20%20%20))%3B%0A%0AConcat%CE%BB%0A%3D%20LAMBDA(array%2Ccell%2C%20array%26amp%3Bcell)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EIt%20is%20heavy%20going%20but%2C%20once%20done%2C%20it%20can%20be%20reused.%26nbsp%3B%20Hopefully%2C%20not%20too%20often!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255258%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255258%22%20slang%3D%22en-US%22%3EFirst%20-%20and%20obviously%20-%20thanks%20for%20you%20thoughtful%20reply.%20I'll%20play%20with%20both%20options%20against%20other%20examples%2C%20but%20my%20gut%20feeling%20is%20that%20%232%20will%20come%20up%20ahead.%3CBR%20%2F%3E%3CBR%20%2F%3ESecond%20-%20and%20this%20is%20sort%20of%20a%20general%20rant%20-%20having%20played%20around%20with%20many%20of%20the%20new%20shiny%20toys%20recently%20introduced%20to%20Excel%2C%20I%20must%20say%20the%20whole%20process%20feels%20strange%2C%20like%20%22two%20steps%20forward%20-%20one%20step%20back%22.%20This%20one%20is%20a%20great%20example%20of%20Excel%20being%20inconsistent%20in%20applying%20its%20own%20logic%3A%20if%20something%20can%20be%20done%20by%20row%20(or%20by%20column)%20it%20should%20be%20always%20doable%20that%20way%2C%20instead%20of%20letting%20users%20find%20out%20(and%20memorizing)%20the%20circumstances%20where%20the%20logic%20works%20and%20where%20it%20doesn't.%20When%20you%20say%2C%20about%20the%20two%20approaches%20(in%20this%20case)%20to%20overcoming%20the%20problem%2C%20that%20%22neither%20of%20which%20is%20that%20attractive%22%20you%20are%20being%2C%20I%20feel%2C%20very%20polite.%20The%20near%20constant%20need%20to%20look%20for%20%22alternatives%22%2C%20%22workarounds%22%2C%20%22hacks%22%2C%20etc.%20to%20resolve%20issues%20which%20should%20be%20straightforward%20is%20utterly%20exhausting....%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255226%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20SCAN()%20and%20BYROW()%20be%20combined%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255226%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131408%22%20target%3D%22_blank%22%3E%40TheDub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20looks%20like%20it%20should%20work%20and%2C%20indeed%2C%20a%20similar%20formula%20with%20REDUCE%20does%20work.%26nbsp%3B%20Unfortunately%20SCAN%20produces%20an%20array%20on%20each%20row%2C%20leading%20to%20an%20array%20of%20arrays%20which%20hasn't%20been%20implemented%20within%20the%20calc%20engine.%26nbsp%3B%26nbsp%3BThere%20are%20two%20distinct%20approaches%20to%20overcome%20the%20problem%2C%20neither%20of%20which%20is%20that%20attractive.%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20is%20to%20allow%20SCAN%20to%20run%20through%20the%206%20values%20as%20a%20single%20sequence%20but%20to%20reset%20the%20resulting%20text%20to%20null%20whenever%20the%20scan%20returns%20to%20the%20first%20column.%26nbsp%3B%20Rather%20than%20scanning%20the%20text%20array%2C%20I%20scanned%20the%20sequence%20%7B0%2C1%2C2%3B3%2C4%2C5%7D%20which%20can%20both%20be%20used%20to%20look%20up%20the%20text%20to%20concatenate%20and%20to%20identify%20the%20leading%20column.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20SCAN(%22%22%2C%20SEQUENCE(2%2C3%2C0)%2C%0A%20%20%20LAMBDA(str%2Ck%2C%0A%20%20%20%20%20%20LET(%0A%20%20%20%20%20%20%20%20%20row%2C%201%2BQUOTIENT(k%2C3)%2C%0A%20%20%20%20%20%20%20%20%20column%2C%201%2BMOD(k%2C3)%2C%0A%20%20%20%20%20%20%20%20%20chr%2C%20INDEX(data%2C%20row%2C%20column)%2C%0A%20%20%20%20%20%20%20%20%20IF(column%26gt%3B1%2Cstr%2C%22%22)%26amp%3Bchr%0A%20%20%20%20%20%20)%0A%20%20%20)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThe%20second%20approach%20follows%20your%20original%20formula%20more%20closely%20but%2C%20instead%20of%20allowing%20SCAN%20to%20build%20a%20text%20array%2C%20it%20builds%20a%20Thunk%20that%20contains%20the%20array.%26nbsp%3B%20BYROW%20then%20creates%20an%20array%20of%202%20thunks%20and%20if%20the%20result%20is%20passed%20to%20MAKEARRAY%20each%20thunk%20may%20be%20singled%20out%20by%20INDEX%2C%20then%20expanded%20by%20passing%20it%20a%20null%20parameter%20string%20and%20wrapped%20within%20a%20further%20INDEX%2C%20which%20will%20return%20a%20single%20value%20to%20be%20assembled%20into%20the%20solution%20array.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EThunk%CE%BB%0A%3D%20LAMBDA(x%2CLAMBDA(x))%0A%0AForming%20a%20thunk%3A%0A%3D%20LET(%0A%20%20%20%20array%CF%91%2C%20Thunk%CE%BB(array)%2C%0A%0AReturning%20its%20content%3A%0A%3D%20array%CF%91()%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20will%20leave%20it%20to%20you%20to%20judge%20whether%20the%20most%20appropriate%20answer%20to%20your%20question%20is%20'yes'%20or%20'no'!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

The support page for SCAN() contains the following example: 

914422ab-f843-49ba-b0de-082385f9cd11

                                      =SCAN("",A1:C2,LAMBDA(a,b,a&b))

 

My general issue is combining BYROW() or BYCOLUMN() with other functions, but I'll illustrate it with this SCAN() example:

 

How does one SCAN() row by row such that the output it something like:

a, ab, abc

d, de, def

 

=BYROW(A1:C2,LAMBDA(row,SCAN("",row,LAMBDA(a,b,a&b))))

 

doesn't work...

38 Replies
best response confirmed by TheDub (Occasional Contributor)
Solution

@TheDub 

It looks like it should work and, indeed, a similar formula with REDUCE does work.  Unfortunately SCAN produces an array on each row, leading to an array of arrays which hasn't been implemented within the calc engine.  There are two distinct approaches to overcome the problem, neither of which is that attractive. 

The first is to allow SCAN to run through the 6 values as a single sequence but to reset the resulting text to null whenever the scan returns to the first column.  Rather than scanning the text array, I scanned the sequence {0,1,2;3,4,5} which can both be used to look up the text to concatenate and to identify the leading column.

= SCAN("", SEQUENCE(2,3,0),
   LAMBDA(str,k,
      LET(
         row, 1+QUOTIENT(k,3),
         column, 1+MOD(k,3),
         chr, INDEX(data, row, column),
         IF(column>1,str,"")&chr
      )
   )
)

The second approach follows your original formula more closely but, instead of allowing SCAN to build a text array, it builds a Thunk that contains the array.  BYROW then creates an array of 2 thunks and if the result is passed to MAKEARRAY each thunk may be singled out by INDEX, then expanded by passing it a null parameter string and wrapped within a further INDEX, which will return a single value to be assembled into the solution array.

Thunkλ
= LAMBDA(x,LAMBDA(x))

Forming a thunk:
= LET(
    arrayϑ, Thunkλ(array),

Returning its content:
= arrayϑ()

I will leave it to you to judge whether the most appropriate answer to your question is 'yes' or 'no'!

 

First - and obviously - thanks for you thoughtful reply. I'll play with both options against other examples, but my gut feeling is that #2 will come up ahead.

Second - and this is sort of a general rant - having played around with many of the new shiny toys recently introduced to Excel, I must say the whole process feels strange, like "two steps forward - one step back". This one is a great example of Excel being inconsistent in applying its own logic: if something can be done by row (or by column) it should be always doable that way, instead of letting users find out (and memorizing) the circumstances where the logic works and where it doesn't. When you say, about the two approaches (in this case) to overcoming the problem, that "neither of which is that attractive" you are being, I feel, very polite. The near constant need to look for "alternatives", "workarounds", "hacks", etc. to resolve issues which should be straightforward is utterly exhausting....

@TheDub 

I see your point.  The best I can say is that the pitfalls are relatively few. 

A bit like traditional Excel where one tries to explain why

= COUNTIFS(MONTH(date),6))

doesn't work.  Because CONTIFS doesn't accept array parameters in place of a range reference always sounded a bit lame.

 

In the present case, I got to

= MAKEARRAY(2,3, Expandλ(
      BYROW(data, LAMBDA(row,Thunkλ(SCAN("", row, Concatλ))))
   ))

where
Expandλ
= LAMBDA(ϑ, 
    LAMBDA(r,c, 
        INDEX(INDEX(ϑ, r,1)(),,c)
    ));

Concatλ
= LAMBDA(array,cell, array&cell);

It is heavy going but, once done, it can be reused.  Hopefully, not too often!

it seems like your first concept was a cleaner method. Use scan and sequence to perform the scan and a 'reset' for each row something like:

=LET(in,A2:C3,
     r,ROWS(in),
     c,COLUMNS(in),
     s,TEXT(SEQUENCE(r,c,0),"000")&in,
     SCAN("",s,LAMBDA(acc,k,
         IF(MOD(--LEFT(k,3),c),acc,"")&MID(k,4,999))
         )
     )


ok after trying the original idea of using an index() inside the lambda of the original in I got the nested error and had to modify to this 'less attractive' version of concatenating the 'index array' with the 'array of values'.

Sorry for the edit, I made a few tweaks to make it more generalized.

@mtarler 

I still find this class of problem intensely difficult to get my head round and I am frequently guilty of 'reinventing the wheel'.  Unless the solutions can be packaged in the form of meaningful Lambda functions, I suspect the methods lie well beyond the pay grade of the normal Excel developer - and that bearing in mind the assertion of the ICAEW that fewer than 1 in a 1000 Excel users would rate as a developer!

 

All sorts of thoughts float around.  For example, the accumulation may be by concatenation (text), by addition (numbers) or even by multiplication (indices of multidimensional arrays).  Perhaps the operator itself should be a Lambda variable passed into the calculation framework as a parameter (Concatenateλ, Sumλ, Productλ).

 

You were unhappy with the requirement to concatenate the 'index array' with the 'array of values'.  To the best of my knowledge, there is no perfect solution.  For text, a comma-separated list could be used to hold the index/value pair, for numbers, it could be a complex number.  A thunk provides a reasonably standard, if not simple, approach and I think a more normal Lambda function would also be possible, whereby Pairλ(1) is the index and Pairλ(2) the value (INDEX would be inside the Lambda function but the function itself can be passed as a scalar assuming the parameter is missing).

 

Something else I forgot when identifying the possible approaches, was that the second approach of thunks has two distinct implementations.  One builds a column of thunks, each containing an accumulated row, whilst the other builds a row of thunks, each containing a column array.

 

BTW.  My use of 'λ' within the naming might cause confusion for many, who do not use the Greek alphabet to express ideas, but name manager accepts the symbol as just another letter within the name.  Since it is not present as a character on an English language keyboard, I use Autocorrect to convert '\lambda' into 'λ', rather like the equation editor in Word.

As far as I can tell, I am not one of the 10,000 Excel users who rate as a developer by the ICAEW (referred to in your other answer), but I AM a long time, heavy user of Excel so I feel qualified to offer my two cents on this:

 

Having studied your approaches more closely, I have to say that I now tend to prefer your first approach (designated as "Single sequence" in your attachment). Still, the approach involves using 8 different functions (SCAN, SEQUENCE, LABMDA, LET, QUOTIENT, MOD, INDEX and IF)!

The solution proposed by @mtarler - which also works - involves even more (LET,  ROWS, COLUMNS, TEXT,  SEQUENCE, SCAN, LAMBDA, IF, MOD, LEFT and MID) - 11 in total!

 

Just eyeballing these solutions (let alone parsing them) would give your run-of-the-mill non-developer user a headache...

 

What I imagine that type of user would do is just give up on spillable purity, use instead

 

 

 

=SCAN("",A1:C1,LAMBDA(a,b,a&b))

 

 

 

and then drag it down one row - and be done with the whole thing.

@TheDub 

It was as many as 1 in a 1,000 that met the ICAEW criteria of Excel knowledge!

Anyway, I think you are grossly underestimating your own ability.  If it is any consolation, from my initial assessment of your question, I had categorized you as an expert user. 

 

In this instance, I would have some sympathy with the decision to fall back on relative referencing though, since I never use direct cell references (other than within Name Manager to define the Names), I might have

= SCAN("",currentRow, LAMBDA(a,b,a&b))

Where I might put the effort in generate a dynamic array is when there is a follow-up question of "How many more times does the substring "dog" appear within the 5000 rows than "cat".  Another factor might be whether the entire model other than that single concatenation array were dynamic.

 

The question might be, "If someone were to offer you a Lambda function

= HAccumulateλ(initialisationColumn,arrayToAccumulate,Fnλ)

would you use it?"

@TheDub 

Found it!  This discussion  covers much the same ground as one I initiated in the past. 

Accumulating arrays - Microsoft Tech Community

I did have to create 'ConcatThunkλ' by substituting a '+' by '&'. in order to apply the previous function to the new situation!

= AccumulateThunkλ(charArray, charInit, ConcatThunkλ)


where "ConcatThunkλ" 
= LAMBDA(accϑ, strϑ, Thunkλ(accϑ() & strϑ()));

 

 

Well, I'm still trying to parse your function for charArray - I can already see that it involves a bunch of nested lambdas which in turn contain quite a number of functions (BYCOL, SCAN, MAKEARRAY, etc.)...

 

I don't think I'm qualified to have an opinion about whether Excel is now Turing-complete or not (whatever that practically means), but this seems a lot of work for something that in Python, for example, can be accomplished in exactly two lines, one of which is an import statement.

 

BTW, I actually did see and read the discussion you link to - but didn't make the connection; I believe I was (and probably still am) so annoyed by the failure of BYROW to work with SCAN, I couldn't see what was right in front of me!

@TheDub 

The is no need to convince me that the limitation on array of arrays/ranges is both over-restrictive and is now causing difficulties.  I have made such points in the past and @JoeMcDaid explained that Excel never has accepted such data objects; it is just that now one is far more likely to encounter this limitation.

 

At a more mundane level, one can see that

= XLOOKUP(lookupVals,Table1[Name],Table1)

fails, with the output truncated, whilst

= INDEX(
     Table1, 
     XMATCH(lookupVals,Table1[Name]),
     XMATCH(Table1[#Headers],Table1[#Headers])
  )

works, so the problem has earlier manifestations.   What Joe would need is a compelling case for Microsoft to commit resources to the problem and confidence that any change will not cause backward compatibility issues.  My feeling is that it may be sufficient to deal with the problem within the restricted context of the BYROW, BYCOL and MAKEARRAY operators, in order to avoid wider unintended consequences.  After all, for years, SUMPRODUCT (and, I think, AGGREGATE?) broke the rules and allowed array calculation without needing CSE to override implicit intersection, so the idea of exempting specific functions from the rules is not without precedent. 

 

The other thing you need is real-world examples which have been frustrated by the failure of the new helper functions to perform the tasks that they obviously should be capable of.  I think 'send a frown' gets attention, especially if key words channel the query to the correct team.

 

As for the Python 'include', I would prefer to wait and see a solid level on performance at the level of program abstraction currently available to Excel developers before considering even more abstract layers of helper functions.

 

What I am currently doing is to examine the limitations and workarounds, as well as the new opportunities, trying to determine which routes provide best practice.  Nobody would be more pleased than I, if the need for 'too clever by half' solutions were suddenly to disappear.  At least, the practice of building solutions with Lambda functions can conceal the detail and leave more coherent code at user level.

 

@TheDub 

I had also tried to raise this point several times prior to release.  My hope was that something like this would work here,

=SCAN({"";""},data,LAMBDA(a,b,a&b)))

which would be a more efficient implementation of:

=REDUCE("",
     SEQUENCE(COLUMNS(data)),
        LAMBDA(acc,i,
           IF(SEQUENCE(,i)=i,
              INDEX(acc,,i-1)&INDEX(data,,i),
              acc)))

Instead a reusable 'SCANBYROW' function can be implemented via one of the methods Peter suggested, or formula above but this is far from ideal.

As the kids nowadays say, SMH... Functions like that REDUCE() are some kind of abomination: six sub-functions (two of which are used twice), eight sets of "( )"s and an endless stream of ",". After a few of those, one's brain just shuts down

While I understand (I hope) what you are saying and even agree with most of it, I'd like to respond to two statements you make:


the idea of exempting specific functions from the rules is not without precedent.

While I appreciate the power of precedent, the fact that a bad idea is not without precedent doesn't necessarily turn the idea from bad to good.


 What Joe would need is ... confidence that any change will not cause backward compatibility issues.

I'm afraid that ship has already sailed. As a matter of fact, it's not too farfetched to imagine that Excel will one day be forked into incompatible Excel Classic and Excel New Age...

Fair enough, I think many other Excellers out there would agree with such sentiments! As per Peter's earlier comments, formula construction is starting to become more the domain of the developer community - similar examples of functional code abound on stackoverflow.

The post was more to illustrate how an array of results could be generated in 2d rather than an array of 1d-arrays which is not allowed. If similar updates were made to SCAN/BYROW/etc functions one wouldn't need to resort to such headache-inducing formulas (though I'm sure the C++ source code of those functions would be many times worse!)

so i tried to follow the discussion. Can someone maybe describe what that Thunk function is/does. It appears to be just a way to pass an array without it knowing it is passing an array? maybe? a lambda that returns a reference to a lambda? who would have even thunk that would work?

@mtarler 

"Who would have even thunk that would work?"  Who indeed? (grin)

It wasn't immediately obvious to me that the concept could be of any use.  I sometimes think of it as the computing equivalent of the freeze dried survival meal.  In its packaged state, it doesn't look like food but add water and bring to the boil and it is reconstituted as if by magic.

 

Before making a determined effort to exploit Thunks, I had used basic Lambda functions for similar purpose with some success, for example

"Arrayλ"
= LAMBDA(k,INDEX(Array,k))

can be passed as a Lambda variable, but

= Arrayλ({1;2;3})

will return the first 3 terms of the array.  This is actually useful when one is handling multidimensional arrays where expressions like

= Arrayλ(3,1,2)

"Arrayλ"
= LAMBDA(i,j,k, INDEX(Array,i+10*(k-1), j))

will successfully use the 3 indices pick terms from the grid.

 

The Thunk is a bit more obscure

"Arrayϑ"
= LAMBDA(Array)

"Thunkλ"
= LAMBDA(x,LAMBDA(x))

"Arrayϑ"
= Thunkλ(Array)

"Worksheet formula"
= Arrayϑ()

The first term is a thunk, but used inside SCAN will return the array and not the thunk.  To do that one can define a Lambda function Thunkλ with 2 Lambdas (thanks @tboulden).  Apply it to the array and it correctly returns the Thunk.  Add a null parameter string and you magically reconstitute the array (just like the pack of "MaryJanesFarm Kettle Chili"!

@TheDub 

OK.  So I am beginning to get fed up with the arrays of arrays problem with the 365 lambda helper functions.  Isn't that what one uses spreadsheets for?

Re: merging rows - Microsoft Tech Community

Every table is a list of records.  Crosstabs are arrays of arrays.  I would say that up to 80% of my workbooks would benefit from being able to handle arrays of arrays efficiently.  

 

OK, thunks do offer a way around the problem and I am getting better at using them.  The attached workbook has Lambda functions Thunkλ and ExpandThunkλ that I have used to form and expand the arrays of thunks, but it is still a pain and I struggle to see how I would convince a normal Excel user that this is better than 'and copy down (ugh!)'.

Following the announcement of the new array functions, I wondered if VSTACK or some other function could be put to use in this type of situation to extend BYROW?

 

In the absence of a built-in function, maybe define instead:

BYROWS
=LAMBDA(array,function,
     REDUCE(1,
         SEQUENCE(ROWS(array)),
         LAMBDA(A,i,
              IF(SEQUENCE(i)=i,
                  function(INDEX(array,i,)),
                  A))))

which could be used in conjunction with SCAN as shown... 

(Out of interest I did rough timings of the various implementations on a 100x100 array)

 

Screenshot 2022-03-24 104213.png

 

 

@lori_m 

My first attempt

reduceV=
LAMBDA(array,
    DROP(
        REDUCE(
            "",
            SEQUENCE(ROWS(array)),
            LAMBDA(a, n,
                VSTACK(
                    a,
                    SCAN(, CHOOSEROWS(array, n),
                        LAMBDA(acc, v, acc & v))
                )
            )
        ),
        1
    )
);

which gives

image.png

Not sure how to integrate it with timer.