Large formula problem
Alternative UDF follows. My first one assumed that the row containing the
numbers and text was fixed at 3 columns below the cell containing the target
value:
Function JimsFunct(c As Range, negtext As String) As Integer
Dim i As Integer
Dim v1 As Double, v2 As Integer
Dim rw As Long, col As Long
With Application
.Volatile True
rw = .Caller.Row
End With
col = c.Column: v1 = c.Value: v2 = 0
For i = col + 2 To col + 41 Step 3
If Cells(rw, i - 2) <= v1 And Cells(rw, i - 1) v1 Then
v2 = v2 + IIf(Cells(r, i) = negtext, -1, 1)
End If
Next
JimsFunct = v2
End Function
|