How to Use the TOCOL Function to Convert Arrays to Columns in Excel

The Problem with Multi-Column Data

In Microsoft Excel, data is often structured visually for humans to read, rather than mathematically for formulas to process. For example, you might have a 5×5 grid containing the names of 25 employees who attended a training seminar.

While that massive block of names looks great printed on a piece of paper, it is a nightmare if you want to feed that data into a pivot table, or if you want to use the UNIQUE function to find out if anyone accidentally signed their name twice. Most advanced Excel data-processing functions require a single, clean, vertical column of data to work properly.

Traditionally, converting a 5×5 grid into a single 25-row vertical list required mind-numbing manual labor: cutting and pasting Column B under Column A, cutting Column C and pasting it under Column B, and so on. To completely eliminate this tedious work, Excel introduced the TOCOL (To Column) function.

Understanding the Syntax

The TOCOL function takes any massive, multi-dimensional array (like a 5×5 grid) and instantly flattens the entire thing into a single, vertical, 1D array.

=TOCOL(array, [ignore], [scan_by_column])

  • array: The multi-column grid of data you want to flatten.
  • ignore: (Optional) Tells the formula whether it should ignore blank cells or cells containing errors.
  • scan_by_column: (Optional) Dictates exactly how the formula reads the grid (left-to-right vs. top-to-bottom).

Example 1: Flattening a Simple Grid

Assume your 25 employee names are sitting in a 5×5 grid spanning cells A1:E5.

Click on a blank cell far away from the data (e.g., G1) and simply type:

=TOCOL(A1:E5)

How this works:

  1. Excel looks at the 5×5 grid.
  2. By default, it reads the data like a book (left-to-right). It grabs the names from A1, B1, C1, D1, and E1.
  3. It stacks them vertically in Column G.
  4. Once it hits the edge of row 1, it drops down to row 2, grabs A2, B2, C2, D2, and E2, and stacks them directly underneath the first five.
  5. The result is a perfect, dynamic, 25-row vertical list.

Example 2: Reading Top-to-Bottom

If the data in your grid is organized logically in columns (e.g., Column A is the Marketing Team, Column B is the Finance Team), reading the grid left-to-right will scramble the teams together in the final list.

You need the formula to scan top-to-bottom (grabbing the entire Marketing team first, then the entire Finance team second).

You can force this behavior by changing the final scan_by_column argument to TRUE.

=TOCOL(A1:E5, , TRUE)

Note: Notice the double commas. We are skipping the optional ‘ignore’ argument entirely.

The formula now grabs A1 through A5, stacks them vertically, then jumps to B1 through B5 and stacks them underneath, preserving the team groupings perfectly.

Example 3: Ignoring Blanks and Errors

If your 5×5 grid is not perfectly full—perhaps 3 people did not show up to the seminar, leaving 3 completely blank cells in the middle of the grid—the standard TOCOL formula will convert those empty squares into zeroes (0) in your final vertical list, ruining your data integrity.

Furthermore, if one cell accidentally contains a massive #DIV/0! error, that error will be injected straight into your final list.

You can use the ignore argument to scrub the data perfectly clean as it flattens.

  • 0 (Default): Keep everything.
  • 1: Ignore completely blank cells.
  • 2: Ignore cells containing # errors.
  • 3: Ignore both blanks AND errors.

=TOCOL(A1:E5, 3)

This powerful formula grabs the grid, flattens it vertically, instantly deletes the 3 missing attendees so there are no empty gaps, strips out any accidental calculation errors, and outputs a flawless, pristine list of 21 verified names ready for final processing.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.