Google-sheets – How toterate between colunns and rows

concatenateformulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-query

I am running the following forumula:

=IF(INDEX(C$2:$2, 1, ROW(1:1)),CONCATENATE(B$2,"-",INDEX(C$1:$1, 1, ROW(1:1))))

On the following table

Basically, If a value is present in column C2, I am returning the value + the value of B2. I would like to do this for all the columns up to O2, however, once I reach column O2, I would like to move to the next row and have the process start with a new row. How would I do this?

Best Answer

=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(C2:O<>"", "♦"&B2:B&"-"&C1:O1, )),,999^99)),,999^99), "♦"))))

0