'Google Sheets COLUMN TOP ArrayFormula to calculate ROW wise which require ROW-wise ArrayFormula

Ref link below.

Essentially the aim to get a geometric progression with each term repeated X times.

The correct result on the sheet is obtained using an ArrayFormula across a row. This requires copying the formula column wise.

What I would like is a single ArrayFormula atop the column, that calcluates the results row wise (as indicated). My attempt on the sheet fails.

sheet link



Solution 1:[1]

Same solution as Matt's, the only difference is that repetition is done using regex.

Try this (on sheet kishkin):

=ARRAYFORMULA(
  IF(
    A2:A = "",,
      REGEXREPLACE(
        REGEXREPLACE(
          TRANSPOSE(QUERY(TRANSPOSE(
            IF(
              SEQUENCE(1, MAX(C2:C)) > C2:C,,
                ROUND(A2:A * B2:B ^ SEQUENCE(1, MAX(C2:C),)) & ","
            )
          ),, MAX(C2:C))),
          "[^,\s]+,?",
          REPT("$0", D2:D)
        ),
        "\s+|,\s*$",
      )
  )
)

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kishkin