Array Transformation functions

ARWSRPT

Reference

» Reference, Discussion, & Example Applications:

About

Repeats items in the first column of an array, by a ‘repeat number’ in the last column of the array.

Inputs:

  • ar : input array (repeat values should be in last column)

Code

M.S. Excel
ARWSRPT = 
LAMBDA(ar,
    LET(
        a, DROP(ar, , -1),
        n, TAKE(ar, , -1),
        INDEX(a, TOCOL(IF(n >= SEQUENCE(, MAX(n)), SEQUENCE(ROWS(a)), NA()), 2), SEQUENCE(, COLUMNS(a)))
    )
);