I have a UDF I based off of a prior I was using.
The prior one works just fine.
But for some reason, this new one just returns a #VALUE error.
I have 3 columns with Headers of:
TD
ST
FLR
In the FLR I input my UDF and it is based off of the TD & ST.
Could someone give it a look over and hopefully point out where I am going wrong for some reason? Please?
Thanks!
-Spydey
The prior one works just fine.
But for some reason, this new one just returns a #VALUE error.
I have 3 columns with Headers of:
TD
ST
FLR
In the FLR I input my UDF and it is based off of the TD & ST.
Could someone give it a look over and hopefully point out where I am going wrong for some reason? Please?
Thanks!
Code:
Function FLR(TD, ST)
Dim AryTM1, AryTM2, AryA1, AryR1, AryJ1, AryD1 As Variant
AryTM1 = Array("AR", "CT", "GA", "MD", "NJ", "NY", "OR", "PA", "TN", "WA", "VA")
AryTM2 = Array("AL", "CA", "FL", "IL", "LA", "MA", "MI", "MO", "MS", "NC", "OH", "PR", "TX")
AryA1 = Array("AZ", "CO", "DC", "DE", "IA", "ME", "MN", "NH", "RI", "WV")
AryR1 = Array("IN", "KS", "NE", "NM", "SC", "WI")
AryJ1 = Array("AK", "HI", "ID", "KY", "NV", "ND", "UT")
AryD1 = Array("MT", "OK", "SD", "VT", "WY", "VI")
If UBound(Filter(AryA1, ST, True, vbTextCompare)) >= 0 Then
Reps = "A1"
ElseIf UBound(Filter(AryR1, ST, True, vbTextCompare)) >= 0 Then
Reps = "R1"
ElseIf UBound(Filter(AryJ1, ST, True, vbTextCompare)) >= 0 Then
Reps = "J1"
ElseIf UBound(Filter(AryD1, ST, True, vbTextCompare)) >= 0 Then
Reps = "D1"
ElseIf UBound(Filter(AryTM1, ST, True, vbTextCompare)) >= 0 And TD < 50 Then
Reps = "A1"
ElseIf UBound(Filter(AryTM1, ST, True, vbTextCompare)) >= 0 And TD >= 50 Then
Reps = "B1"
ElseIf UBound(Filter(AryTM2, ST, True, vbTextCompare)) >= 0 And TD < 34 Then
Reps = "R1"
ElseIf UBound(Filter(AryTM2, ST, True, vbTextCompare)) >= 0 And TD >= 34 And TD < 67 Then
Reps = "J1"
ElseIf UBound(Filter(AryTM2, ST, True, vbTextCompare)) >= 0 And TD >= 67 Then
Reps = "D1"
Else
Reps = "Unkown"
End If
End Function
-Spydey