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 !