Ask Your Question
0

How do you get a sheet name to display in a cell?

asked 2016-06-04 21:18:02 +0100

BearDrummer@Gmail.com gravatar image

updated 2018-07-25 22:31:11 +0100

erAck gravatar image

I want to have A1 display the sheet name. On the first sheet, where the sheet tab says "Mammot", I want Mammot to display in A1. When I copy the page and paste it into the next page, which says "Potbelly", I want A1 to display Potbelly. I am creating a feeding value chart for a tribe member, and that would prevent a great deal of headache.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2016-06-05 00:27:27 +0100

Lupp gravatar image

updated 2018-07-25 23:23:58 +0100

There is no standard function in Calc returning the name of the (a) sheet.
Workarounds:
1. (Only applicable if the documet was already saved as a file) Use =CELL("FILENAME";A1) in A1. The resulting text will contain the sheetname preceeded by "#", and you can extract the sheetname using
=MID(A1;FIND("#";A1)+1;65535) e.g.
2. Code a user function for the purpose. In BASIC this should work:

Function sheetName(pSheetNum)
REM In Calc Sheets are numbered starting with 1
REM The API starts numbering with 0.
sheetName = ThisComponent.Sheets(pSheetNum-1).Name
End Function

=SHEETNAME(SHEET()) will then return the name of the current sheet.

edit flag offensive delete link more
1

answered 2016-06-05 07:08:02 +0100

pierre-yves samyn gravatar image

Hi

Since 3.6 you can insert a field Sheet Name in a cell:

  • Activate the cell to be in Edit mode (e.g. Double-click in the cell) ,
  • Right-click on the cell, and select Insert Fields in the context menu.

Limitation: update not automatic, needs Shift+Ctrl+F9 if you rename a sheet (or updated on reload of course).

Regards

edit flag offensive delete link more
1

answered 2016-06-04 23:38:44 +0100

m.a.riosv gravatar image

=MID(CELL("filename");FIND("#$";CELL("filename"))+2;LEN(CELL("filename")))

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-06-04 21:18:02 +0100

Seen: 5,930 times

Last updated: Jul 25 '18