## Rounding Variables (Currency Values)

### Rounding Variables (Currency Values)

So I'm working on a button that adds two monetary amounts, then multiplies it by a percentage. However, I come across two intermittent issues: One, an extra digit in the thousandth place, or a digit missing (0) in the hundredth place. Is there a simple (or simple-ish) way to check and correct the variable so it rounds properly?

### Re: Rounding Variables (Currency Values)

Not sure this is simple-ish, but here is a solution.

{Var1=12.34} //store the result into Variable #1

{Length 2,{Var1}} //get the length of the number and store it into variable #2

{If (Var2=4) [{Var1}0]} //if the length is 4 the number is missing a zero. type the number and type an extra zero

{If (Var2=5) [{Var1}]} //if the length is 5 the number is correct, just type it

{If (Var2=6) [{Copy 1,5,3,{Var1}}{var3}]} //if the length is 6, copy the first 5 characters from variable #1 into variable #3 and then type it.

Some kind of format function would help here. I'm adding it to the TO DO list.

{Var1=12.34} //store the result into Variable #1

{Length 2,{Var1}} //get the length of the number and store it into variable #2

{If (Var2=4) [{Var1}0]} //if the length is 4 the number is missing a zero. type the number and type an extra zero

{If (Var2=5) [{Var1}]} //if the length is 5 the number is correct, just type it

{If (Var2=6) [{Copy 1,5,3,{Var1}}{var3}]} //if the length is 6, copy the first 5 characters from variable #1 into variable #3 and then type it.

Some kind of format function would help here. I'm adding it to the TO DO list.