Sheet Clinic

Turn a Google Sheets table into one column (TOCOL, FLATTEN, WRAPROWS)

TOCOL(B2:D) turns a table into one column but keeps the empty cells. A 1 as the second argument drops them. WRAPROWS goes back to a grid.

Sheet Clinic editorsPublished
F2=TOCOL(B2:D) → =TOCOL(B2:D, 1)

Before =TOCOL(B2:D)

ABCDF
1DayOpenMidCloseAll shifts
2MonDanaMarcusLuisDana
3TuePriya TomMarcus
4WedAishaKen Luis
5Thu DanaMarcusPriya
6FriLuisPriyaAisha 
7    Tom
8    Aisha
9    Ken
10     
11     
12    Dana
13    Marcus
14    Luis
15    Priya
16    Aisha

What changed

  1. second argument 1 added
  2. empty rows at F6, F10, F11 gone

After =TOCOL(B2:D, 1)

ABCDF
1DayOpenMidCloseAll shifts
2MonDanaMarcusLuisDana
3TuePriya TomMarcus
4WedAishaKen Luis
5Thu DanaMarcusPriya
6FriLuisPriyaAishaTom
7    Aisha
8    Ken
9    Dana
10    Marcus
11    Luis
12    Priya
13    Aisha
Figure 1. The same shift grid read into column F twice. Without the ignore argument, every unfilled shift leaves an empty row in the list.

Twelve names in F2:F13, one per shift, no empty rows: that is what =TOCOL(B2:D, 1) in F2 gives for the shift grid in A1:D6, where the days run down column A and Open, Mid and Close run across the top. TOCOL is the function that turns a table into a single column, and the 1 after the range tells it to leave the empty cells out. The grid has fifteen slots and three of them are unfilled, which is why the list stops at twelve.

The range starts at B2 so the day names in column A and the shift labels in row 1 stay out of the list. On a table of your own, pick the block of cells to list the same way and put it where B2:D is.

Drop the , 1 and the result changes. With =TOCOL(B2:D), the list in column F has a gap under Priya in F6 and two more in F10 and F11. Each gap lines up with a shift nobody took. Tuesday has no one on Mid, Wednesday has no one on Close, and Thursday has no one on Open. TOCOL walked the grid one row at a time and wrote one cell for every cell it passed, filled or not.

TOCOL keeps empty cells until the ignore argument is 1

Google lists the syntax on its TOCOL function page as TOCOL(array_or_range, [ignore], [scan_by_column]). The second argument picks what to leave out, and by default nothing is left out: 0 keeps all values, 1 ignores blanks, 2 ignores errors, and 3 ignores both. Changing F2 to =TOCOL(B2:D, 1) in the take-home copy gave twelve names in F2:F13 with no gaps, which is the Fixed tab.

Google Sheets, Broken tab, F2 selected. The formula bar shows =TOCOL(B2:D). Column F lists Dana, Marcus, Luis, Priya, then an empty F6, then Tom, Aisha, Ken, empty F10 and F11, then Dana, Marcus, Luis, Priya, Aisha.
Figure 2. The Broken tab. The empty cells in column F match the three unfilled shifts.

B2:D has no end row, so it reaches down to the last row of the tab and the formula also reads every empty row under Friday. On the More cases tab, =ROWS(TOCOL(B2:D)) in O2 returned 2997 while =ROWS(TOCOL(B2:D, 1)) in O3 returned 12. The tab has 1000 rows. Most of those 2997 entries are empty, and they sit below the last name, so the column looks finished even though the result is far longer than the list.

With 1 as the second argument, the open range becomes the convenient choice. A name typed into a new row for next week joins the list without anyone touching the formula, and the empty rows below are dropped along with the gaps.

The Try it yourself tab still has the gaps. Change F2 to =TOCOL(B2:D, 1) there and compare the list with the Fixed tab.

Google Sheets, Fixed tab, F2 selected. The formula bar shows =TOCOL(B2:D, 1). Column F lists twelve names in F2:F13 with no empty cells.
Figure 3. The Fixed tab. The list now ends at F13.
InputShift grid in B2:D6, three shifts empty
Formula=TOCOL(B2:D, 1)
ExpectedDana, Marcus, Luis, Priya, Tom, Aisha, Ken, Dana, Marcus, Luis, Priya, Aisha
Sheets returnedDana, Marcus, Luis, Priya, Tom, Aisha, Ken, Dana, Marcus, Luis, Priya, Aisha Matches expected
Checked2026-11-11, free personal account

Row order or column order: the scan_by_column argument of TOCOL

The fixed list reads like a calendar: Monday Open, Monday Mid, Monday Close, then Tuesday. That is TOCOL scanning by row, which the Google page gives as the default. If the list should be grouped by shift instead, so every opener comes first, set the third argument to TRUE.

=TOCOL(B2:D, 1, TRUE) in H2 of the More cases tab returned Dana, Priya, Aisha, Luis for the Open column, then Marcus, Ken, Dana, Priya for Mid, then Luis, Tom, Marcus, Aisha for Close. The 1 is still there, so the empty shifts stay out.

When the goal is a roster instead of a list of shifts, wrap the result in UNIQUE. =UNIQUE(TOCOL(B2:D, 1)) in J2 returned Dana, Marcus, Luis, Priya, Tom, Aisha and Ken. Dana, Marcus, Luis, Priya and Aisha each work two shifts in the grid, and UNIQUE keeps the first time each one appears. Sorting that roster, or clearing out cells that only look empty, is in the post on UNIQUE without blanks.

FLATTEN gives the same gaps and has no switch for them

FLATTEN also turns a range into one column, with fewer options. =FLATTEN(B2:D6) in L2 of the More cases tab produced the same row-by-row list as the Broken tab, empty cells included, and =ROWS(FLATTEN(B2:D6)) in O4 returned 15. Three of those fifteen are the unfilled shifts.

That is the documented behavior. The FLATTEN page says values are ordered by argument, then row, then column, and that empty values are not skipped. Google points to FILTER for removing them. The syntax is FLATTEN(range1, [range2, ...]) with no setting after the values, so there is no ignore argument and no way to switch it to column order. In a sheet that already uses FLATTEN and works, there is no need to rewrite it. For a new list, TOCOL with 1 does the cleanup inside the same formula.

#REF! and "Array result was not expanded" when a total sits under the list

The list needs a clear path down the column. On the More cases tab, W2 is the same unfiltered formula as the Broken tab, and someone typed Total in W12. W2 shows #REF!, and selecting it brings up this note:

Array result was not expanded because it would overwrite data in W12.

Counting down from W2, W12 is where the eleventh entry would land, and the result is longer than that. Sheets will not write over a typed value, so it shows the error in the one cell it has. Dropping blanks shortens the list to twelve entries, which still needs W2:W13, so the Total cell is in the way either way. Put totals above the formula, in a different column, or on another tab. When nothing visible sits under the formula and the note still appears, the post on Array result was not expanded shows how to check the cell it names.

More cases tab, W2 selected. The formula bar shows =TOCOL(B2:D). W2 shows #REF! and the note reads: Array result was not expanded because it would overwrite data in W12. W12 holds the word Total.
Figure 4. The note names the cell that blocks the list. Here it is the Total label in W12.

Turning one column back into a grid with WRAPROWS and WRAPCOLS

To turn a single column back into a grid, use WRAPROWS or WRAPCOLS. Google lists WRAPROWS as WRAPROWS(range, wrap_count, [pad_with]). It fills each row left to right, and wrap_count sets how many values go in a row.

In Q2, =WRAPROWS(TOCOL(B2:D, 1), 5) split the twelve names into rows of five: Dana through Tom, Aisha through Luis, then Priya and Aisha. The last row had three cells left over, and Sheets filled each of them with #N/A. Selecting S4 shows why:

There is no value for this cell. Consider using the pad_with argument to replace #N/A with the value of your choice.

More cases tab, S4 selected. The formula bar shows #N/A. The note reads: There is no value for this cell. Consider using the pad_with argument to replace #N/A with the value of your choice.
Figure 5. The leftover cells in the last row of a WRAPROWS result show #N/A until pad_with is set.

The third argument is the fix. =WRAPROWS(TOCOL(B2:D, 1), 5, "") in Q6 returned the same three rows, and S8, T8 and U8 are blank instead of #N/A. A visible placeholder works too. Any text in quotes goes into the leftover cells.

WRAPCOLS fills down instead of across. =WRAPCOLS(TOCOL(B2:D, 1), 5, "") in Q10 built three columns five tall: Dana, Marcus, Luis, Priya, Tom in the first, Aisha, Ken, Dana, Marcus, Luis in the second, and Priya and Aisha at the top of the third, with the padding below them.

Take-home copy. Four tabs: Broken, Fixed, Try it yourself, More cases. It opens as a copy in your own Drive.

Copy the sheet