Formula to return tab name

pholt33

Board Regular
Joined
Jan 4, 2005
Messages
202
Office Version
  1. 365
Platform
  1. Windows
Help with formula to return tab name

I am trying to come up with a formula that returns the sheet name on which the formula resides. How do I do that? So far Ive used =CELL("filename"), but that returns the entire reference string.

Thanks!
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Re: Help with formula to return tab name

Hi

=REPLACE(CELL("filename",A1),1,FIND("]",CELL("filename",A1)),"")

That worked perfectly! Thanks!

Just to help me understand what its doing, can you explain in English how that formula works?
 
Upvote 0
Re: Help with formula to return tab name

Sure:

Cell("filename",a1) returns the full path & workbook & worksheet name of the worksheet in which it is entered. The format of this value means that the workbook name is always surrounded by square brackets ie [] - so if we find the square bracket ] we know that anything after this bracket is the sheet name. So, we replace all the characters from the 1st up to and including the position of the square bracket with an empty string "" (ie we effectively delete the superfluous data) which just leaves us with the worksheet name.
 
Upvote 0
Re: Help with formula to return tab name

Another good method is using the add-in ASAP Utilities (www.asap-utilities.com) and using the function =SHEETNAME(). Another way to skin the cat I guess. :)
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,887
Members
449,193
Latest member
ronnyf85

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