COLUMNS function is a built-in function in Microsoft Excel. It falls under the category of Lookup Functions in Excel. COLUMNS Function returns the total number of columns in the given array or collection of references. The purpose of the COLUMNS formula in Excel is to know the number of columns in an array of references.

**Syntax**:=COLUMNS (array)

The COLUMNS function syntax has the following arguments:

**Array:**Required. An array or array formula, or a reference to a range of cells for which you want the number of columns.

**Example**: Let’s look at some Excel COLUMNS function examples and explore how to use the COLUMNS function as a worksheet function in Microsoft Excel:

**Syntax**: =COLUMNS(B2)

**Result**:

Based on the Excel spreadsheet above, the following COLUMNS examples would return:

**Syntax**: =COLUMNS(B4)**Result**: 1

**Syntax**: =COLUMNS(B5:B7)**Result**: 1

**Syntax**: =COLUMNS(C6:D8)**Result**: 2

**Syntax**: =COLUMNS(A8:F8)**Result**: 6

**Syntax**: =COLUMNS(G6:J6)**Result**: 4

**Syntax**: =COLUMNS(D8:F8)**Result**: 3

**Syntax**: =COLUMNS({5,6,7,8;9,10,11,12})**Result**: 4

**Note**:

- Array can be a range or a reference to a single contiguous group of cells.
- Array can be an array constant or an array created by another formula.