Help

Re: How to round a number but keeping the trailing zeros?

Solved
Jump to Solution
1144 0
cancel
Showing results for 
Search instead for 
Did you mean: 

I have some numbers i need to include in a string.

These numbers needs to be rounded down to two decimals, which I use ROUND() to do, my problem comes if the number has trailing zero's fx:

  • 233.50 becomes 233.5
  • 233.00 becomes 233

Does anyone know how can keep the trailing zeros? 

1 Solution

Accepted Solutions
Sho
11 - Venus
11 - Venus

It looks easy, but it was a bit of a challenge.

ROUNDDOWN({Number}, 0) &
"." &
IF(
  FIND(".",ROUND({Number}, 2)&""),
  REGEX_EXTRACT(
    ROUND({Number}, 2)&"0",
    "\\.(\\d{1,2})"
  ),
  "00"
)
  

There has been a number field update recently, and it would be nice if formatted numbers could be used in Formulas as well.

 

See Solution in Thread

4 Replies 4
AirOps
7 - App Architect
7 - App Architect

Hi @Kim_Trager1 

You should be able to resolve this issue by specifying the precision on your formula field in the formatting tab when you edit a field. If your formula field is a number you should get a result like this where you can specify the decimal places you would like to be visible. 

Screenshot 2023-10-06 at 10.30.23 AM.png

 

 

 

Thank you for this, however the number is part of a longer text. Like: "blablablabla £250.00 blablabla"

So it's how do I get the 250.00 to be "blablablabla £250.00 blablabla" instead of "blablablabla £250 blablabla"?

Sho
11 - Venus
11 - Venus

It looks easy, but it was a bit of a challenge.

ROUNDDOWN({Number}, 0) &
"." &
IF(
  FIND(".",ROUND({Number}, 2)&""),
  REGEX_EXTRACT(
    ROUND({Number}, 2)&"0",
    "\\.(\\d{1,2})"
  ),
  "00"
)
  

There has been a number field update recently, and it would be nice if formatted numbers could be used in Formulas as well.

 

This is beautiful, thank you so much. It was not as easy as I thought it would have been.