Excel has several built-in features that help analyze data. For example, you can count the number of columns in your data model by selecting those columns, and you will see the count on the bottom right corner. However, this is a repetitive task, one that can be handled with a simple formula. In this article we're going to show you how to get the number of columns using the COLUMNS function.


=COLUMNS(cell or range reference you want to get its column count)


  1. Begin by typing in =COLUMNS(
  2. Select or type in the range that contains the reference (i.e. B2:G7)
  3. Type in ) and press the Enter key to complete the formula


The COLUMNS function returns the column count of the target reference or array. The function only needs one input parameter. In our example, we used,



The COLUMNS function is helpful to provide information about dynamic ranges whose dimensions can vary when updated. Also, incremental number series can be calculated by using an expanding range in the COLUMNS function. Use the $A$1:A1 range reference, and copy it down to generate a number sequence. For example,


Also see our guide on how to remove blank cells and get row count guides to further automate your data tables.