Forum Discussion

AlphaEra's avatar
AlphaEra
Brass Contributor
Jan 06, 2026
Solved

Is there a way to work around Circular reference in Dynamic Array?

Hi! I am trying to convert a table into a dynamic array, but the rows in the table is referring to other column's previous row value, so when I try to convert it into a dynamic array, it'll become ...
  • djclements's avatar
    Jan 06, 2026

    One way to achieve this is to utilize a CHOOSE based lambda function to store and recall multiple items at each iteration of SCAN, then MAP the results to return each individual item. For example:

    =LET(
        val, LAMBDA([a],[b], LAMBDA(x, CHOOSE(x, a, b))),
        num, SEQUENCE(, 2),
        arr, SCAN(val(), Table1[Col1], LAMBDA(acc,one, LAMBDA(two, val(two, IF(two < 0, 10, 5)))(IF(one < 0, one + acc(2), 0)))),
        MAP(IFNA(arr, num), IFNA(num, arr), LAMBDA(f,x, f(x)))
    )

    Replace Table1[Col1] with the reference to your dynamic column 1 as needed.

Resources