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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
=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! (y) :wink:
 
Upvote 0
Right.
(y)
:biggrin:
Martin

P.S. Although I guess your formula works. It's mine that does not.
 
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,214,533
Messages
6,120,076
Members
448,943
Latest member
sharmarick

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