Numbers: Convert Negative to Positive

macOS Mojave10.4.1

Numbers version 5.3 (5989


I have a spreadsheet full of negative numbers that I'd actually like to be positive numbers for ease of reading.


How can this be accomplished without retyping each cell?


Thanks in advance!


User uploaded file

MacBook Pro with Retina display, iOS 12.1

Posted on Nov 21, 2018 1:22 PM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Nov 21, 2018 1:55 PM

If all the values in the table are 0 or negative and you want to set them all to positive then you can use the short script below.


  1. Copy-paste script into Script Editor (in Applications > Utilities).
  2. Make sure Script Editor.app is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.
  3. Click anywhere in the table that contains the negative values you want to change to positive.
  4. Click the triangle 'run' button in Script Editor.


Done in a few seconds.


SG


tell application "Numbers"

tell front document's active sheet

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

repeat with c in cells

set v to c's value

try

if v < 0 then set c's value to v * -1

end try

end repeat

end tell

end tell

end tell

3 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

Nov 21, 2018 1:55 PM in response to shestad

If all the values in the table are 0 or negative and you want to set them all to positive then you can use the short script below.


  1. Copy-paste script into Script Editor (in Applications > Utilities).
  2. Make sure Script Editor.app is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.
  3. Click anywhere in the table that contains the negative values you want to change to positive.
  4. Click the triangle 'run' button in Script Editor.


Done in a few seconds.


SG


tell application "Numbers"

tell front document's active sheet

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

repeat with c in cells

set v to c's value

try

if v < 0 then set c's value to v * -1

end try

end repeat

end tell

end tell

end tell

Reply

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: Convert Negative to Positive

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