Search code examples
arraysgoogle-sheetsgoogle-sheets-formulatransposediagonal

Transpose Data row to Diagonal in Google Spreadsheet


I've tried to find a Google Spreadsheet formula that would transpose the rows of, say, a 5-column array to the diagonal, like this (assuming data in e.g. A1:E20)

A1

A2 B1

A3 B2 C1

A4 B3 C2 D1

A5 B4 C3 D2 E1

A6 B5 C4 D3 E2

A7 B6 C5 D4 E3
...

I've found solutions for the opposite problem (from diagonal to row or column - many thanks for helping) but not for this one.

Your help is much appreciated!


Solution

  • Here's another way that goes back to your original post

    =iferror(if(columns($A1:A1)>rows(A$1:A1),"",index(A$1:A$5,rows(A$1:A1)-columns($A1:A1)+1)),"")
    

    enter image description here