totn Excel Functions

MS Excel: How to use the COLUMNS Function (WS)

This Excel tutorial explains how to use the Excel COLUMNS function with syntax and examples.

Description

The Microsoft Excel COLUMNS function returns the number of columns in a cell reference.

The COLUMNS function is a built-in function in Excel that is categorized as a Lookup/Reference Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the COLUMNS function can be entered as part of a formula in a cell of a worksheet.

Syntax

The syntax for the COLUMNS function in Microsoft Excel is:

COLUMNS( reference )

Parameters or Arguments

reference
A reference to a range of cells or an array.

Returns

The COLUMNS function returns a numeric value.

Applies To

  • Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • Worksheet function (WS)

Example (as Worksheet Function)

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

=COLUMNS(B4)
Result: 1

=COLUMNS(A4:B6)
Result: 2

=COLUMNS({1,2;3,4})
Result: 2

=COLUMNS({1,2,3,4;5,6,7,8})
Result: 4

You can also defined a named range called suppliers that refers to Sheet1!$A$1:$C$8.

Microsoft Excel

Then using the COLUMNS function, you could refer to this named range as follows:

=COLUMNS(suppliers)
Result: 3