Parsing the directional out of addresses using nested IF .
The problem is with the FIND function -- instead of returning FALSE for
the first FIND which looks for "S ", it returns an error, so it never
proceeds on to the next IF.
So you should change your function to check for errors in the FIND:
=IF(NOT(ISERROR(FIND("S ",E21))),"S",IF(NOT(ISERROR(FIND("N
",E21))),"N",""))
Or you could use a user-defined function:
Function Direction(strAddress As String) As String
If InStr(1, strAddress, "S ") 0 Then
Direction = "S"
Exit Function
End If
If InStr(1, strAddress, "N ") 0 Then
Direction = "N"
Exit Function
End If
End Function
--
Dianne
In ,
Dan typed:
I have addresses that have intermittant directional
charactors i.e. N street or S street or NW street. I used
this combination of functions to conditionally parse the
information but my logic is flawed somewhere. Any help
would be appreciated. The fuctions I used were IF() Left()
Find()
=IF("S"=LEFT(E21,FIND("S ",E21,1)),"S",IF("N"=LEFT(E21,FIND
("N ",E21,1)),"N"," "))
Cell E21 has the following address N Avenue 235.
The result of the function is #VALUE!
The preceeding cell has S Avenue 67 and the return value
was S.
The first part of the formula seems to work but the nested
if statments do not.
|