Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Using the COLUMN Function.

Using the COLUMN Function

Written by Allen Wyatt (last updated November 26, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


2

Excel includes a nifty little worksheet function that lets you determine the column number of a particular cell reference. Normally columns are designated as A, B, C, and so on, but the COLUMN function returns a numeric value that represents the column. Thus, column A is 1, B is 2, and so on.

The simplest way to use the function is in the following manner:

=COLUMN()

When used in this manner, COLUMN returns the column number of the cell in which the COLUMN function is used. Thus, if cell C5 contained =COLUMN(), then the function would return a value of 3.

You can also include a range reference as a parameter to the COLUMN function, in this manner:

=COLUMN(B4)

This usage would return 2, since column B is the second column in the worksheet. You could also, if desired, specify a range:

=COLUMN(B3:G3)

If you enter this formula in a cell, it still returns 2, since column B is the leftmost cell in the specified range. However, if you select a range of horizontal cells (say, the range of D18:I18) and enter this as an array formula, then D18:I18 will contain 2, 3, 4, 5, 6, and 7. In other words, COLUMN returns a horizontal array that reflects the column numbers of each cell in the initial range (B3:G3).

Another way to see how this works is the following formula:

=INDEX(COLUMN(B3:G3),1,3)

This formula returns 4 because you asked for the third element in the array returned by the COLUMN function. That element is the column number for column D, which is the fourth column.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10103) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Using the COLUMN Function.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Specifying a Paper Tray in a Macro

You may want to use a macro to process and then print your document. Part of that printing may involve specifying which ...

Discover More

Easily Dividing Values by 1000

Sometimes the data in a worksheet isn't in the exact format desired. If you want to divide your values by 1,000, there ...

Discover More

Changing the MAC Address for a Network Adapter

MAC addresses are used to uniquely identify devices on your network, such as a network adapter. Here's how you can modify ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Disabling #SPILL! Errors

In the newest version of Excel, a change in how formulas are calculated can cause havoc for some "older" formulas. Here ...

Discover More

Determining Columns in a Range

If you need to know the number of columns in a particular range, you can use the COLUMNS worksheet function. This tip ...

Discover More

Specifying Proper Case

If you need to change the case of letters in a cell, one of the functions you can use is the PROPER function. This tip ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 7?

2022-11-29 12:32:49

J. Woolley

The COLUMN function returns an array. In Excel 365 and 2021+ the formula =COLUMN(B3:G3) returns a horizontal dynamic array that spills to 6 cells. The formula =@COLUMN(B3:G3) returns only the first element of that array. In earlier versions of Excel, either formula returns only the first element. In any version of Excel, the first formula can be entered as a legacy CSE array formula by first selecting several (optimally 6) adjacent cells in the same row, then entering =COLUMN(B3:G3) followed by Ctrl+Shift+Enter (CSE). The ROW function is vertically analogous.
In older versions of Excel that do not support dynamic arrays, you can use My Excel Toolbox's SpillArray function to simulate them; see UseSpillArray.pdf at
https://drive.google.com/open?id=1HTw_rYNZR2I6dE9C__qFhbd8YtC7rv17
(The Google Drive PDF viewer does not support internal hyperlinks, but you can download the file to access them.)


2022-11-28 13:17:02

Debbie

It looks like there is a typo in this tip. Or I am missing an important detail. Perhaps it's the word ARRAY.

=COLUMN(B3:G3)
If you enter this formula in a cell, it still returns 2, since column B is the leftmost cell in the specified range.

contrast with
However, if you select a range of horizontal cells (say, the range of D18:I18) and enter this as an array formula, then D18:I18 will contain 2, 3, 4, 5, 6, and 7. In other words, COLUMN returns a horizontal array that reflects the column numbers of each cell in the initial range (B3:G3).


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.