Remove digits after decimal point (formula)

Is there a formula for this?

Do you mean that you want to change the number of decimal places shown for a given field (incl set to zero) or do you want a formula that will trim the decimal places when using a number from an existing field?

Hi Chris! Oh yeah, I meant trim or truncate :slight_smile:

The easiest thing to do is just to create a formula field that is simply the name of the original number, but with the decimal places option set to zero.

Alternatively, you could use this formula to extract the integer part as text:
Left(ToText([Decimal number]),Find(ToText([Decimal number]),".") - 1)

Because it involves converting the number to text, you lose the thousands separator, and perhaps it becomes less useful for other reasons.

Thanks Chris! I’m getting an error message. It won’t allow me to convert the number to text :cry:

You don’t need the ToText bit if all you want to do is truncate the number

Hi @Chr1sG !

It rounds up though :cry: i.e. 1.5 becomes 2.

I’d like for it to just disregard what’s after the decimal point.

I tried the formula (Left(ToText([Decimal number]),Find(ToText([Decimal number]),".") - 1)) but it’s also giving me the same error message: “Cannot convert Integer formula to Text”

Use the name of the original number field and substract 0.5 (no need for the ToText bit) e.g.
[Formatted Decimal] - 0.5

1 Like

This formula will also work:

ReplaceRegex( ToText( <your-value> ), "\.\d+$", "")

3 Likes

Thank you so much! I couldn’t check 2 “Solution” boxes but both work. I’m working on converting decimal time into standard time.

image

Sounds like we need to log a request for a 12hr clock feature :wink:

Thanks @Matt_Blais
I know how powerful regex expressions can be when used appropriately, but I use them so infrequently that I always end up spending half my time trying to figure out the correct syntax!