Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Rename a tab ("sheet 2") by referencing a cell's data

Can you put a formula in a tab name so it will reference a cell for it's name. In other words: I'd like the name of each tab (instead of Sheet 1, 2, etc...) to be referenced to a cell within each sheet. And is there a way to make this a default ?

iMac, OS X Mavericks (10.9), 20" (early 2008)

Posted on Mar 13, 2015 5:03 PM

Reply
14 replies

Mar 13, 2015 7:55 PM in response to Sharpiejeff

Hi Sharpiejeff,


I am not clear on what you are asking. What are you trying to accomplish? How would you use this? You can name a tab whatever you want but it is not a cell in a table and you cannot run a formula from a tab.


If I wanted to get to Row 300 in table 1 of sheet 1 I could create a second table (maybe call it "300") and drag it down to row 300. When I choose it from Sheet 1's tab I will wisked down to that table and incidentally row 300 of table 1. Does this help?


quinn

Mar 13, 2015 8:28 PM in response to Sharpiejeff

Can you put a formula in a tab name so it will reference a cell for it's name. In other words: I'd like the name of each tab (instead of Sheet 1, 2, etc...) to be referenced to a cell within each sheet.


You can't do this with a formula, but you can change a sheet (tab) name via AppleScript. For example, this script would name sheet whatever you put in A1 of the first table on the sheet. But it would seem easier to just rename the sheet manually. As quinn asks, can you give more specifics on what you are trying to accomplish?


SG




tell application "Numbers"

tell document 1's sheet 1's table 1

set newName to cell "A1"'s value

set parent'sname to newName

end tell

end tell

Apr 26, 2015 10:24 AM in response to Sharpiejeff

Have you tried the script approach?


To use:


  1. Copy-paste into Script Editor (in your Applications>Utilities folder).
  2. Change the "A1" to whichever cell contains the name you want to give to the sheet. (You can also change the 1 if your invoice number isn't contained in the first table on that sheet.)
  3. Click the triangle "run" button.


That's it. The name in the tab changes to match the invoice number you have in a cell.


SG


property invoiceNoCell : "A1"

property invoiceNoTable : 1

tell application "Numbers"

tell document 1's active sheet'stableinvoiceNoTable

set newName to cellinvoiceNoCell'svalue as text

set parent'sname to newName

end tell

end tell

Apr 25, 2015 5:52 PM in response to Sharpiejeff

Hi Sharpiejeff,


I hate navigating through the sheet tabs when there are more than 8 or 9- it is a real pain to scroll through them. If you are wanting to save copies of invoices there are better ways to do that. If you want to be able to refer back to past invoices to mine data, etc. Building a summary table would cover you for that and probably simplify data extraction. I have a generic invoice that will call the relevant data depending on what I choose in certain popups. I save a PDF of the invoice and the data remains in my other sheets.


That said, a script like the one offered by SG could rename your sheets to match a designated cell in the table.


quinn

Apr 26, 2015 10:22 AM in response to Sharpiejeff

Hi SharpieJeff,


If I understand what you are trying to do, you are trying to bring a large number of scattered tables into a single file/doc. This is a good thing. You should see if you can get SG interested in the specifics of doing that.

I want to suggest that you attempt to future proof your setup by imagining what will happen as your data increases over the years. what may work for a handful of clients could breakdown with 100's. I restart my income/billing spreadsheet every year. There is some carryover but it keeps things from getting too large and I have orgaized things so I can copy a few tables and make a few entries to start the year. I have a purchases/inventory file that I run from year to year because I want to be able to track things over multiple years.


It is hard to suggest how to organize things without the specifics of your situation. A pretty standard format would be to have a main data table that carries dates names and services and then smaller tables that can pull info from that table when you need an invoice or want a balance owed or want to know how often you performed a certain service, etc.. Those could be thought of as summary tables.


quinn

Apr 29, 2015 5:15 PM in response to t quinn

I'm still lost. I don't know how to engage the "script". Do i need to have my spreadsheet open and select the table/cell i want to reference?


There seems to be more steps in between that y'all must assume i know about. I need an actual step-by-step-by-step. Not sure if you are willing to take the time to help me, but i could really use the help. Sorry i'm not understanding easily.

Apr 29, 2015 5:56 PM in response to Sharpiejeff

Reason i ask is the tab name now says "missing value". I just don't know how to properly use the script.


That means the script did work but there was nothing in the cell the script addresses.


As quinn explains you need to change the "A1" and the 1 in the two property statements to point the cell where you are storing the name that you want to apply to your sheet.


There is nothing special you have to do to run the script except to have the document open and click somewhere on the sheet that you are renaming to make it the "active" sheet. You don't need to select a specific cell. Just follow the three steps outlined in the post upthread.


SG

Rename a tab ("sheet 2") by referencing a cell's data

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.