View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default Can you ID a cell that has both Alpha AND Numeric characters?

I have not thoroughly tested this, but it seems to work:

Function numbit(r As Range)
Dim s As String
s = r.Value
l = Len(s)
For ll = 1 To 44
s = Replace(s, Chr(ll), "")
Next

For ll = 46 To 47
s = Replace(s, Chr(ll), "")
Next

For ll = 58 To 255
s = Replace(s, Chr(ll), "")
Next

If Len(s) = l Then
numbit = True
Else
numbit = False
End If
End Function

This returns TRUE if the string is only 0 thru 9 and -
otherwise FALSE
--
Gary's Student


"Phil" wrote:

Hello,

I have a data field (for a land parcel spreadsheet) that is named Tract
Number. The field is formatted for text, and a sample value would be this:
7-5-047-088. But there are some cells that contain a combination of numbers
AND text such as 7-5-047-E14, with the letter E in the last group of numbers.

Is there a way to quickly flag ANY cells that contain Alpha characters?

I've already tried to use the ISTEXT function, and it doesn't differentiate
between the two types I've already mentioned.

Thanks in advance for your replies.

Phil.