Arithmetic operations with decimals

I am subtracting $3,456.65 with $3,231.78. I’m using the Numeral.js in that case, but the bot doesn’t compile it. How to fix this situation and carry out this operation?


Hi @Jose_Miguel_Almonte!

It is not possible to use the Numeral library within the “Assign value to variable” activity.

What you want to do (take amounts from strings that have the “$” symbol and then calculate the difference between them) can be peformed by first using the “replace” method to remove the “$” symbol, and then using the “Number” method to turn the string into a number variable.

Just like this:

After you run it, the variables will look like this:

Notice that old_value and new_value don’t have the quotes (") around it, nor the “$” symbol.

Let me know if this works for you!

1 Like

Hello @Jose_Miguel_Almonte, Please let us know if the solution we provided above worked for you.

Thank you, it has helped me a lot. Sorry for the delay in responding.

1 Like