Round percentage with no decimal

Hi all

I am doing a calculation, but want the percentage to round to whole number. I tried the round function, but it didn't seem to work correctly. Any tips?

Hey Stephanie,

What is the exact format of the number you're inputting into your round function? If it contains the percentage symbol, it won't work since round expects numbers only.

Works with numbers
Enter number to round: {formtext: default=33.3; name=wholenumber}
Round it: {=round(wholenumber)}

Doesn't work with the percent symbol
Here's a fake percentage: {formtext: default=33.3%; name=percent}
Rounding won't work because the percent field has the percent symbol in it: {=round(percent)}

Two ways you can approach this, one really simple and one a little fancier:

Option 1: put the percentage symbol outside of the field where you're inputting the number that's to be rounded

I want to round this percentage: {formtext: default=33.3; name=percent}%
Here it is rounded: {=round(percent)}%

Option 2: if you really want to leave the percent symbol in your input, drop the percent symbol before you round it
I want to round this percentage: {formtext: default=33.3%; name=percent2}{numbertoround=left(percent2, len(percent2)-1)}
Here it is rounded: {=round(numbertoround)}%

1 Like

Thanks @Andrew_Hall !

Hello @Andrew_Hall, do you know how I can round the percentage with something like the following formula? When I use the round function, it seems like the calculation is skewed somehow

{note}Contract Amount?{formtext: name=contractamount}


Our lowest cost option is $5250, {=5250/contractamount; format=%} less than your current annual commitment.

@Tori_Scharadin Happy to help -- try this out:

{note}Contract Amount?{formtext: name=contractamount}

{endnote: trim=right}
Our lowest cost option is $5250, {=((contractamount-5250)/contractamount); format=.2%} less than your current annual commitment.

I corrected the math for figuring out the percentage change, and then I updated the format to be .2%, which is saying use the percentage formatting with 2 decimal places.