fraction formatting

Galgenstrick

New Member
Joined
Apr 21, 2012
Messages
43
This is a slightly weird questions, but I need a decimal converted to a fraction a certain way, similar to the fractional number formatting. I'm guessing this will have to be done in VBA

Here's an example of what I'm looking to do:

I have a cell that is always rounded to the nearest 0.5, I want to convert that to a fraction of either 1/16" if the number is whole, or 1/32" if the number ends in 0.5.

Example:
0.5 converted to 1/32"
1 converted to 1/16"
3 converted to 3/16"
3.5 converted to 7/32"
-5 converted to -5/16"
-5.5 converted to -11/32"
etc...
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You could do it with a formula.

=IF(INT(A1)=A1,A1&"/16""", A1/0.5&"/32""")
 
Upvote 0
This formula assumes the lookup value is in A1. The output will be a text value, not a numerical value!

=If(roundup(A1,0)=A1,A1&”/16”,A1*2&”/32”)
 
Upvote 0
How about just ...

A​
B​
C​
1​
0.5​
1/32​
B1: =A1/16
2​
1​
1/16​
Format of B1: # ??/??
3​
3​
3/16​
4​
3.5​
7/32​
5​
-5​
- 5/16​
6​
-5.5​
- 11/32​
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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