CHOOSECOLS

CHOOSECOLS(array, col_num1 [,col_num2] [..])

Returns the array with just a specific number of columns.

arrayThe array(s) to append.
col_num1The column number to be returned.
col_num2(Optional) The column number to be returned.

REMARKS
* This function was added in Microsoft 365.
* If "col_num" > 0 then columns are counted from the left.
* If "col_num" < 0 then columns are counted from the right.
* If "col_num" > the number of rows in the array, then #VALUE! is returned.
* If "col_num" = 0, then #VALUE! is returned.
* You can use the CHOOSEROWS function to return the array with just a specific number of rows.
* You can use the DROP function to return the array without certain rows or columns.
* You can use the EXPAND function to return the array expanded or padded to specific dimensions.
* You can use the TAKE function to return the intersection of specific rows and columns in an array.
* This function was released in March 2022.
* For the Microsoft documentation refer to support.microsoft.com

 ABCDE
1=CHOOSECOLS(C1:E3,1) = {1 ; 4 ; 7} 123
2=CHOOSECOLS(C1:E3,-1) = {3 ; 6 ; 9} 456
3=CHOOSECOLS(C1:E3,2) = {2 ; 5 ; 8} 789
4=CHOOSECOLS(C1:E3,-2) = {2 ; 5 ; 8}    
5=CHOOSECOLS(C1:E3,3) = {3 ; 6 ; 9}    
6=CHOOSECOLS(C1:E3,1,3) = {1,3 ; 4,6 ; 7,9}    
7=CHOOSECOLS(C1:E3,4) = #VALUE!    
8=CHOOSECOLS(C1:E3,1,0) = #VALUE!    

1 - What is the first column from the cell range "C1:E3".
2 - What is the last column from the cell range "C1:E3". A negative number is used to count from the right.
3 - What is the second column from the cell range "C1:E3".
4 - What is the second to last column from the cell range "C1:E3". A negative number is used to count from the right.
5 - What is the third column from the cell range "C1:E3".
6 - What are the first and third columns from the cell range "C1:E3".
7 - What is the fourth column from the cell range "C1:E3". There are not four columns.
8 - What happens when one of the column numbers is zero.

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top