How to count table columns in Excel
This tutorial shows how to count columns in an Excel table. To achieve this, you can use the COLUMNS function. See example below:
Formula
COLUMNS(table)
Explanation
In the example shown, the formula in I4 is:
=COLUMNS(Table1)
How this formula works
This formula uses structured referencing, a syntax that allows table parts to be referred to by name. When a table is referred to by the name only, Excel returns a reference to the data region of the table only. In this case, the entire table range is B4:F104 so Table1 returns the range B5:F105 to the COLUMNS function.
=COLUMNS(Table1) =COLUMNS(B5:F105)
COLUMNS then returns a final result of 5, since there are 5 columns in the table.