Example 1
Flatten a grid, row by row
E2 =TOCOL(A2:C4)
Result: 10; 20; 30; 40; 50; 60; 70; 80; 90
TOCOL reads the first row left to right, then the second row, then the third.
E2 =TOCOL(A2:C4) returns 10; 20; 30; 40; 50; 60; 70; 80; 90
Turns a range or array into a single column, optionally skipping blanks and errors.
Syntax
=TOCOL(, , )
Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.
Try it
Edit the formula in E2 or change the inputs. The sheet recalculates as you type.
E2 =TOCOL(A2:C4) returns 10; 20; 30; 40; 50; 60; 70; 80; 90
TOCOL flattens a block of cells into one column. A table of 3 rows by 3 columns becomes a list of nine items. It is the tool for reshaping data before you count, rank, filter or chart it.
0 keeps everything. 1 skips empty cells. 2 skips errors. 3 skips both. Skipping blanks and errors is what makes TOCOL useful on messy ranges.TRUE it reads the first column from top to bottom, then the second column.=TOCOL(A2:C4) reads 10, 20, 30, 40 and on. =TOCOL(A2:C4,0,TRUE) reads 10, 40, 70, 20 and on. The empty second argument keeps the default.
Real ranges have gaps and the odd error. =TOCOL(A2:C4,3) drops them in one step and returns only the usable values. Without ignore, a blank cell is returned as 0 and an error is returned as the error.
This lets you run other functions on a list that is clean. For example, =SORT(TOCOL(A2:C4,1)) ranks every filled cell in a grid, and =UNIQUE(TOCOL(A2:C4,1)) lists the distinct values it holds.
A common job is changing a cross-tab into a list. If a seating plan, a roster or a set of survey answers is spread across a grid, TOCOL puts every item in one column so you can count them with COUNTIF or look something up. Combine it with UNIQUE to find out how many different values the grid contains.
TOROW does the same but returns a row. WRAPROWS and WRAPCOLS go the opposite way, folding a single row or column back into a grid. VSTACK joins arrays but keeps their shape. TOCOL is the one that stacks every cell on top of the next.
TOCOL also accepts several ranges at once through VSTACK: =TOCOL(VSTACK(A2:C4,F2:H4)) flattens two separate blocks.
The result spills down from the cell you typed in. If the cells below aren't empty, you get #SPILL!. Use # after the anchor cell to refer to the whole list, as in =COUNT(E2#). See FILTER for more.
If nothing is left after the ignore option removes everything, the result is #CALC!.
TOCOL needs Microsoft 365, Excel 2024 or later, or Excel for the web.
A2:C4.0 keeps everything, and is the default. 1 skips blank cells. 2 skips errors. 3 skips both blanks and errors.FALSE, the default, reads the array across each row, left to right, then moves down. TRUE reads down each column, then moves right.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
E2 =TOCOL(A2:C4)
Result: 10; 20; 30; 40; 50; 60; 70; 80; 90
TOCOL reads the first row left to right, then the second row, then the third.
E2 =TOCOL(A2:C4) returns 10; 20; 30; 40; 50; 60; 70; 80; 90
Example 2
E2 =TOCOL(A2:C4,0,TRUE)
Result: 10; 40; 70; 20; 50; 80; 30; 60; 90
The third argument TRUE reads the first column from top to bottom, then the second, then the third.
E2 =TOCOL(A2:C4,0,TRUE) returns 10; 40; 70; 20; 50; 80; 30; 60; 90
Example 3
E2 =TOCOL(A2:C4,3)
Result: 5; 7; 9; 13; 15; 17
B2 is empty and A3 holds #N/A. Option 3 leaves out both, so six clean values remain.
E2 =TOCOL(A2:C4,3) returns 5; 7; 9; 13; 15; 17
Example 4
E2 =TOCOL(A2:C4,1)
Result: 5; 7; #N/A; 9; 13; 15; 17
Option 1 removes only the empty cell, so the #N/A is returned in its place. Use 2 to remove errors and keep blanks.
E2 =TOCOL(A2:C4,1) returns 5; 7; #N/A; 9; 13; 15; 17
Example 5
E2 =SORT(TOCOL(A2:C4),,-1)
Result: 90; 80; 70; 60; 50; 40; 30; 20; 10
TOCOL turns the grid into a list that SORT can rank. The empty second argument sorts by the first (only) column.
E2 =SORT(TOCOL(A2:C4),,-1) returns 90; 80; 70; 60; 50; 40; 30; 20; 10
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In E2, list every filled value in A2:C5 in one column, reading across each row. Leave out the empty cells.
Answer in E2.
ignore to 1 or 3. A list of scores that includes zeros you did not enter is usually this.array puts the header text in the list. Start the range at the first data row.#CALC! means the ignore option removed everything, so the result would be empty. Check that the range holds values.#SPILL! means the cells below the formula are not empty.Use `=TOCOL(A2:C4)`. It reads across each row and returns every cell in one column. Add `,0,TRUE` to read down each column instead.
Set the second argument to 1: `=TOCOL(A2:C4,1)`. Use 3 to skip errors too, and 2 to skip errors only.
Use `=TOCOL(A2:C20)` for adjacent columns, or `=TOCOL(VSTACK(A2:A20,D2:D20,G2:G20))` for separate ones. Add the ignore option to drop blanks.
VSTACK stacks arrays and keeps each one's width. TOCOL flattens every cell, so the result is always a single column.
No. It is available in Microsoft 365, Excel 2024 and later, and Excel for the web. Earlier versions return `#NAME?`.
Tracks take you from the basics to modelling, one graded exercise at a time.