How to clear data but not formula from a cell in numbers 3.6 for os x

I am trying to clean up a table with rows for future data. Several cells in the future calculate non-meaningful results, because they require data for a certain date. So I want the formatting, and the formula, but I don't want the cell populated with a zero (or the result of 0 less another cell). I see the delete, and the clear all but I can not find a clear data and save the formula. It would be easy in excel.

Thanks, I am trying to learn numbers but the paucity of real documentation is a challenge!

MacBook Air (13-inch, Early 2014), Mac OS X (10.7.5)

Posted on May 6, 2016 6:58 AM

Reply
3 replies

May 6, 2016 1:37 PM in response to nelsolot

Here are some other ideas. Let's say you start with a table like this, with formulas in column D and row 6.


User uploaded file



You can select the cells with formulas and apply a Custom Format to hide values of 0 or less, like this:


User uploaded file


You define a Custom Format in the Data Format dropdown list in the Format > Cell panel.


You can use the script below to clear the contents of cells and leave just formulas, formats and text values (No AppleScript knowledge required; just copy-paste, select, and click).


  1. Copy-paste into Script Editor (in Applications > Utilities).
  2. Select the cells in the table that you want to clear.
  3. Click the 'run' button.


The table will now look like this:


User uploaded file


But the formulas are still there.



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 (get selection range)'s cells

try

tell aCell to if its formula is missing value and ¬

(its value) * 1 is its value then ¬

set its value to ""

end try

end repeat

end tell

end tell

May 6, 2016 10:04 AM in response to nelsolot

"Several cells in the future calculate non-meaningful results, because they require data for a certain date. So I want the formatting, and the formula, but I don't want the cell populated with a zero (or the result of 0 less another cell)."


Hi nelsolot,


You could add a 'switch' to the formula in these cells that suppresses calculation and inserts a null string until the required data has been entered.


Example: Required data will be entered in B2.


=IF(B2="","",existing-formula)

or

=IF(LEN(B2)<1,"",existing-formula)


Regards,

Barry

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.

How to clear data but not formula from a cell in numbers 3.6 for os x

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