An alternative (with UDF) :
first <Alt><F11>, Insert-> Module
copy/paste this into the module:
Function IsAlpha(Target As String, Optional StrtPos As Long = 1, Optional IncludeNums As Boolean = False, Optional IncludeSpace As Boolean = False) As Boolean
Dim LCount As Long
Const AlphaStr As String = "[A-Z]"
Const NumStr As String = "[0-9]"
IsAlpha = True
If (Target = "") Or (Len(Target) < 1) Then
IsAlpha = False
Exit Function
End If
For LCount = 0 + StrtPos To Len(Target)
If UCase(Mid(Target, LCount, 1)) Like AlphaStr Then
Else
If IncludeNums And (Mid(Target, LCount, 1)) Like NumStr Then
Else
If IncludeSpace And (Mid(Target, LCount, 1) = " ") Then
Else
IsAlpha = False
Exit For
End If
End If
End If
Next LCount
End Function
Then use this formula, In B1 :
Formula:
=IF(IFERROR(SEARCH("-",A1)>0,FALSE),"Y",IF(ISNUMBER(A1),"Z",IF(IsAlpha(A1),"X",IF(IsAlpha(A1,,TRUE),"O",NA()))))
Drag down
Hope this helps
Edit-
You can change the NA() for "" if you don't like error messages, I went with that so you would know there was some unforeseen condition in your data..
Bookmarks