TRANSPOSE and TOCOL: turning tables round
=TRANSPOSE(A1:E2) turns a table on its side, so rows become columns, and it works in every version of Excel. =TOCOL(B2:F4,1) puts every cell of a grid into one column and leaves out the blanks; TOCOL is in Excel for Microsoft 365 (Windows and Mac), Excel 2024, Excel for the web and Google Sheets, but not Excel 2021 or older. Both spill: you type the formula in one cell and the answer fills the cells around it.
The formulas at a glance
| You want | Formula or button | What you get |
|---|---|---|
| Rows as columns, kept up to date | =TRANSPOSE(A1:E2) | The table on its side, linked to the original |
| Rows as columns, once | Copy, then Paste Special, tick Transpose | A turned copy you can edit |
| A grid as one column | =TOCOL(B2:F3,1) | Every name, row by row, without blanks |
| Each name once | =UNIQUE(TOCOL(B2:F3,1)) | Everyone on the rota, no repeats |
| Column by column | =TOCOL(B2:F3,1,TRUE) | Down each column in turn |
| A grid as one row | =TOROW(B2:F3,1) | The same list, going across |
Each one is worked through below.
TRANSPOSE: rows become columns
A report has the months going across, but you need them going down. The table is 2 rows by 5 columns, so turned round it's 5 rows by 2 columns. Give TRANSPOSE the whole table, headings included:
=TRANSPOSE(A1:E2)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Apr | May | Jun | Jul |
| 2 | Sales | £4,200.00 | £3,900.00 | £5,100.00 | £4,800.00 |
| 3 | |||||
| 4 | Month | Sales | |||
| 5 | Apr | £4,200.00 | |||
| 6 | May | £3,900.00 | |||
| 7 | Jun | £5,100.00 | |||
| 8 | Jul | £4,800.00 |
The new table stays linked: change May's sales in C2 and the copy below changes too. It copies values only, so format the turned table yourself, such as the £ signs here.
In Excel 2019 and older, TRANSPOSE is an array formula: select the whole space for the answer first (5 rows by 2 columns here), type the formula, and enter it as an array formula. In Excel for Microsoft 365, 2021 and 2024 you type it in one cell and it spills.
Transpose once, with Paste Special
If you only need a one-off turned copy, there's no need for a formula. Copy the table with Ctrl+
The copy isn't linked, so it won't change when the original does, but you can edit it freely. It also keeps the formatting. Use the TRANSPOSE function when the original keeps changing, and Paste Special for a one-off tidy.
TOCOL: a grid into one list
A rota has a name in every shift. TOCOL reads along each row in turn and puts every value in one column. The rota has 10 shifts and 2 are empty. Without anything else, TOCOL keeps the empty shifts and shows each one as a 0. Add a 1 as the second part to leave them out, which leaves 8 names:
=TOCOL(B2:F3,1)
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Shift | Mon | Tue | Wed | Thu | Fri | With blanks | Without | |
| 2 | Early | Amira | Ben | Amira | Cara | Amira | Amira | ||
| 3 | Late | Dev | Dev | Ben | Ewa | Ben | Ben | ||
| 4 | Amira | Amira | |||||||
| 5 | 0 | Cara | |||||||
| 6 | Cara | Dev | |||||||
| 7 | Dev | Dev | |||||||
| 8 | Dev | Ben | |||||||
| 9 | Ben | Ewa | |||||||
| 10 | Ewa | ||||||||
| 11 | 0 |
The 1 skips blanks. A 2 skips error values such as #N/A, and a 3 skips both.
Each name once
Who's working this week? People work more than one shift, so the list has repeats: Amira, Ben and Dev each come up twice. Put the TOCOL inside UNIQUE to list each name once:
=UNIQUE(TOCOL(B2:F3,1))
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Shift | Mon | Tue | Wed | Thu | Fri | Working | A to Z | |
| 2 | Early | Amira | Ben | Amira | Cara | Amira | Amira | ||
| 3 | Late | Dev | Dev | Ben | Ewa | Ben | Ben | ||
| 4 | Cara | Cara | |||||||
| 5 | Dev | Dev | |||||||
| 6 | Ewa | Ewa |
Wrap it in SORT for an A to Z list, as in I2, or in COUNTA to count the people: =COUNTA(UNIQUE(TOCOL(B2:F3,1))) gives 5. There's more on these in UNIQUE and FILTER and SORT and SORTBY.
Column by column
TOCOL reads along the rows unless you tell it otherwise. Put TRUE as the third part to read down each column in turn instead. On the rota, that lists the shifts day by day: Monday's early and late, then Tuesday's, and so on.
=TOCOL(B2:F3,1,TRUE)
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Shift | Mon | Tue | Wed | Thu | Fri | Day by day | |
| 2 | Early | Amira | Ben | Amira | Cara | Amira | ||
| 3 | Late | Dev | Dev | Ben | Ewa | Dev | ||
| 4 | Ben | |||||||
| 5 | Dev | |||||||
| 6 | Amira | |||||||
| 7 | Ben | |||||||
| 8 | Ewa | |||||||
| 9 | Cara |
TOROW does the same as TOCOL, but going across: =TOROW(B2:F3,1) puts the 8 names in one row. To stack whole lists on top of each other instead, see VSTACK and HSTACK.
TOCOL is also a quick way to tidy a list with gaps, such as a column with blank rows: =TOCOL(A2:A50,1) gives the values close together. Then TAKE can pick the last one: =TAKE(TOCOL(A2:A50,1),-1).
Common mistakes
Blank cells come out as 0
Without the 1, TOCOL keeps empty cells, and they show as 0. Use TOCOL(B2:F3,1).
The row labels in the list
Start the range after the labels. =TOCOL(A2:F3,1) takes in column A too, so Early and Late join the list of names.
#SPILL! from TRANSPOSE
The turned-round table needs room: a table 2 rows by 5 columns needs 5 rows by 2 columns. Clear the space first (see #SPILL!).
0 in place of an empty cell
TRANSPOSE shows an empty cell in the original as 0. To keep it blank, test for it: =TRANSPOSE(IF(A1:E2="","",A1:E2)).
Try it now
In H2, list everyone on this week's rota once each, reading along each row in turn. TOCOL with 1 turns the grid B2:F4 into one column without the empty shifts, and UNIQUE takes out the repeats.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Shift | Mon | Tue | Wed | Thu | Fri | On the rota | |
| 2 | Early | Amira | Ben | Amira | Cara | |||
| 3 | Late | Dev | Dev | Ben | Ewa | |||
| 4 | Night | Finn | Finn | Gita | Gita | |||
| 5 | ||||||||
| 6 | ||||||||
| 7 | ||||||||
| 8 |
Open this in Try a formula: the same sheet with the answer filled in, to change or share by link.
Part of Excel data analysis practice: every lesson on the topic, with a project in Excel.
Where it works
TRANSPOSE is in every version of Excel, on Windows and Mac and in Excel for the web, and in Google Sheets. TOCOL and TOROW are in Excel for Microsoft 365 on Windows and Mac, Excel 2024, Excel for the web and Google Sheets. Excel 2021 and older show #NAME? for them.
Questions
How do I transpose data in Excel without a formula?
Copy the cells, click where the top-left corner of the turned copy should go, then open Paste Special and tick Transpose. Paste Special is Ctrl+Alt+V on Windows and Cmd+Control+V in Excel for Mac, or Control-click and choose Paste Special. The copy isn't linked to the original, so it won't update, but you can edit it and it keeps the formatting.
How do I turn several columns into one column in Excel?
Use TOCOL: =TOCOL(B2:F10,1) puts every cell of B2:F10 into one column, reading along each row, and the 1 leaves out empty cells. Add TRUE as a third part to read down each column in turn instead: =TOCOL(B2:F10,1,TRUE). TOCOL needs Microsoft 365, Excel 2024 or Excel for the web.
Why does TOCOL show zeros?
The range has empty cells, and TOCOL keeps them unless you tell it not to. Each one comes out as 0. Put 1 as the second part to skip blanks: =TOCOL(B2:F10,1). If the range has error values such as #N/A, use 3 to skip blanks and errors both. A cell with a space in it isn't empty, so tidy those with TRIM first.
Does TRANSPOSE update when the original changes?
Yes, the TRANSPOSE function stays linked: change a number in the original and the turned copy changes too. It copies the values only, so set the formatting on the new cells yourself. The Transpose box in Paste Special works the other way: it makes a fixed copy with the formatting, which won't change when the original does.