LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default UDF Function Not working

I have two functions. One to split out each side of a measurement ....
36 1/8 X 40 17/32. This is in one cell. The functions are supposed
to take and find the square inches of the measurements. So in this
case FCArea would be 36.125 * 40.53125. It is finding the right cell
and all of the right information seems to be going to the right
places, then it returns a #value. Any help will be greatly
appreciated.

Thanks,
Jay

Function FCarea() As Double
Application.Volatile
Dim Fnd As String
Dim L As String, R As String, X As Integer
Fnd = Range("B:B").Find(what:="Final Size:").Offset(2, 0).Value
X = InStr(1, Fnd, "X", 1)
L = Left(Fnd, X - 1)
R = Right(Fnd, Len(Fnd) - X)
FCarea = Frac2Num(L) * Frac2Num(R)
End Function

Function Frac2Num(ByVal X As String) As Double
Dim P As Integer, N As Double, Num As Double, Den As Double
X = Trim$(X)
P = InStr(X, "/")

If P = 0 Then
N = Val(X)
Else
Den = Val(Mid$(X, P + 1))

If Den = 0 Then Error 11 ' Divide by zero
X = Trim$(Left$(X, P - 1))
P = InStr(X, " ")
If P = 0 Then
Num = Val(X)
Else
Num = Val(Mid$(X, P + 1))
N = Val(Left$(X, P - 1))
End If
End If
If Den < 0 Then
N = N + (Num / Den)
End If
Frac2Num = N
End Function
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ISBLANK function not working when cell is blank dut to function re mcmilja Excel Discussion (Misc queries) 9 May 7th 23 03:43 AM
IF Function not working Jomark Excel Worksheet Functions 8 January 19th 09 09:29 AM
IF function not working Soni Excel Worksheet Functions 3 November 10th 08 09:05 PM
RIGHT function not working Jase Excel Discussion (Misc queries) 1 May 13th 08 09:08 PM
Function F3 key not working wyattran Excel Worksheet Functions 0 August 8th 05 04:38 PM


All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"