Numbers - deleting data without deleting formulas

How do I delete the information in the Numbers app without deleting all the formulae? I don't want to have to start all over again. Using the most up to date software on the iMac (El Capitan 10.11.2) with the latest version of Numbers.

iMac, OS X El Capitan (10.11.2)

Posted on Dec 31, 2015 2:30 PM

Reply
9 replies

Dec 31, 2015 7:44 PM in response to alysonfromon

alysonfromon wrote:


How do I delete the information in the Numbers app without deleting all the formulae?


Suppose you have a table like this with formulae interspersed with data that you find inconvenient to separate ...

User uploaded file


...And you want to quickly remove the data, leaving the formulae, so that it looks like this, ready for reuse with new data:


User uploaded file


You can quickly accomplish that by running the script below.


  1. Copy-paste the script from below into AppleScript Editor (in Applications > Utilities).
  2. Select the cells you want to clean up, leaving the formulas. For example, here I selected B2:D8.
  3. Click the triangle run button in Script Editor.


Some people are intimidated by scripts. But it is really easy to use one that is already written. Copy, paste, select cells, click to run.


Be sure to make a backup of your work before using this just in case you accidentally select the wrong cells.


SG




tell application "Numbers"

tell front document to tell active sheet

tell (first table whose selection range's class is range)

set selRng to selection range

repeat with aCell in selRng's cells

tell aCell to if its formula is missing value then ¬

set its value to ""

end repeat

end tell

end tell

end tell

Jan 1, 2016 3:14 AM in response to alysonfromon

Hi SG,


Nice one!


Hi Alyson,


Just reading this discussion, may I add to previous replies. Maybe you are looking for a flexible formula that will update with just one edit in one cell.

Keep your data table intact and change the value (Year, in this example) in another table (Year total)

:User uploaded file


Formula in B2 of the Data table (and Fill Down)

=IF(A2="","",YEAR(A2))

If a cell in Column A is empty (""), then insert NULL ("") in the B cell, else extract the YEAR from the date in A.

User uploaded file

Formula in B1 of the Year total table uses SUMIF

=SUMIF(Data::B,A1,Data::C)


Enter another year in B1 of the Year total table to sum the values for that year:

User uploaded file


Please call back with questions.


Regards,

Ian.

Dec 31, 2015 4:43 PM in response to alysonfromon

Alyson,


Welcome to the forum for Numbers on mac os x .


The best way to make it easy to remove data without affecting formulas is to segregate them in separate tables.


In the example below, I placed data in a table named "Data" and the calculations are in a table called Statistics:

User uploaded file


This way I can select any cell in the table Data, then select all, and delete to remove all data.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Numbers - deleting data without deleting formulas

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