The TOCOL function in Google Sheets is a versatile tool that allows users to transform a specified range or array into a single column. This can simplify data management and enhance data analysis by enabling a more streamlined layout for information retrieval.
Syntax
TOCOL(array, [ignore_empty], [separator])
- array: The range of cells or array you’d like to convert into a single column.
- ignore_empty: An optional boolean value indicating whether to skip empty cells (TRUE) or include them (FALSE). The default is FALSE.
- separator: An optional parameter that specifies a character to be used to separate each item in the result. The default is a comma.
Example #1
TOCOL(A1:B3)
This function transforms the range A1:B3 into a single-column layout. For instance, if A1:A3 contains 1, 2, 3 and B1:B3 contains 4, 5, 6, the result would be:
1
2
3
4
5
6
Example #2
TOCOL(A1:A5, TRUE)
In this example, the function converts the range A1:A5 into a single column while disregarding any empty cells. If A1:A5 contains values 1, (blank), 3, (blank), 5, the result would be:
1
3
5
Example #3
TOCOL(A1:B3, FALSE, ", ")
This function will transform the range A1:B3 into a single column, including empty cells, with values separated by a comma. Given data in A1:A3 and B1:B3 as before, the outcome would be:
1,
2,
3,
4,
5,
6
Error handling
- VALUE!: This error occurs if the data type used in the function is incorrect. Ensure that the input is a valid array or range of cells.
- REF!: This appears when the specified range does not exist or is invalid. Double-check the range to ensure it is correct.
- N/A: Indicates that the function cannot find the requested data. Make sure that the parameters point to existing cells.