The WRAPCOLS function in Google Sheets is a powerful tool designed to convert a linear range of cells into a two-dimensional array. This function allows users to define how many elements appear in each column, thus facilitating better data organization and readability.
Syntax
WRAPCOLS(array, column_count)
- array: The range of cells or array that you want to wrap.
- column_count: The number of elements that should be placed in each column.
Example #1
WRAPCOLS(A1:A10, 3)
This function organizes elements from the range A1 to A10 into columns, with each column containing 3 items. For example, if A1 to A10 contains the numbers 1 to 10, the output will look like this:
1 4 7
2 5 8
3 6 9
10
Example #2
WRAPCOLS(B1:B12, 4)
In this case, the contents of the range B1 to B12 will be wrapped into columns of 4 elements each. If B1 to B12 contains the letters A through L, the output would appear as:
A E I
B F J
C G K
D H L
Example #3
WRAPCOLS(C1:C5, 2)
This example will wrap the data from the range C1 to C5 into two columns. If C1 to C5 holds the values 10, 20, 30, 40, and 50, the resulting output will be:
10 30
20 40
50
Error handling
- VALUE! – This error occurs if the array is invalid or incorrectly specified. Ensure that the range is correctly typed and exists within the sheet.
- REF! – This error indicates a reference problem, often due to a deleted range. Verify that the referenced range is still available in the workbook.