How to reference a sheet by number not name in formula?

GuyGadois

Active Member
Joined
Jan 12, 2009
Messages
342
Office Version
  1. 2019
Platform
  1. Windows
I have a situation where I want to reference a worksheet by sheet number and not by sheet name because the sheet name changes based on a user input (sheet name will never be standard).

Typically I could use the following formula to get the value in cell B10 on sheet called B10:
='BobSmith'!B10

The problem is that sheet can be changed to anything by the user so I want to refer to it by its sheet number, which in this case is Sheet5.

Can this be done?

Cheers,

Guy
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Sorry..misposted.
 
Last edited:
Upvote 0
Guy

You can't use a sheets codename directly in a formula.
 
Upvote 0
To the best of my knowledge, the sheet codename & sheet index only exists in VBA & therefore cannot be accessed by an xl formula
 
Upvote 0
The good news is, that once you have the formula entered, the sheet can be renamed all you want, and the formula will automatically correct itself.

This formula
='BobSmith'!B10

Rename that BobSmith to FredFlintstone

The formula automatically changes to
='FredFlintstone'!B10
 
Upvote 0
When a sheet name is changed, Excel will automatically change the references to it elsewhere in the workbook. Therefore a user changing a sheet name will not disable the formulas using that sheet's name.
 
Upvote 0

Forum statistics

Threads
1,214,586
Messages
6,120,402
Members
448,958
Latest member
Hat4Life

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