I have some custom functions in an excel spreadsheet that a couple people use for this particular template. I put these functions in the "Module" section. These functions work fine on my machine and another co-workers machine. We all use Excel 2003, but another co-worker, also on Excel 2003, will get the "#NAME" error whenever she tries to change the value of any of the cells that these functions use to calculate a value.
Function div(cell As Variant) As Variant
If IsEmpty(cell) Then
div = ""
Else
div = cell / Range("$B$9")
End If
End Function
Function pst(x As Variant) As Variant
If IsEmpty(x) Then
pst = ""
Else
pst = x
End If
End Function
Function ifx(cellx As String) As String
If Left(cellx, 2) = "'X" Or Left(cellx, 1) = "X" Then
ifx = 1
Else
ifx = "N/A"
End If
End Function
Function lf(rate As Variant, load As Variant, hour As Variant) As Double
Const LoadFactorA = 2.151814912
Const LoadFactorB = 1.930413331
Const LoadFactorC = 1.585907751
Const LoadFactorD = 1.423288683
Const LoadFactorE = 1.2394746
Const LoadFactor0 = 0
If rate = "" Then
rate = 0
End If
If hour = "" Then
hour = 0
End If
Select Case load
Case "A": lf = rate * LoadFactorA
Case "B": lf = rate * LoadFactorB
Case "C": lf = rate * LoadFactorC
Case "D": lf = rate * LoadFactorD
Case "E": lf = rate * LoadFactorE
Case "": lf = rate * LoadFactor0
End Select
If hour > 200 And lf = rate * LoadFactorA Or lf = rate * LoadFactorB Then
lf = lf * 200
Else
lf = lf * hour
End If
End Function
Function prod(cost As Variant, factor As Variant) As Variant
Const FactorF = 1.09601428571429
Const FactorG = 1.175
Const Factor0 = 0
If cost = "" Then
cost = 0
End If
Select Case factor
Case "F": prod = cost * FactorF
Case "G": prod = cost * FactorG
Case "": prod = cost * Factor0
End Select
End Function
Function divide(x As Variant, y As Variant) As Variant
If y = 0 Then
divide = 0
Else
divide = x / y
End If
End Function
I haven't the slightest clue as to why it'd do this especially since it works fine for myself and my co-worker.
Bookmarks