Truncating a decimal value
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am wanting to truncate decimal values to 1 decimal place.
I do not want the value to have rounding applied so ToString() and the Fixed Decimal will not work for me.
Is there a way to this using a formula?
Some sample data and output below:
Data 1 | |
12.123 | 12.1 |
0.897 | 0.8 |
23.77 | 23.7 |
1.55639 | 1.5 |
0.23 | 0.2 |
Thanks,
Ash
Solved! Go to Solution.
- Labels:
- Expression
- Output
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@aka_ash
It is like Round down right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Glad to help and thank you for the accept mark.😁
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Would it be possible to achieve the same using a Regex formula?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Qiu ,
I meant the regex_replace formula, but i can see that the Parse also works, Thanks for that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Qiu.
One thing i did not take account of is negative numbers.
Looks like the Floor formula changes the value of the first decimal as it rounds down, the Regex Parse removes the negative indicator.
Is there a way to get the below?
Data 1 | Output |
12.123 | 12.1 |
-0.897 | -0.8 |
23.77 | 23.7 |
-1.55639 | -1.5 |
0.23 | 0.2 |
-23.421 | -23.4 |
Thanks in advance,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
