Indirectly Referencing a Cell on a Different Worksheet

by Allen Wyatt
(last updated November 2, 2013)

4

Michael has a worksheet that has month names (January, February, etc.) in column A. In column B he wants to pull a value from cell B11 of whatever worksheet is specified in column A. Thus, if column A contains the month "March," in the cell just to the right of March (in column B) he wants to pull the value in March!B11. Michael believes that the INDIRECT function should help with this, but he can't get it to work.

The good news is that Michael is correct—you can use the INDIRECT function to do this. The basic usage of the function looks like this:

=INDIRECT(A1&"!B11")

You can build a more "robust" version of the formula by enclosing it within a function that checks for errors. If there is an error, then the phrase "No Data" displays in the cell:

=IFERROR(INDIRECT(A1&"!B11"),"No Data")

These approaches use whatever is in cell A1 directly, which works provided that the value in A1 is text and a single word. If there might be a second word in A1 (such as "July Production"), then you need to modify the formula a bit so that it includes apostrophes around whatever is in cell A11:

=IFERROR(INDIRECT("'"&A1&"'!B11"),"No Data")

Because the apostrophes are used to enclose a worksheet name, you cannot have any text in cell A1 that includes apostrophes. So, "July Production" in cell A1 will work fine (provided you have a worksheet named "July Production"), but "July's Production" will not work because of the apostrophe.

Further, if whatever is in cell A1 may have either leading or trailing spaces on it, then you'll need to get rid of those spaces. The easiest way to compensate is to use the TRIM function:

=IFERROR(INDIRECT("'"&TRIM(A1)&"'!B11"),"No Data")

All of the variations presented so far work just fine if the value in A1 is an actual string. They won't work if the value in A1 is an actual date, formatted to look like a month name. Dates are stored internally as numbers, and using one of the formulas discussed so far will try to add the date serial number to the cell reference, which generates an error. Instead, you need to use the TEXT function to convert the date in A1 to a month name:

=IFERROR(INDIRECT(TEXT(A1,"mmmm")&"!B11"),"No Data")

If you are expecting other people to enter month names into cell A1, then you would be well advised to make that entry as fool-proof as possible. The best way to do that is to use data validation to limit what can be entered into cell A1. (How you use data validation has been covered in other issues of ExcelTips.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12701) applies to Microsoft Excel 2007, 2010, and 2013.

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

Inserting Rows

Need to insert rows in your worksheet? Excel provides a few techniques you can use to do this. Here are some ideas you can ...

Discover More

Controlling the Printer in a Macro

Need to access the advanced capabilities of a printer from within an Excel macro? You may be out of luck, unless you apply ...

Discover More

Changing App Notifications

Windows apps can communicate with you, keeping you up to date with whatever task they are designed to perform. If you get too ...

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)

Converting from Relative to Absolute

Addresses used in a formula can be either relative or absolute. If you need to switch between the two types of addressing, ...

Discover More

Entering Formulas in Excel

The primary way you signify that you are entering a formula is to start a cell entry with an equal sign. The equal sign is ...

Discover More

Rounding To the Nearest Even Integer

Do you need your numbers to be rounded to an even integer value? How you accomplish the task depends on the nature of the ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. 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 7 - 0?

2013-11-08 01:29:15

Shreepad S M Gandhi

It can be said based on my experience of using the INDIRECT function that if you have your data in a horizontal matrix (i.e in various columns under their headers), but need to extract them in a vertical matrix (i.e headings placed in rows one below the other) then INDIRECT is an excellent functionality provided by Excel. Please mail me on shreepadg@gmail.com, if anyone wishes to see a demo workbook/tutorial.


2013-11-04 13:32:28

Bryan

This is a good introduction on one way to use the INDIRECT function. However, it should be mentioned that most (if not all) uses of INDIRECT can and should be avoided. There are a few reasons for this.

(1) INDIRECT is a volatile function. This means that Excel will recalculate any cell with an INDIRECT every time ANY cell on the sheet is updated. Extensive use of INDIRECTs can slow down your calculation time dramatically.

(2) Much of the time if you need to use an INDIRECT, you have poorly structured data. The imaginary workbook used in this tip is a prime example: you should never separate monthly data by worksheet. What happens at the end of the year? How do you do an aggregate across months? How do you compare one month to the next? What if you figure out you had been entering data into the wrong month? If you use a structured data format with one table containing a "date" column, you will have no problems manipulating the data down the line. Once your data is structured, you will almost always eliminate the need to use an INDIRECT formula, and you can use something like INDEX/MATCH , VLOOKUP or SUMPRODUCT – all of which are non-volatile functions.


2013-11-04 09:31:16

Adam

This will work, but only if the workbook is open.


2013-11-02 11:21:45

Linda W

Will this work referencing another workbook?


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.