Array ‘By Element’ functions
ATEXTSPILL
Reference
» Reference, Discussion, & Example Applications:
About
Applies a a helper lambda function by row, on a 1-D column vector.
That is, expands a column vector into rows (depending on the function passed into it).
Inputs:
- cl : column vector
 - fn : lambda helper function argument: e.g. LAMBDA(x,TEXTSPLIT(x,…)), or TEXTBEFORE(x,…
 - [nf] : not found argument: if omitted => empty string “”
 
Code
  M.S. Excel
  
ATEXTSPILL = LAMBDA(cl, fn, [nf],
    LET(
        e, IF(ISOMITTED(nf), "", nf),
        r, REDUCE(
            0,
            SEQUENCE(ROWS(cl)),
            LAMBDA(v, i, VSTACK(v, IFERROR(fn(INDEX(cl, i, 1)), e)))
        ),
        t, IFNA(DROP(r, 1), ""),
        a, IF(AND(t = ""), e, t),
        IFERROR(--a, a)
    )
);
                        
                            
                        
                    Feedback
Submit and view feedback