Is there a function that returns the sheet name?

  • Thread starter Thread starter Glenn Mulno
  • Start date Start date
G

Glenn Mulno

I would like my worksheet to have one of the fields display the name of the
sheet it came from. Is there a function I can use that does this?

Thanks,
 
this one is from exceltip.com


To get the sheet name:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

To get the workbook name:
=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND("]",CELL("filename"))+1)-FIND("[",CELL("filename"))-2)

To get the path address & workbook name:
=CELL("filename")

To get the path address:
=MID(CELL("filename"),1,FIND("[",CELL("filename"))-1)

Regards
 
It's probably much better to add a reference in those =cell("filename")
functions.

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

You can see why it's important if you create a workbook with two worksheets.

Then window|new window.
then window|arrange|horizontal
and show each sheet
Then save the workbook.

Then put this in A1 of sheet1 and a1 of sheet2:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

And put this in B1 of sheet1 and B1 of sheet2:
=MID(CELL("filename",a1),FIND("]",CELL("filename",a1))+1,255)

And =rand()
in some unused cell.

swap between each worksheet and hit F9 to recalculate a few times.


Bill said:
this one is from exceltip.com

To get the sheet name:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

To get the workbook name:
=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND("]",CELL("filename"))+1)-FIND("[",CELL("filename"))-2)

To get the path address & workbook name:
=CELL("filename")

To get the path address:
=MID(CELL("filename"),1,FIND("[",CELL("filename"))-1)

Regards

--
Greetings from New Zealand
Bill K

Glenn Mulno said:
I would like my worksheet to have one of the fields display the name of the
sheet it came from. Is there a function I can use that does this?

Thanks,
 
Thanks Dave

Did the comparison and saw the difference.
By the way, I posted my reply before I had seen J.E.Mcs answer.
As always, keen to learn.

--
Greetings from New Zealand
Bill K

Dave Peterson said:
It's probably much better to add a reference in those =cell("filename")
functions.

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

You can see why it's important if you create a workbook with two
worksheets.

Then window|new window.
then window|arrange|horizontal
and show each sheet
Then save the workbook.

Then put this in A1 of sheet1 and a1 of sheet2:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

And put this in B1 of sheet1 and B1 of sheet2:
=MID(CELL("filename",a1),FIND("]",CELL("filename",a1))+1,255)

And =rand()
in some unused cell.

swap between each worksheet and hit F9 to recalculate a few times.


Bill said:
this one is from exceltip.com

To get the sheet name:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

To get the workbook name:
=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND("]",CELL("filename"))+1)-FIND("[",CELL("filename"))-2)

To get the path address & workbook name:
=CELL("filename")

To get the path address:
=MID(CELL("filename"),1,FIND("[",CELL("filename"))-1)

Regards

--
Greetings from New Zealand
Bill K

Glenn Mulno said:
I would like my worksheet to have one of the fields display the name of
the
sheet it came from. Is there a function I can use that does this?

Thanks,
 
Back
Top