Would a FOR.EACH function be useful in Excel 365?

%3CLINGO-SUB%20id%3D%22lingo-sub-1717371%22%20slang%3D%22en-US%22%3EWould%20a%20FOR.EACH%20function%20be%20useful%20in%20Excel%20365%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1717371%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20attached%20files%20are%20based%20upon%20a%20workbook%20that%20emulates%20the%20proposed%20function%20using%20a%20VBA%20macro.%26nbsp%3B%20There%20would%20appear%20to%20be%20many%20potential%20applications%20in%20situations%20where%20the%26nbsp%3B%40operator%20needs%20to%20be%20used%20to%20restrict%20the%20operation%20of%20an%20array%20parameter.%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%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222427i70ECD5A6E1DDB598%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22Intro%20sheet%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EIntro%20sheet%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20586px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222428iEBAC00432E6ADE26%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%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-LABS%20id%3D%22lingo-labs-1717371%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1720170%22%20slang%3D%22en-US%22%3ERe%3A%20Would%20a%20FOR.EACH%20function%20be%20useful%20in%20Excel%20365%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1720170%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20have%20attached%20an%20updated%20file%20to%20the%20previous%20post%20which%20allows%20for%20formulae%20that%20return%201D%20arrays%2C%20giving%20an%20array%20of%20arrays%20held%20within%20a%202D%20spilt%20range.%26nbsp%3B%20Comments%20would%20be%20welcome!%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20679px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222562i87CDF1AD9A594FDC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20668px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222566i5AA0B831944F883B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Valued Contributor

The attached files are based upon a workbook that emulates the proposed function using a VBA macro.  There would appear to be many potential applications in situations where the @operator needs to be used to restrict the operation of an array parameter.

 

Intro sheetIntro sheetimage.png

2 Replies
Highlighted

I have attached an updated file to the previous post which allows for formulae that return 1D arrays, giving an array of arrays held within a 2D spilt range.  Comments would be welcome!

 

image.pngimage.png

Highlighted

@Peter Bartholomew 

Still working.  the present sheet was written as a demonstration of LET relevant to a question on Chandoo.  The last entry for each field of a table was returned using XLOOKUP.  It is not possible to search multiple rows within a single array formula, so the column is picked up as a relative reference.

 

Wrapping the formula within FOR.EACH removes the need for relative referencing and returns the results as a dynamic array.

FOREACH replaces relative referencingFOREACH replaces relative referencing

Whereas the previous workbooks were created to demonstrate and idea and put it forward for discussion, this time I simply built the formula around an existing solution.  The implementation of the macro is still weak but the idea seems to work well.