View Single Post
  #11   Report Post  
Harlan Grove
 
Posts: n/a
Default Extract Fractional Numbers as Numbers NOT Date

"Gary''s Student" wrote...
A2 is just fine. Enter the following UDF:

Function calcit()
calcit = Evaluate("=" & [A2])
End Function

and it will give you the .375 you desire.

....
"Bernard Liengme" wrote:
How did you do the extraction. Try changing it to generate =3/8
(i.e add the equal sign) or generate 0 3/8 which is how a
fraction is entered.

....

A udf for this, ESPECIALLY a udf using hardcoded cell references, is a
REALLY STUPID suggestion. (If you're going to suggest a udf, at least use
sensible function arguments.)

Bernard was on the right track. All it takes is using the formula

=--("0 "&MID(A1,3,FIND("x",A1)-3))

if the leading text is always 2 characters, or the array formula

=--("0 "&MID(LEFT(A1,FIND("x",A1)-1),
MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),2 56))

if the leading number of nondigits is variable.