Category: FUNCTION | Updated: 2026-11-22

How to Use the TOCOL Function in Google Sheets | Combine Multiple Rows and Columns into a Single Column

What Is the TOCOL Function?

The TOCOL function converts a cell range or array spanning multiple rows and columns into a single vertical column (a 1D array). It acts as an enhanced successor to the legacy FLATTEN function, making it easy to automatically skip blanks or error values and switch the reading direction (row-by-row or column-by-column) using only its arguments.

Syntax

=TOCOL(array, [ignore], [scan_by_column])
  • array: The cell range or array you want to convert into a single column.
  • ignore: [Optional] Specifies which values to exclude using 0–3 (default is 0).
    • 0: Keep all values
    • 1: Ignore blank cells
    • 2: Ignore error values
    • 3: Ignore both blank cells and error values
  • scan_by_column: [Optional] Specifies the reading direction (default is FALSE).
    • FALSE: Scan by row (left to right)
    • TRUE: Scan by column (top to bottom)

Example

Here is an example of combining the data in A1:B3 into a single vertical column starting at cell D1, ignoring blanks (1) and scanning by column (TRUE).

Row Column A Column B Formula in Column D Output in Column D
1 A1 B1 =TOCOL(A1:B3, 1, TRUE) A1
2 (Blank) B2 (Auto-spilled) A3
3 A3 B3 (Auto-spilled) B1
4 (Auto-spilled) B2
5 (Auto-spilled) B3

Common Errors and Notes

  • #REF! Error: Because results spill vertically, a #REF! error occurs if there are already other values below the output cell in that column. Make sure the output column below is clear.
  • Combining Multiple Non-Adjacent Ranges: While TOCOL only accepts a single array as its first argument, you can combine it with VSTACK or HSTACK—such as =TOCOL(VSTACK(A1:B5, D1:E5), 1)—to merge separate ranges into one column without blanks.

Frequently Asked Questions

Q. What is the difference between the TOCOL and FLATTEN functions?

A. Both combine multiple ranges into a single column, but TOCOL lets you ignore blanks or errors and scan vertically (by column) using only its arguments, and it is also compatible with Excel.

Q. How do I write a TOCOL formula to remove blank cells and stack values into one column?

A. Specify 1 as the second argument, like =TOCOL(A1:C10, 1). This automatically excludes blank cells and outputs a compact list.