Referencing a Sheet Name in a Cell

ajones

Board Regular
Joined
Oct 26, 2002
Messages
106
I would like to be able to change/update a series of formula etc based on changing a sheet name in a cell, but could not figure out how to get a forumula to reference sheet name that was in a certain cell.

In the past I have seen references that this can be done, but never tried.

i.e.

"Sheet 1" has a series of data
"Sheet 2" has other datat same format
"Sheet 3" has various formulas.

I want to have a cell in "Sheet 3" that I can type in "Sheet 1" or "Sheet 2" or other future sheet names. Then the calucations in "Sheet 3" that may be based entirly on data from the other sheet would update based on what sheet name was entered in a cell.

Any ides how to effectively do this?

I found some interesting references on how you might do this if using seperate files that were open in Excel. But I could not get the logic for a sheet name instead of file name. The references for a file name, but consistant sheet names did this =INDIRECT("['"&D5&"']Sheet1!B3")

thanks for the help.

Alan
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try this to get your started on your formula,

=INDIRECT(B1&"a3")

Where B1 houses Sheet1! and A3 is the cell to reference
 
Upvote 0
Brian,

Thanks for the quick reply.

I adjuted your formula slightly so that it would work for other users that migh now know aboiut adding a "!" in a sheet name
=indirect(a1 & "!" & b1)
Where A1 is the sheet name and B1 is the cell you want in the sheet.

I did run into a problem with this formula.

If there is a space in the sheet name then the formula fails. I tried working around the problem with quotes etc, but could not get that to work. Do you have any ideas?


Also I was really hoping for a forumul that referended another sheet in such a way that I could copy the formula down and the Cell reference would update just like it does in a single sheet.

I would be after something like
=indirect($a$1 &"!")&c1 <-- but that does not work

That way if i copied the formula the first result would return the reulst in b1 from the sheet referenced in a1, then copying down would then givet he results in b2, b3, etc.


Not sure my last part is clear.

again thanks for your help.

Alan
 
Upvote 0
Just wanted to follow up on my own post to help out anyone else trying this.

As I said before I could not get the indirect function to work with sheets that had spaces.

Well It turns out this also won't work with sheets that have a dash "-" as in "sheet-1". However an underscore "_" does seem to work.

Anyone have any suggestions on working around these limitations?
 
Upvote 0
Try :

=INDIRECT("'"&$A$1&"'!"&B1)

This should sort out your space problem by enclosing the sheet name in single quotes
 
Upvote 0
Following up on my most from last year ... :)

As INDIRECT is a volatile function I was wondering about using INDEX for the same thing?

I saw a few references to using INDEX instead of INDIRECT, but when I tried to implement them things did not go how i hoped.

When can one use INDEX instead of INDIRECT?

Here were a few simple examples that I was not able to convert
=INDIRECT("'" & B1& "'"&"!" & "A1")
=INDIRECT("'" & B1& "'"&"!" & C1)

and here is my "live" one I am trying to optimize and make more efficient
INDIRECT("'" & $W$2 & "'!" & "A:A")

inside of

=IF(B3="-","-",MID(INDIRECT("'" & $W$2 & "'!" & "A1:A50000"),9,10))

INDIRECT("'" & $W$2 & "'!" & "A1:A50000")


thanks for the help and information

Alan
 
Upvote 0
If I'm not mistaken, if you download and install the free add-in Morefunc.xll, you can use INDIRECT.EXT, where you can set the second argument to FALSE so that it's not volatile.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top