Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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: Relative References within Named Ranges.

Relative References within Named Ranges

Written by Allen Wyatt (last updated August 24, 2020)
This tip applies to Excel 2007, 2010, and 2013


7

Chris has set up a worksheet where he uses named ranges (rows) in his formulas. He has named the entire sales row as "Sales," and then uses the Sales name in various formulas. For instance, in any given column he can say =Sales, and the value of the Sales row, for that column, is returned by the formula. Chris was wondering how to use the same formula technique to refer to cells in different columns.

There are a couple of different ways this can be done. First of all, you can use the INDEX function to refer to the cells. The rigorous way to refer to the value of Sales in the same column is as follows:

=INDEX(Sales,1,COLUMN())

This works if the Sales named range really does refer to the entire row in the worksheet. If it does not (for instance, Sales may refer to cells C10:K10), then the following formula refers to the value of Sales in the same column in which the formula occurs:

=INDEX(Sales,1,COLUMN()-COLUMN(Sales)+1)

If you want to refer to a different column, then simply adjust the value that is added to the column designation in the INDEX function. For example, if you wanted to determine the difference between the sales for the current column and the sales in the previous column, then you would use the following:

=INDEX(Sales,1,COLUMN()-COLUMN(Sales)+1) - INDEX(Sales,1,COLUMN()-COLUMN(Sales))

The "shorthand" version for this formula would be as follows:

=Sales - INDEX(Sales,1,COLUMN()-COLUMN(Sales))

There are other functions you can use besides INDEX (such as OFFSET), but the technique is still the same—you must find a way to refer to an offset from the present column.

There is an easier way to get at the desired data, however. Let's say that your Sales range also has a heading row above it, similar to what is shown in the following: (See Figure 1.)

Figure 1. Example data for a worksheet.

The heading row lists the years for the range, and the values under the headings are those that actually make up the Sales range. To make sure this technique will work, follow these steps:

  1. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 and Excel 2013 display the File tab of the ribbon and then click Options.)
  2. Click the Formulas link at the left side of the dialog box. (See Figure 2.)
  3. Figure 2. The Formulas options of the Excel Options dialog box.

  4. Ensure that the Use Table Names in Formulas check box is selected.
  5. Click OK.

With this configuration change done, you can use the following as your formula:

=Sales '2013' – Sales '2008'

What you are actually doing is instructing Excel to work with unions of cells. In this instance, Sales '2013' returns the cell at the intersection of the Sales range and the '2013' column. A similar union is returned for the portion of the formula to the right of the minus sign. The result is the subtraction of the two values you wanted.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9177) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Relative References within Named Ranges.

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

Understanding Page Sizes

When you create a document, you need to be concerned about the final size of the page you will be creating. Word supports ...

Discover More

Finding Out the Folder for an Open Document

If you work with a lot of documents at the same time, it can be difficult to remember the folder in which any given ...

Discover More

Printing Post Office Permits on Envelopes

When preparing to snail-mail information, you may want to print your envelopes with permit information in the upper-right ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Selective Summing

If you want to add up the contents of a range of cells based on what is contained in a different range of cells, you need ...

Discover More

Summing When the First Character Matches a Value

Summing data is a common need in Excel. Summing lots of data based on a condition that needs to be met can be a bit more ...

Discover More

Determining a Zodiac Sign from a Birthdate

If you want to find out the Zodiac sign for a birthdate, there are a number of ways you can do it. This tip provides ...

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?

2020-08-24 13:49:34

Neil

I also am unable to get the last method to work, though I did discover that if I put =Sales in a cell below the Sales range, Excel is smart enough to return the value from Sales that corresponds to the column my cell is in. e.g. if Sales is A2-E2 and I put in D4 the formula =Sales, then it returns the value that is in D2.


2020-08-24 12:56:26

JMJ

IMHO, this "trick" doesn't work any more since Excel 2007. I tried to discover what replaced this syntax, but to no avail.
MS could surely explain that...
I think I just found what happened : This disappearance coincides with the appearance of "tables"!
And if you transform your named range into a table, then you can use the following syntax =Sales[2010]


2020-08-24 12:48:16

JMJ

IMHO, this "trick" doesn't work any more since Excel 2007. I tried to discover what replaced this syntax, but to no avail.
MS could surely explain that...


2016-12-20 07:07:09

Florian Ameeuw

Thanks a lot for all your tips, Allen!
Could you please explain the last bit ("the easier way") a little closer? Like Dave and Chris I have difficulties to reproduce it.


2016-08-22 17:02:26

Dave Frye

I'm trying to get the "Easier Way" to work but having difficulty with the columns.

I want to use a years as my column name but when I put in =Sales '2013' – Sales '2008' I get an error message from Excel. The only way I can make it work is to name each column range "_Year" as in _2018.


2015-01-02 08:44:57

Chris Marshall

Hi Alan,

I have tried the 'union of cells' tip above but get 'The formula you typed contains an error' message when entering the formula. The Use Table Names in Formulas check box has been selected. Any ideas?

Thanks


2014-11-16 21:50:29

Matt Townsend

Hi Alan, thanks for your help, I am a regular enquirer of your site.
In your terminology describing "unions of cells" seems to be invoking set theory. My understanding of the related venn diagrams would indicate that in each case you are talking about an intersection, not a union. Proper use of "union" in a set context would have you referring to the cell at the intersection plus the entire column and entire row outwards from that intersection, not your intent. Cheers


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.