Is there a formula so a cell can be titled the same as the sheet tab?

srob93

New Member
Joined
Dec 28, 2020
Messages
14
Platform
  1. Web
Hello,

I am wondering if there is a formula for gsheet so I can have a specific cell named the same as the sheet tab at the bottom?

See attached.

I need cell C1 to be titled 001 as per the tab at the bottom...

Any help would be great thank you! ?
 

Attachments

  • gsheet query #2.png
    gsheet query #2.png
    134.4 KB · Views: 26

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hello try this.
  1. Go to Tools > Script gallery....
  2. Search for "sheet name"
  3. Install the script
  4. Use it with =getCurrentSheetName().
Or this formula but I only tested it on excel 365 desktop
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
 
Upvote 0
Hello try this.
  1. Go to Tools > Script gallery....
  2. Search for "sheet name"
  3. Install the script
  4. Use it with =getCurrentSheetName().
Or this formula but I only tested it on excel 365 desktop
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

Hello thank you for your reply.

Sorry I am such a novice with excel, and currently using gsheet.

Please can you further breakdown how this is done? Stuck even finding Script Gallery (I have a Script Editor??)

Thank you in advance :biggrin:
 
Upvote 0
Sorry,
Try this one:
  • Go to tools > Script Editor
  • Write this function:
VBA Code:
function sheetName() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  return sheet.getName();
}
  • Save the script
  • Return to your sheet
  • Then enter =sheetName() into any cell
 
Upvote 0
Sorry,
Try this one:
  • Go to tools > Script Editor
  • Write this function:
VBA Code:
function sheetName() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  return sheet.getName();
}
  • Save the script
  • Return to your sheet
  • Then enter =sheetName() into any cell
Thank you - getting closer!!

See attached.

Function copied in to the Script Editor but then get an error message saying "1:13:23 PM Error Attempted to execute sheetname, but it was deleted."

Any ideas??
 

Attachments

  • gsheet query #3.png
    gsheet query #3.png
    105.8 KB · Views: 8
Upvote 0
Thank you - getting closer!!

See attached.

Function copied in to the Script Editor but then get an error message saying "1:13:23 PM Error Attempted to execute sheetname, but it was deleted."

Any ideas??

Hi again,

After leaving it for a few minutes it seems to have worked... almost!

See attached.

I have entered =sheetname() in to the cell but it links to the wrong sheet name! I need it to say '001' then '002' then '003' and so on... not '2021 Overview'

Many thanks - this is great so far!
 

Attachments

  • gsheet query #5.png
    gsheet query #5.png
    177.9 KB · Views: 17
Upvote 0
Once again I apologize.
I tested it here only with a tab.
Please test this:
  • Go to tools > Script Editor
  • Write this function:

VBA Code:
function mySheetName() {
  var key = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
  return key;
}
  • Save the script
  • Return to your sheet
  • Then enter =mySheetName() into any cell
 
Upvote 0
Solution
Once again I apologize.
I tested it here only with a tab.
Please test this:
  • Go to tools > Script Editor
  • Write this function:

VBA Code:
function mySheetName() {
  var key = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
  return key;
}
  • Save the script
  • Return to your sheet
  • Then enter =mySheetName() into any cell

PERFECT ? ? ? ? Afonsomira - thank you very much !
 
Upvote 0

Forum statistics

Threads
1,223,630
Messages
6,173,456
Members
452,514
Latest member
cjkelly15

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