ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine if character is text or numeric? (https://www.excelbanter.com/excel-programming/320157-determine-if-character-text-numeric.html)

Ed

Determine if character is text or numeric?
 
Within a range, I have designators that should be in the format "B-123".
But I have occasions where the "-" was left out. I also have occasions
where there is an entire word there (ie: "Basic"). So I will run down the
column, setting the value of each cell into a string and check the second
character (Right (Left (strCell, 2), 1); if it's numeric, I need to replace
"B" with "B-". But I can't figure out how to check if that character is
text or numeric. Any help is appreciated.

Ed



Fredrik Wahlgren

Determine if character is text or numeric?
 

"Ed" wrote in message
...
Within a range, I have designators that should be in the format "B-123".
But I have occasions where the "-" was left out. I also have occasions
where there is an entire word there (ie: "Basic"). So I will run down the
column, setting the value of each cell into a string and check the second
character (Right (Left (strCell, 2), 1); if it's numeric, I need to

replace
"B" with "B-". But I can't figure out how to check if that character is
text or numeric. Any help is appreciated.

Ed



There's an ISNUMBER function that you can use:
http://www.techonthenet.com/excel/formulas/isnumber.htm
/Fredrik



Jim Thomlinson[_3_]

Determine if character is text or numeric?
 
There is a function called isnumeric. You may have difficulty with the -
charachter as is numeric will see that as a negative sign...

HTH

"Ed" wrote:

Within a range, I have designators that should be in the format "B-123".
But I have occasions where the "-" was left out. I also have occasions
where there is an entire word there (ie: "Basic"). So I will run down the
column, setting the value of each cell into a string and check the second
character (Right (Left (strCell, 2), 1); if it's numeric, I need to replace
"B" with "B-". But I can't figure out how to check if that character is
text or numeric. Any help is appreciated.

Ed





All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com