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

GuyGadois

Active Member
Joined
Jan 12, 2009
Messages
344
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,223,991
Messages
6,175,818
Members
452,672
Latest member
missbanana

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