Formula to obtain worksheet's name?

ianccy

Active Member
Joined
Jul 28, 2002
Messages
332
I want to enter a formula to a cell so that it equals the name of the worksheet, anyone?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
On 2002-10-15 06:29, ianccy wrote:
I want to enter a formula to a cell so that it equals the name of the worksheet, anyone?

Thanks

In A1 enter:

=CELL("filename",Sheet1!A1)

In B1 enter:

=RIGHT(A1,LEN(A1)-SEARCH("@#",SUBSTITUTE(A1,"]","@#",LEN(A1)-LEN(SUBSTITUTE(A1,"]","")))))
 

applebyd

Active Member
Joined
May 27, 2002
Messages
348
You can do it with a litthe bit of code in a macro

sub sheet ident()

' Select a target cell for the result

Range("R39").Select
ActiveCell = ThisWorkbook.Name


End Sub



Hope this helps.

Whoopee answered a Vba question

:) DaveA :) :wink:
 

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,942
Or this, courtesy of Bill Manville.

=MID(CELL("filename",A2),FIND("]",CELL("filename",A2))+1,255)
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
On 2002-10-15 07:16, dk wrote:
Or this, courtesy of Bill Manville.

=MID(CELL("filename",A2),FIND("]",CELL("filename",A2))+1,255)

If you installed the morefunc.xll add-in, we can make it shorter & more efficient:

=WMID(CELL("filename",A1),-1,1,"]")

or just

=SHEETNAME() :biggrin:

Aladin
This message was edited by Aladin Akyurek on 2002-10-15 07:48
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,026
Messages
5,835,024
Members
430,332
Latest member
Charly_Moon

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
Top