ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dynamic arrays
  3. Excel TOCOL Function: Turn a Grid Into One Column

Excel TOCOL Function: Turn a Grid Into One Column

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

TOCOL turns a range or array into a single column. Write =TOCOL(array, [ignore], [scan_by_column]). Use 1 as the second argument to skip blank cells, 2 to skip errors and 3 to skip both. TOCOL reads row by row unless the third argument is TRUE. It needs Microsoft 365 or Excel 2024.

Key takeaways

  • =TOCOL(B2:D4) stacks every cell of the grid into one spilled column.
  • Without the ignore argument, empty cells come back as 0. Use 1 to skip them.
  • TOCOL reads across each row first. Add TRUE as the third argument to read down each column instead.
  • =SORT(UNIQUE(TOCOL(B2:D4,1))) gives a clean A to Z list of every name in a grid.
  • TOCOL needs Microsoft 365 or Excel 2024. Older versions can use INDEX with INT and MOD.
On this page+
  1. What does the TOCOL function do?
  2. A basic TOCOL example
  3. How to skip blanks and errors
  4. How to read column by column
  5. TOCOL with UNIQUE and SORT
  6. How to flatten a grid in older Excel
  7. Common TOCOL problems
  8. Practise it

The TOCOL function in Excel turns a grid of cells into one column. You give it a range, such as a rota with names spread across several days, and it stacks every value into a single list. That list is much easier to count, sort or de-duplicate. This guide covers the syntax, the options for blanks and errors, and the formulas people use TOCOL for most.

What does the TOCOL function do?#

TOCOL reads every cell in a range and returns the values in one column. The result is a dynamic array: it spills, which means it fills the cells below the formula automatically. The syntax has three parts:

Excel formula
=TOCOL(array, [ignore], [scan_by_column])
ArgumentWhat it meansOptions
arrayThe range or array to flattenAny shape, such as B2:D4
ignoreValues to leave out (optional)0 keep all (default), 1 skip blanks, 2 skip errors, 3 skip both
scan_by_columnReading order (optional)FALSE by row (default), TRUE by column

TOCOL is available in Microsoft 365, Excel 2024 and Excel for the web. In Excel 2021 or older, the formula shows #NAME?. If spilled results are new to you, read dynamic arrays explained first.

A basic TOCOL example#

The examples below use this shift rota in A1:D4. Cell C3 is empty because nobody is booked for that shift:

ABCD
1ShiftMonTueWed
2EarlyAnaBenAna
3LateCaraDev
4NightEliCaraBen

Click F2 and type:

Excel formula
=TOCOL(B2:D4)

The result spills down nine cells: Ana, Ben, Ana, Cara, 0, Dev, Eli, Cara, Ben. TOCOL reads across row 2, then row 3, then row 4. The 0 is the empty cell C3. TOCOL keeps blanks by default and shows them as zero.

How to skip blanks and errors#

Use the second argument to leave values out. To drop the empty cell:

Excel formula
=TOCOL(B2:D4,1)

Now the list has eight names with no 0. The other options work the same way:

  • 2 skips error values such as #N/A or #DIV/0!. This is handy when the grid holds lookup results and some lookups fail.
  • 3 skips both blanks and errors.

A cell that contains a formula returning "" isn't truly empty, so option 1 keeps it as an empty-looking text value. If your list still has gaps, check the source for formulas like =IF(B2="","",B2).

How to read column by column#

TOCOL reads row by row unless you tell it otherwise. Set the third argument to TRUE to read down each column instead:

Excel formula
=TOCOL(B2:D4,1,TRUE)

This returns Ana, Cara, Eli (Monday), Ben, Cara (Tuesday), then Ana, Dev, Ben (Wednesday). Choose the order that matches how the grid is organised. For a rota with days as columns, reading by column keeps each day's names together.

TOCOL has a twin, TOROW, which takes the same arguments and returns one row instead. And if you only want to flip a range sideways while keeping it as a grid, that's a job for TRANSPOSE. The guide to transposing data in Excel explains the difference.

TOCOL with UNIQUE and SORT#

TOCOL is most useful as the first step inside another function. UNIQUE and SORT expect a single list, so TOCOL prepares the grid for them.

To list everyone on the rota once, A to Z:

Excel formula
=SORT(UNIQUE(TOCOL(B2:D4,1)))

The result is Ana, Ben, Cara, Dev, Eli. TOCOL flattens the grid, UNIQUE removes the repeats and SORT puts the names in order. The UNIQUE function guide and the SORT function guide explain every argument, and getting unique values from multiple columns shows more variations, including VSTACK for columns that aren't next to each other.

Other useful combinations:

GoalFormulaResult on the rota
Count all booked shifts=ROWS(TOCOL(B2:D4,1))8
Count different people=ROWS(UNIQUE(TOCOL(B2:D4,1)))5
Shifts for Ana=SUM(--(TOCOL(B2:D4,1)="Ana"))2

To use the spilled list in another formula, refer to its first cell with a #. If the TOCOL formula is in F2, =COUNTA(F2#) counts every value it returned. The article on spill range references covers this in detail. The UNIQUE function article has more ways to count and filter the result.

How to flatten a grid in older Excel#

Without TOCOL, use INDEX with INT and MOD to read the grid one position at a time. For a grid 3 columns wide, item number n sits in row INT((n-1)/3)+1 and column MOD(n-1,3)+1. In F2, type:

Excel formula
=INDEX($B$2:$D$4,INT((ROWS($F$2:F2)-1)/3)+1,MOD(ROWS($F$2:F2)-1,3)+1)

Fill it down nine rows (Windows: Ctrl+D; Mac: ⌘D). ROWS($F$2:F2) counts 1, 2, 3 as you go down, so each row returns the next item. Change the 3 to the number of columns in your grid. To know how many rows to fill, use =ROWS(B2:D4)*COLUMNS(B2:D4), which gives 9 here. Unlike TOCOL, this method can't skip blanks, and empty cells return 0.

Common TOCOL problems#

Most TOCOL issues come from the version, the space below the formula, or the source data:

  1. #NAME? Your Excel doesn't have TOCOL. Use the INDEX method above.
  2. #SPILL! Something is in the way of the result. Clear the cells below the formula.
  3. Zeros in the list. The source has empty cells. Add 1 as the second argument.
  4. Wrong order. Switch the third argument between FALSE and TRUE.
  5. Header text in the list. Start the range below the header row, as in B2:D4, not B1:D4.

Practise it#

Try the exercise on this page: it uses the INDEX method to find any position in a grid, which is exactly the logic TOCOL runs for you. Then practise modern Excel functions in a live spreadsheet to work with spilled results and # references, and practise UNIQUE in its own lesson to turn long lists into clean ones.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Older Excel has no TOCOL, but INDEX can still pull the item at any position of the grid, reading row by row. Click F2 and return item number E2 (6) from B2:D4, using INT for the row and MOD for the column, then press Enter.

fx
ABCDEFG
1
Shift
Mon
Tue
Wed
Position
2
Early
Ana
Ben
Ana
6
3
Late
Cara
Dev
4
Night
Eli
Cara
Ben
5
6
7

Tip: The grid is 3 columns wide. INT((E2-1)/3)+1 gives the row and MOD(E2-1,3)+1 gives the column.

Practise this in a lesson

LessonModern Excel: XMATCH, SORTBY, TEXTSPLIT and spill references (A2#)Split names with TEXTSPLIT, find positions with XMATCH, sort by another column with SORTBY, and refer to a whole spilled result with A2#.LessonUNIQUE: list and count distinct valuesPull a clean list of distinct regions or customers with UNIQUE, then count them with COUNTA.Function guideUNIQUEList distinct values with Excel's UNIQUE, count them with COUNTA, or find items that appear only once. Examples plus a live exercise.Function guideSORTSort a range with a formula using Excel's SORT. Sort by any column, highest first, or combined with FILTER. Includes a live exercise.

Frequently asked questions

What does TOCOL do in Excel?

+

TOCOL takes a range or array of any shape and returns all its values in one column. The result spills into the cells below the formula.

How do I stop TOCOL returning zeros?

+

Zeros appear where the source has empty cells. Add 1 as the second argument, as in =TOCOL(B2:D4,1), and TOCOL skips the blanks.

Why does TOCOL show #NAME? in my Excel?

+

Your version doesn't have TOCOL. It is available in Microsoft 365, Excel 2024 and Excel for the web, but not in Excel 2021 or older.

What is the difference between TOCOL and TOROW?

+

They do the same job in different directions. TOCOL returns one column and TOROW returns one row. Both take the same three arguments.

What is the difference between TOCOL and TRANSPOSE?

+

TRANSPOSE flips a range so rows become columns, but keeps it as a grid. TOCOL flattens the grid into a single column.

Sources

  • Dynamic array formulas and spilled array behavior - Microsoft Support
  • UNIQUE function - Microsoft Support
  • SORT function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What does the TOCOL function do?
  2. A basic TOCOL example
  3. How to skip blanks and errors
  4. How to read column by column
  5. TOCOL with UNIQUE and SORT
  6. How to flatten a grid in older Excel
  7. Common TOCOL problems
  8. Practise it

Keep reading

Dynamic arrays· 7 min read

Get Unique Values From Multiple Columns in Excel

To get unique values from multiple columns in Excel, turn the columns into one list with TOCOL, then pass it to UNIQUE: =UNIQUE(TOCOL(A2:C5,1)). The 1 skips blank cells. Wrap it in SORT for an A to Z list. TOCOL needs Microsoft 365 or Excel 2024. In older versions, stack the columns into one and use Remove Duplicates.

Dynamic arrays· 6 min read

TRANSPOSE in Excel: Flip Rows and Columns

To transpose in Excel, copy the range, right-click the destination and choose Paste Special > Transpose. That makes a static copy with rows and columns swapped. For a copy that updates when the original changes, type =TRANSPOSE(A1:E2) in one cell; in Excel 2021 and Microsoft 365 it spills automatically.

Dynamic arrays· 6 min read

Dynamic Arrays in Excel Explained Simply

Dynamic arrays let one Excel formula return several values that spill into the cells below or beside it. Type =UNIQUE(B2:B9) in one cell and the whole list appears, then resizes when the data changes. They need Excel 2021, Excel 2024, Microsoft 365 or Excel for the web. Refer to a whole spill with a # after its first cell, such as E2#.

More on dynamic arrays

  • Make a Top 5 List With SORT and FILTER
  • TRIMRANGE Function in Excel: Drop Empty Rows From a Range
  • The UNIQUE Function in Excel
  • Make a Sorted List of Unique Values in Excel
  • Auto Number Rows in Excel (SEQUENCE and ROW)
  • Count Unique Values With Criteria in Excel
All dynamic arrays articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free