The Excel COLUMNS function returns the number of columns in a selection. In this guide, we’re going to show you how to use this function and also go over some tips and error handling methods.
- All Excel versions
|array||An array, an array formula, or a reference to a range of cells.|
Using with a formula
You can use the COLUMNS function with an array or an array returning formula to make it dynamic. In our example, the OFFSET function returns an array of values in the range B12:C16, which is used as the array argument.
Generating number series
An alternative way of using the COLUMNS function is for generating number series. You can use an expanding reference as array argument. Expanding a range from $C$10:$C10 to $C$10:$C15 generates numbers from 1 to 6.