JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,532
- Office Version
- 365
- Platform
- Windows
I have a UDF that calculates the odds for various events. One of the formats it can use for the result is the fractional odds (5:1, 3/4, etc.). I would like to display these in the most compact form possible. That is, no trailing zeroes. Here's some sample data the results I want:
<tbody>
</tbody>
My thought is to format it as "0.000" and then remove trailing zeroes. Is there a better way?
Actual Result | Desired Display |
5.000/1.000 | 5/1 |
2.500/1.000 | 2.5/1 |
1.250/1.000 | 1.25/1 |
0.667/1.000 | 0.667/1 |
1.000/2.000 | 1/2 |
1.000/1.250 | 1/1.25 |
1.000/1.333 | 1/1.333 |
<tbody>
</tbody>
My thought is to format it as "0.000" and then remove trailing zeroes. Is there a better way?