Quick Navigation
COLUMNS Function
Summary
The Excel COLUMNS function returns the number of columns in a specified array, range reference, or array formula. It's a simple yet powerful tool for dynamically determining array dimensions in worksheet formulas.
Syntax
COLUMNS(array)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| array | Array/Range |
Yes | The array, array formula, or cell range whose number of columns you want to count |
Using the COLUMNS Function
COLUMNS is particularly useful when building dynamic formulas that need to adapt to varying data ranges. Use it to create flexible table formulas, dynamic named ranges, or array-based calculations that automatically adjust to the data structure.
Common COLUMNS Examples
Count Columns in a Range
=COLUMNS(C1:E4)
Returns 3, counting columns C, D, and E in the range C1:E4.
Array Constant Example
=COLUMNS({1,2,3;4,5,6})
Returns 3, counting the three columns in the 2x3 array constant.
Dynamic Table Sizing
=COLUMNS(Table1)
Returns the number of columns in a structured Excel table named Table1.
Frequently Asked Questions
Common Errors and Solutions
#VALUE! error
Cause: The array argument is not a valid array or range
Solution: Ensure the argument is a proper range reference or array constant
Wrong count returned
Cause: Misunderstanding array structure or including extra ranges
Solution: Verify the exact range or array dimensions being referenced
Notes
- Always returns a single integer value
- Works with both single-row and multi-row arrays
- Compatible across all modern Excel versions
- Use with INDIRECT for fully dynamic range counting
- Combine with ROWS for complete array dimensions
Compatibility
Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365
Not available in:
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+