# Thread: Need to determine if a string of text is numeric or alphanumeric

1. I have a list of several thousand rows that contain invoice numbers and need to validate if they are all in either a numeric or alpha numeric format. Is it possible to to make this determination. The string of text can be varying lengths and there are no constants for this data so I'm thinking I would somehow need to look at every character in the string to make this determination. Any thoughts or help on this would be appreciated.

2. [quote name='b0bito' post='768703' date='02-Apr-2009 01:02']I have a list of several thousand rows that contain invoice numbers and need to validate if they are all in either a numeric or alpha numeric format. Is it possible to to make this determination. The string of text can be varying lengths and there are no constants for this data so I'm thinking I would somehow need to look at every character in the string to make this determination. Any thoughts or help on this would be appreciated.

if you want to find out if the cell contain text or numbers
try this =ISTEXT(A1), return True if the cell contain text

HTH

cheers, francis

3. [quote name='b0bito' post='768703' date='01-Apr-2009 12:02']I have a list of several thousand rows that contain invoice numbers and need to validate if they are all in either a numeric or alpha numeric format. Is it possible to to make this determination. The string of text can be varying lengths and there are no constants for this data so I'm thinking I would somehow need to look at every character in the string to make this determination. Any thoughts or help on this would be appreciated.

Thanks for the reply. The ISTEXT option does seem to work if I was enter it in the sheet and drag the formula down. Since I will not actually be entering any formulas in the sheet. Is there a way to include this through Vb. I originally intended to use a for next loop to look at every cell in column A to determine if it is text or alphanumeric. Is there a way to perform this type of check with out adding any formulas to my sheet?

Thanks!

4. What do you want the end result to be?

5. [quote name='HansV' post='768714' date='01-Apr-2009 12:28']What do you want the end result to be?[/quote]

I'm just looking to perform a count of numeic and alphanumeric entries in cells entered into column A.

6. In VBA, the number of numeric values (including date values) is

Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers).Count

and the number of text values (including numbers stored as text) is

Range("A:A").SpecialCells(xlCellTypeConstants, xlTextValues).Count

You can prefix Range("A:A") with a reference to a worksheet if necessary:

Worksheets("MyData").Range("A:A").SpecialCells(xlC ellTypeConstants, xlNumbers).Count

7. [quote name='b0bito' post='768730' date='01-Apr-2009 13:06']I'm just looking to perform a count of numeic and alphanumeric entries in cells entered into column A.[/quote]

Excellent. Thanks for the suggestions. Very much appreciated.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•