The TOCOL function transforms an array or range into a single column. By default, TOCOL will scan values by row, left to right. However, TOCOL can also be configured to scan the array by column, top to bottom. TOCOL also provides options for skipping empty cells and errors.
The TOCOL function takes three arguments: array, ignore, and scan_by_column. Array is the only required argument and represents the array or range to be transformed. The ignore argument controls what values TOCOL will optionally ignore. The options for ignore are as follows:
Keep all values
Ignore blanks and errors
The scan_by_column argument is a boolean value that controls how TOCOL reads values from the source array. By default, scan_by_column is FALSE and TOCOL will read values "by row" from left to right. At the end of each row, TOCOL will drop down and read values from the next row in the same order. To read values instead by column, set scan_by_column to TRUE or 1. In this mode, TOCOL will read values from top to bottom in the first column in the array, then move one column to the right, and read the next column in the same order.
Use the TOCOL function to transform an array into a single column and the TOROW function to transform an array into a single row. The TRANSPOSE function will transpose an array from horizontal to vertical and vice versa, but it won't restructure the array.
By default, the TOCOL function transforms a two-dimensional array into a single column, working through the array one row at a time. In the example below, the formula in F4 is:
The ignore argument in TOCOLS can be set to ignore blanks and/or errors like this:
=TOCOL(array)// default=TOCOL(array,1)// ignore blanks=TOCOL(array,2)// ignore errors=TOCOL(array,3)// ignore blanks and errors
The screen below shows how these options work with the range B4:D7, which contains both blanks and errors.
Scan by column
By default, TOCOL will read values "by row" from left to right. To read values instead by column, set scan_by_column to TRUE or 1. The worksheet below shows the default "by row" behavior in F4. In cell H4, scan_by_column is set to TRUE:
The Excel WRAPROWS function converts a one-dimensional array into a two-dimensional array by wrapping values into separate rows. The length of each row is given as the wrap_count argument: when the count is reached, WRAPROWS starts a new...
The Excel WRAPCOLS function converts a one-dimensional array into a two-dimensional array by wrapping values into separate columns. The length of each column is given as the wrap_count argument: when the count is reached, WRAPCOLS starts...