Indirectly Referencing a Cell on a Different Worksheet

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


1

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, Excel in Microsoft 365, and 2021.

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

Converting Numbers to Strings

VBA is great at working with both strings and numbers. At some point you may have a number you need to convert to a ...

Discover More

Selecting Text in Linked Text Boxes

Text boxes are often used as design elements in a document layout. If you have linked text boxes, you may have noticed ...

Discover More

Controlling Field Shading

If you use fields in your documents, you may want to highlight them in some way so that you can find them easier. Word ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Tracing Errors

Sometimes it can be confusing to figure out the source of an error that is displayed in your worksheet. Excel provides a ...

Discover More

Hiding Rows Based on Two Values

It's easy to use filtering to hide rows based on the value in a cell, but how do you hide rows based on the values in two ...

Discover More

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
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 two more than 7?

2024-08-24 10:14:37

J. Woolley

I believe all of the Tip's references to A1 should be changed to A11.
If A11 might contain an apostrophe like "July's Production" then use this formula:
=IFERROR(INDIRECT("'"&TRIM(SUBSTITUTE(A11,"'","''"))&"'!B11"),"No Data")


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.