Round to nearest half cent then display the half cent as fraction

wilkisa

Well-known Member
Joined
Apr 7, 2002
Messages
657
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I've been struggling with this one and I don't think it should be so difficult. My user is rather old school and wants to show his stock prices round to the nearest half cent and then display that half as a fraction. Example: 10.165 should be displayed as 10.16 1/2 or 4.555 should be displayed as 4.55 1/2.

I've tried the DOLLARFR function but it wants to display the entire decimal as a fraction. I tried custom formatting the cells as using various combinations of # ?/? trying to get it to display only the half cent in fractional format but haven't been successful. I then hit on the following formula:

=IF(RIGHT(B18,1)="5",SUBSTITUTE(B18,RIGHT(B18,1)," 1/2"),B18)

and it works great...as long as there is only a single 5 in the value to convert. The value above, 4.555, displays as 4. 1/2 1/2 1/2. So, I clearly need help with this. Does someone have a good solution?

Thanks,
Shirlene
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
if you format to one decimal place, and use round, use point5 to make sure you limit to only the fraction
 
Upvote 0
Thanks, Mole, for responding but I don't think your suggestion will get what we need. His price quotes are rounded to 3 decimals places and that what he wants it to be; 1 decimal place is not adequate and that's my dilemma. With the 3 decimal places, he wants to see the first 2 numbers as decimal and the 3rd number as a fraction of the nearest half cent. So, 4.555 should become 4.55 1/2.
 
Upvote 0
=text(trunc(mround(b18,0.005),2),"#.00") & " " &text(mod(mround(b18,0.005)*100,1),"#/2")
 
Upvote 0
I've refind to
Code:
=TEXT(TRUNC(MROUND(B28,0.005),2),"#.00") & " " & IF(MOD(MROUND(B28,0.005)*100,1)=0,"",TEXT(MOD(MROUND(B28,0.005)*100,1),"#/2"))
Which is meant to display the "1/2" when valid. But testing shows that some of that funky math error can yield a "0/2".
 
Upvote 0
Hello, SpillerBD. Thank you so much for this formula as it works perfectly! I really appreciate it.

Shirlene
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top