Indirectly Referencing a Cell on a Different Worksheet

by Allen Wyatt
(last updated February 23, 2019)

5

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, 2013, 2016, 2019, and Excel in Office 365.

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

Spell Checking Forms

Word may be used to create protected forms that limit where the user may input data. Normally spell checking is disabled ...

Discover More

Cycling through Colors

Excel includes quite a few tools that are not normally accessible through the various toolbars. One such esoteric tool is ...

Discover More

A Handy Pruner for Your Toolshed

When working with trees, bushes, and brush, the right pruner can make quick work of the tasks you need to do. The Corona ...

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)

Calculating a Geometric Standard Deviation

One of the areas in which Excel provides worksheet functions is in the arena of statistical analysis. You may want to ...

Discover More

Stopping a Formula from Updating References

Insert or delete a column, and Excel automatically updates references within formulas that are affected by the change. If ...

Discover More

Determining Combinations to Make a Total

If you have a range of cells that contain values, you may wonder which combinations of those cells should be used to meet ...

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 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 five more than 3?

2019-02-26 11:14:15

J. Woolley

@David Robinson:

Here's one suggestion (see the Tip's text):
=IFERROR(INDIRECT("'"&A1&"'!B11"),"Please open "&A1)


2019-02-25 11:28:18

Roy

You can test for a 'not "G"' format in an IFERROR(), taking the date information if it succeeds in the "usual ways" to provide out to INDIRECT(). And you can have the error result take it as is. You can also wrap all that in another IFERROR() that handles things of an even more unusual nature.

The nested IFERROR() approach can be used lots of places. For some reason, that never seems to come up when it is talked about.

As far as those apostrophes go (for names with spaces), having them when the name is a single word causes NO problems, so just use a formula containing them to handle either of the two situations that might occur. Never bother with not putting them in.


2019-02-25 11:20:51

David Robinson

Unfortunately I can only use INDRECT to point at a cell in an *open* workbook. If I close the file I'm pointing to, the INDIRECT will no longer work (returns #REF!).

I've used various workarounds in the past, most of which use a lot of spreadsheet real estate but do at least work, and of course I can use a macro to set the formula to do the pointing (i.e. the macro sets the cell's formula to a conventional reference using the text that would've been the INDIRECT argument), but can anyone advise if it's possible just using formulas to get INDIRECT to work on a closed workbook?


2019-02-23 11:40:44

J. Woolley

Re. "Because the apostrophes are used to enclose a worksheet name, you cannot have any text in cell A1 that includes apostrophes." I believe this formula will accommodate a name that includes apostrophes:

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

In this case, two apostrophes will be substituted for each apostrophe in cell A1 to determine the INDIRECT address.

And since a worksheet's name can include leading and/or trailing space characters, it might not be a good idea to use the TRIM function.


2019-02-23 09:53:06

Fanny Ennever

INDIRECT is powerful when combined with ADDRESS, which lets you do math to select which cells to reference.


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.