ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Checking a cell for only Alphanumerical characters (https://www.excelbanter.com/excel-worksheet-functions/152711-checking-cell-only-alphanumerical-characters.html)

Trefor

Checking a cell for only Alphanumerical characters
 
Is it possible to check that a cell only contains Alphanumerical (a-Z, 0-9)?

--
Trefor

Harlan Grove[_2_]

Checking a cell for only Alphanumerical characters
 
"Trefor" wrote...
Is it possible to check that a cell only contains Alphanumerical
(a-Z, 0-9)?


Yes. The simplest way involves using a define name, ALPHANUM defined as

={"0";"1";"2";"3";"4";"5";"6";"7";"8";"9";"A";"B"; "C";"D";"E";"F";"G";"H";
"I";"J";"K";"L";"M";"N";"O";"P";"Q";"R";"S";"T";"U ";"V";"W";"X";"Y";"Z"}

and use formulas like

=SUMPRODUCT(LEN(x)-LEN(SUBSTITUTE(UPPER(x),ALPHANUM,"")))=LEN(x)



Trefor

Checking a cell for only Alphanumerical characters
 
Harlan,

Excellent thanks, did the trick just fine.

--
Trefor


"Harlan Grove" wrote:

"Trefor" wrote...
Is it possible to check that a cell only contains Alphanumerical
(a-Z, 0-9)?


Yes. The simplest way involves using a define name, ALPHANUM defined as

={"0";"1";"2";"3";"4";"5";"6";"7";"8";"9";"A";"B"; "C";"D";"E";"F";"G";"H";
"I";"J";"K";"L";"M";"N";"O";"P";"Q";"R";"S";"T";"U ";"V";"W";"X";"Y";"Z"}

and use formulas like

=SUMPRODUCT(LEN(x)-LEN(SUBSTITUTE(UPPER(x),ALPHANUM,"")))=LEN(x)





All times are GMT +1. The time now is 09:42 PM.

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