Search code examples
google-sheetsgoogle-sheets-formulatransposearray-formulasgoogle-sheets-query

In Google Sheets, how to transpose multiple column headers and data into a single column of multiple row labels and data


Not sure what is the proper spreadsheet terminology to word this.

How to turn this:

+-----------+-----------+-----------+...
|Username   |First Name |Second Name|...
+-----------+-----------+-----------+...
|Uname1     |FName1     |SName1     |...
+-----------+-----------+-----------+...
|Uname2     |FName2     |SName2     |...
+-----------+-----------+-----------+...
|Uname3     |FName3     |SName3     |...
+-----------+-----------+-----------+...
:           :           :           :

Into this?:

+-----------+-----------+
|Username   |Uname1     |
+-----------+-----------+
|First Name |FName1     |
+-----------+-----------+
|Second Name|SName1     |
+-----------+-----------+
|Username   |Uname2     |
+-----------+-----------+
|First Name |FName2     |
+-----------+-----------+
|Second Name|SName2     |
+-----------+-----------+
:           :           : 

The ellipsis means the multiple columns/rows continues.

I tried googling transposing columns to rows, but couldn't find the exact solution to the question.


Solution

  • try:

    =ARRAYFORMULA(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
     IF(A2:C<>"", "♦"&A1:C1&"♥"&A2:C, )),,999^99)),,999^99), "♦")), "♥"))
    

    0