Lookup & reference function

TOCOL function

Turns a range or array into a single column, reading row by row (or column by column), with options to skip blanks and errors.

Available in Microsoft 365, Excel 2024, Excel for the web, Excel for Mac 2024+

Excel 2024 and laterWorks in Google Sheets

Syntax

TOCOL(array, [ignore], [scan_by_column])
ArgumentWhat it means
arrayRequiredThe range or array to flatten.
ignoreOptional0 keep everything (default), 1 skip blanks, 2 skip errors, 3 skip blanks and errors.
scan_by_columnOptionalFALSE (default) reads across each row first; TRUE reads down each column first.

Returns: A single-column array containing every value of array, which spills.

How TOCOL works

TOCOL takes a block of cells and lines all the values up in one column. Think of a weekly shift roster where names are spread across a grid: TOCOL lists every name in one column, ready for UNIQUE, COUNTIF or SORT.

By default it reads the first row left to right, then the second row, and so on; set scan_by_column to TRUE to read column by column instead. Blank cells become 0 unless you ask to ignore them with ignore set to 1, which you almost always want. Errors can be skipped too, which makes TOCOL a neat way to clean up a messy range.

Examples

1Flatten a roster

E1fx=TOCOL(A2:C3)
ABCDE
1MonTueWedAna
2AnaBenAnaBen
3RajChloeAna
4Raj
50
6Chloe

Read row by row. The empty Tuesday slot becomes 0 because blanks are not ignored.

2Skip blanks, read by column

E1fx=TOCOL(A2:C3, 1, TRUE)
ABCDE
1MonTueWedAna
2AnaBenAnaRaj
3RajChloeBen
4Ana
5Chloe

ignore 1 drops the blank cell; scanning by column reads Monday's names first, then Tuesday's, then Wednesday's.

3Distinct staff on the roster

E1fx=SORT(UNIQUE(TOCOL(A2:C3, 1)))
ABCDE
1MonTueWedAna
2AnaBenAnaBen
3RajChloeChloe
4Raj

TOCOL lines up the names, UNIQUE removes the repeated Ana and SORT orders them.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#SPILL!Not enough room below the formula.Clear the cells underneath.
#NUM!The result would have more rows than the sheet allows.Flatten a smaller range.

Tips

  • Use ignore 3 to clean a range of both blanks and error values.
  • TOROW does the same in a single row; WRAPROWS does the reverse, turning a list back into a grid.

Google Sheets

TOCOL also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

TOCOL in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DutchNAAR.KOLOM
GermanZUSPALTE
ItalianA.COL
RussianПОСТОЛБЦ
TurkishSÜTUNA

Recipes that use TOCOL