How to Use the TRANSPOSE Function in Google Sheets | Swap Rows and Columns
What Is the TRANSPOSE Function?
The TRANSPOSE function is an array function that swaps the rows and columns (vertical and horizontal orientation) of a specified cell range. When you update data in the original table, the transposed table updates automatically in real time.
Syntax
=TRANSPOSE(array_or_range)
- array_or_range: The cell range or array whose rows and columns you want to swap.
Practical Examples
This example swaps a horizontal table in A1:C2 into a vertical table starting at A4 using TRANSPOSE.
Original Table (A1:C2)
| Row | Col A | Col B | Col C |
|---|---|---|---|
| 1 | Month | April | May |
| 2 | Sales | 100 | 120 |
Transposed Table (enter =TRANSPOSE(A1:C2) in cell A4)
| Row | Col A | Col B |
|---|---|---|
| 4 | Month | Sales |
| 5 | April | 100 |
| 6 | May | 120 |
Common Errors and Precautions
#REF!error (overwrite collision): If even a single cell in the destination area where the transposed data will expand (A4:B6in the example above) contains text or a number, a#REF!error occurs and nothing is displayed. Make sure the entire destination range is blank.- Formatting (colors and borders) is not carried over:
TRANSPOSEonly swaps values. Background colors, font sizes, and number formats (such as currency symbols or date formats) from the original cells are not copied automatically, so apply formatting separately to the destination range.
Frequently Asked Questions
Q. What is the difference between 'Paste transposed' and the TRANSPOSE function?
A. 'Paste transposed' creates a static copy of values, so changes to the original table are not reflected. The TRANSPOSE function stays linked to the original table and automatically updates whenever the source data is edited.
Q. Can I directly edit a cell output by the TRANSPOSE function?
A. No. Editing any cell in the output array directly will break the array and cause a #REF! error. Edit the original source table instead.