TOCOL and TOROW in Excel: Turn Any Range Into One Clean Column or Row

Isometric spreadsheet illustration showing TOCOL in Excel unfolding a 2D matrix into one vertical column

Turning a multi-column roster, schedule grid, or matrix into a single clean list in Excel used to mean tedious manual copy-pasting or writing complex combinations of INDEX, INT, and MOD. With TOCOL in Excel and its horizontal counterpart TOROW, you can reshape any two-dimensional range or dynamic array into a single column or single row with one formula—while automatically filtering out blank cells and errors along the way.

Whether you need to feed scattered shift data into a clean data-validation dropdown list, prepare data for charting, or unpivot a monthly budget table without launching Power Query, mastering these two array-reshaping functions is an essential productivity upgrade for modern spreadsheet users.

Availability & Compatibility: Per the official Microsoft Support TOCOL documentation and TOROW documentation, both functions are supported in Excel for Microsoft 365 (Windows, Mac, and Web), Excel 2024, Excel 2024 for Mac, and Google Sheets. Older perpetual versions such as Excel 2021, Excel 2019, and Excel 2016 do not support these functions and will return a #NAME? error.

How TOCOL in Excel Works (Syntax and Parameters)

The TOCOL in Excel function scans an input array or range and spills every value vertically into a single column. The syntax takes one required argument and two optional controls:

=TOCOL(array, [ignore], [scan_by_column])
  • array (Required): The two-dimensional range, table, or dynamic array that you want to transform into a single column.
  • [ignore] (Optional): A numeric code determining which values Excel skips during transformation. Passing 0 keeps all values (default), 1 ignores blank cells, 2 ignores error values (such as #N/A or #DIV/0!), and 3 ignores both blank cells and errors.
  • [scan_by_column] (Optional): A boolean value controlling the reading order. FALSE (or omitted) reads row-by-row from left to right. TRUE reads column-by-column from top to bottom.

How TOROW Works (Flatten to a Single Row)

The TOROW function uses the exact same three arguments as TOCOL, but spills the flattened elements horizontally across a single row instead of down a column:

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

TOROW is ideal when converting multi-row category lists into horizontal summary headers, populating horizontal lookup ranges, or reshaping text arrays split across rows using TEXTSPLIT.

Hands-On Walkthrough: Practicing With the Companion Sheet

To follow along with these examples, open the companion practice workbook provided above. In the Practice tab, you will find a 3×4 team shift roster in cells A6:D8 with team member names assigned across Shift A, Shift B, Shift C, and Shift D. Notice that cells C8 and D8 are intentionally left blank.

Task 1: Basic Flattening (Keeping All Cells)

Enter the basic formula in cell F6 without optional arguments:

=TOCOL(A6:D8)

Excel spills all 12 values down column F. Notice that the two blank cells in row 8 evaluate to 0. By default, Excel treats empty cells in mathematical arrays as zeros. While useful for preserving positional alignments, this is rarely what you want for roster lists.

Task 2: Dropping Empty Cells with ignore = 1

To eliminate the trailing zeros and extract only populated names, pass 1 as the second argument:

=TOCOL(A6:D8, 1)

Excel cleanly skips C8 and D8, outputting an exact 10-person list. This clean vertical spill is ready to serve as the source range for data validation dropdowns or summary counts.

Task 3: Scanning Column-by-Column

By default, TOCOL scans across row 6, then row 7, then row 8. If you want to group your team by shift—listing all Shift A members first, then Shift B, Shift C, and Shift D—set the third argument scan_by_column to TRUE:

=TOCOL(A6:D8, 1, TRUE)

Now the spilled column preserves departmental and shift continuity instead of mixing team members by row.

Task 4: Creating a Horizontal Header Strip with TOROW

If your reporting dashboard requires these names arranged across a single row as column headers, switch to TOROW with blanks ignored:

=TOROW(A6:D8, 1)

The 10 team members spill horizontally across columns F through O in a single instant.

TOCOL and TOROW Ignore Codes Reference Table

Use this reference table to quickly select the right ignore argument for your dataset:

Ignore Code Behavior Example Formula Best Use Case
0 (or omitted) Keep all values (blanks become 0) =TOCOL(A6:D8) Preserving exact matrix coordinates and row counts
1 Ignore blank cells =TOCOL(A6:D8, 1) Clean roster lists, dropdown menus, and name directories
2 Ignore error values (#N/A, #VALUE!, etc.) =TOCOL(A6:D8, 2) Tables containing lookup errors or formula placeholders
3 Ignore both blanks and errors =TOCOL(A6:D8, 3) Consolidating messy raw exports from external databases

Advanced Power Formulas: Combining TOCOL with Other Functions

The true power of TOCOL in Excel emerges when you nest it inside other modern dynamic array functions:

1. Deduplicating and Alphabetizing Lists

Wrap TOCOL in UNIQUE and SORT to turn an unorganized multi-column entry grid into a sorted, unique master list with no duplicates:

=SORT(UNIQUE(TOCOL(A6:D8, 1)))

2. Multi-Sheet Consolidation with VSTACK

If you manage multiple regional worksheets (e.g. North, South, East, West) with identical structures, stack them vertically with our guide on VSTACK and HSTACK in Excel and flatten the entire multi-sheet range into one column:

=UNIQUE(TOCOL(VSTACK(North:West!A2:D50), 3))

Passing 3 ensures that any empty rows or formula errors across the sheets are automatically discarded before deduplication.

3. Extracting Top Results with TAKE

Need only the first 5 entries from a flattened schedule? Pair TOCOL with TAKE and DROP in Excel:

=TAKE(TOCOL(A6:D8, 1), 5)

Troubleshooting Common Errors (#SPILL!, #VALUE!, #NUM!, #NAME?)

  • #SPILL! Error: Occurs when existing text, numbers, formulas, or merged cells block the cells where TOCOL or TOROW needs to display its results. Clear the obstructing cells in the spill path. If you encounter persistent spill errors, review our comprehensive tutorial on how to fix the #SPILL! error in Excel.
  • #VALUE! Error: Occurs if you enter an invalid ignore argument outside the 0–3 range or if an array constant contains non-integer values.
  • #NUM! Error: Returned if the resulting output exceeds Excel’s worksheet limits—1,048,576 rows for TOCOL or 16,384 columns for TOROW.
  • #NAME? Error: The workbook is being opened in an unsupported version of Excel, such as Excel 2019 or Excel 2021 perpetual licenses.

Frequently Asked Questions

What is the difference between TOCOL and TOROW in Excel?

TOCOL flattens a two-dimensional range into a single vertical column, spilling downwards. TOROW flattens the range into a single horizontal row, spilling to the right across columns. Both functions accept identical arguments for ignoring blanks and errors and controlling scan direction.

How do I prevent TOCOL from converting blank cells to zeros?

Set the optional second argument [ignore] to 1 (e.g. =TOCOL(A1:D10, 1)). This tells Excel to completely skip blank cells during the scan rather than returning 0.

Why does my TOCOL formula return a #NAME? error?

A #NAME? error means your version of Excel does not recognize the TOCOL function. TOCOL is only available in Excel for Microsoft 365, Excel 2024, Excel for the web, and Google Sheets. It is not supported in Excel 2021, Excel 2019, or older perpetual releases.

Can TOCOL read data by column instead of by row?

Yes. Set the third argument [scan_by_column] to TRUE (e.g. =TOCOL(A1:D10, 1, TRUE)). Excel will read the first column from top to bottom before moving to the second column, grouping column data together.

Can I combine TOCOL with UNIQUE and SORT?

Yes. Nesting TOCOL inside UNIQUE and SORT (such as =SORT(UNIQUE(TOCOL(A1:D10, 1)))) is the standard modern Excel technique to extract a clean, deduplicated, and alphabetized list from any 2D table.

Key Takeaways

With TOCOL in Excel and TOROW, transforming complex 2D data into streamlined dynamic lists requires zero VBA, zero Power Query steps, and zero legacy formula workarounds. Download the companion practice workbook from the card above, experiment with the ignore codes, and bring clean array reshaping into your daily Excel workflow.

Download the practice workbook

The same data as this tutorial, with empty answer cells and a Solutions sheet.

Team Xl in Excel

Team Xl in Excel

Spreadsheet Architect & Educator at Xl in Excel. Sharing advanced formulas, dynamic arrays, and clean data modeling techniques.

Learn More About Team Xl in Excel →

Leave a Reply

Your email address will not be published. Required fields are marked *

Zoom: 100% | UTF-8 | Xl in Excel