Need Formula for Getting Worksheet Name

shade73

New Member
Joined
Nov 14, 2005
Messages
3
Hey, I'm trying to insert the name of my worksheet into a cell. Does anyone know what formula that would be?

Also, if I wanted to pull from multiple worksheets
(say Sheet1 & Sheet2) and put it in Sheet3.. what is the formula to do that??

Thanks all!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
=MID(CELL("filename",B1),FIND("]",CELL("filename",B1))+1,LEN(CELL("filename",B1))-FIND("]",CELL("filename",B1)))
 
Upvote 0
Hi Greg,

do you need the B1 reference in this case (no matter which cell was changed last)?

=MID(CELL("filename"),1+FIND("]",CELL("filename")),LEN(CELL("Filename"))

seems to work as well...

Martin
 
Upvote 0
MartinK said:
Hi Greg,

do you need the B1 reference in this case (no matter which cell was changed last)?

=MID(CELL("filename"),1+FIND("]",CELL("filename")),LEN(CELL("Filename"))

seems to work as well...

Martin

I don't believe that will work in all cases, if the last cell you changed was on another sheet it will show the name of that sheet
 
Upvote 0
Martin,

Apparently not (i.e. yours appears to work just fine for me too). The formula I posted was just one I'd jotted down years ago and had handy. Actually, I could swear I saw a better take on this question using SUBSTITUTE() somehow but can't find it. In looking, I did find some other alternatives, including a cute wee UDF from Nate.

Edit - ah, Barry - I wish you'd have been quicker with that post! That's what I get for not thoroughly testing. :oops:

Regards,
 
Upvote 0
I don't believe that will work in all cases, if the last cell you changed was on another sheet it will show the name of that sheet

That's right Barry... thanks for making that clear. :D

Greg, didn't mean to be a hairsplitter, I am using the formula I posted very rarely and it worked for me so far. I was just curious and Barry hit the nail on the head.

regards
Martin
 
Upvote 0
No problem, Martin, I only use that formula once in a blue moon myself. I'm just glad Barry stopped by to keep me from mis-informing the OP and any future readers! So I guess we both are giving Barry a quick tip o' the cap! :bow: :wink:
 
Upvote 0
Greg Truby said:
Martin,

Apparently not (i.e. yours appears to work just fine for me too). The formula I posted was just one I'd jotted down years ago and had handy. Actually, I could swear I saw a better take on this question using SUBSTITUTE() somehow but can't find it. In looking, I did find some other alternatives, including a cute wee UDF from Nate.

Edit - ah, Barry - I wish you'd have been quicker with that post! That's what I get for not thoroughly testing. :oops:

Regards,

Now I'd propose:

=REPLACE(CELL("filename",A1),1,SEARCH("]",CELL("filename",A1)),"")
 
Upvote 0

Forum statistics

Threads
1,223,566
Messages
6,173,106
Members
452,501
Latest member
musallam

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