Is there a cleaner way to write a compound if statement or should I use another syntax altogether?
In particular, this line of code.
[tt]
ElseIf Mid(GroupID, 3, 2) = "AP" Or Mid(GroupID, 3, 2) = "SJ" Or Mid(GroupID, 3, 2) = "SQ" Then
[/tt]
In particular, this line of code.
[tt]
ElseIf Mid(GroupID, 3, 2) = "AP" Or Mid(GroupID, 3, 2) = "SJ" Or Mid(GroupID, 3, 2) = "SQ" Then
[/tt]
Code:
Function RegionCode(RTCol As String, GroupID) As String
If Len(GroupID) > 0 Then
If RTCol = "PS" Then
If Mid(GroupID, 1, 3) = "X30" Then
RegionCode = "PS - ISME - HP"
ElseIf Mid(GroupID, 2, 2) >= 15 And Mid(GroupID, 2, 2) <= 19 Then
RegionCode = "PS - OAKLAND"
ElseIf Mid(GroupID, 2, 2) <= 29 Then
RegionCode = "PS - SAN RAMON"
ElseIf Mid(GroupID, 2, 2) <= 49 Then
RegionCode = "PS - SOUTH BAY"
ElseIf Mid(GroupID, 2, 2) <= 79 Then
RegionCode = "PS - SACRAMENTO"
ElseIf Mid(GroupID, 2, 2) <= 89 Then
RegionCode = "PS - NORTH BAY"
ElseIf Mid(GroupID, 2, 2) >= 90 Then
RegionCode = "PS - MULTI-REGION"
End If
ElseIf RTCol = "ED" Then
If GroupID = "LAPSA" Or Mid(GroupID, 3, 2) = "LA" Then
RegionCode = "ED - LOS ANGELES"
[red] ElseIf Mid(GroupID, 3, 2) = "AP" Or Mid(GroupID, 3, 2) = "SJ" Or Mid(GroupID, 3, 2) = "SQ" Then
RegionCode = "ED - SOUTH BAY" [/red]
ElseIf Mid(GroupID, 3, 2) = "SR" Then
RegionCode = "ED - SANTA ROSA"
End If
End If
Else
RegionCode = ""
End If