Hi everyone,

is it possible to subtract two numbers of which one is the result of a sum? All without using third-party fields where to calculate the sum of the two numbers.

Below is the example:

- "x-y" where "y" is equal to "a+b" --> so
**x-(a+b)**

a+b could be a result of a rollup sum

Thank you!

Hi Mirco Marcigaglia,

Yes.

A calculated field function can accept as parameters:

1. values (strings, numbers, boolean) - "word soup", 24, true

2. field variables - $name, $quantity

3. other functions - add(24,$quantity)

So, if you want to make the calculated field formula for x-(a+b), you would:

A thing to keep in mind is that each function has stipulations about the data type. You can't do math on strings and boolean, for example. So, if you have a number in a text field, for example, and you want to use it in some math, you have to first use a function to convert it to a number.

For example:

Also, don't take for a granted that an empty field will be treated as a zero in math functions. To account for this, I wrote this knowledge base article.

I hope this helps!