Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Molly Brown   on Mar 25 In MS Office Category.

  
Question Answered By: Milton Robinson   on Mar 25

This isn't elegant, and I KNOW i can do it with a loop.
but I figured it wouldn't be to cumbersome this way.

I wrote this function:
Function mm2in(Target As Range)
Dim mm, inch, denom, numer
If (Target.Value <> "") Then
inch = Target.Value / 25.4
denom = 64
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 32
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 16
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 8
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 4
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 2
numer = Int(inch * denom)
If (numer Mod 2 = 0) Then
denom = 1
numer = Int(inch * denom)
End If
End If
End If
End If
End If
End If
End If
mm2in = numer & "/" & denom
End Function

then put in cell B2:
=mm2in(A2)
in A2, i put the metric number  I want converted.

the INT function truncates the inch value.
You may wish to round it instead.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on 2003 - Rounding Or get search suggestion and latest updates.


Tagged: