Subtract Variables Format result

Variable1 is 863,452
Variable2 is 850,475
How do you subtract Variable2 from Variable1 and format the result to have the ‘thousands’ comma if needed.
I’ve only been able to do this by first stripping out the comma from the source Variables, performing a calculation, then adding back in the comma if necessary.
There has to be an easier way, I’m sure.

Not really, Keyboard Maestro only supports numbers with decimal point of "." and no thousands separators.

So you have to strip out the commas, and then you can add and format them like:

Would this be your suggestion?

Number of Files Subtract Variables.kmmacros (3.2 KB)

That should work, although the Set Variable to Text action and the Set Variable to Calculation action would normally just be one action:

Set variable Variable3 to calculation “Variable1-Variable2” with format #,###

1 Like