View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kevin Vaughn Kevin Vaughn is offline
external usenet poster
 
Posts: 4
Default Is the first character a number or letter

You could make a slight modification to Harlan's formula which returned true
for alphanumeric,
=IF(COUNT(SEARCH(LEFT(A1,1),"0123456789ABCDEFGHIJK LMNOPQRSTUVWXYZ")),"alphan
umeric","not")

BTW, when I tested on my test data, which I created using the formula
=CHAR(ROW())&"123" (in a1:a255,) I got some false positives and not sure
why, and was not able to eliminate the false positives. They weren't the
same false positives as I was getting with my failed attempt using
=IF(OR(AND(LEFT(A1,1)="a",LEFT(A1,1)<="z"),AND(LE FT(A1,1)="A",LEFT(A1,1)<=
"Z")),"letter",IF(ISNUMBER(--(LEFT(A1,1))),"numeral","other")) (for the
earlier request. Note, I had read Ron Coderre's reply earlier which is
probably how I came up with the isnumber... part of the formula.)

BTW, on Harlan's earlier formula, it appears 81 should in actuality be 91:
=IF(LEFT(A1,1)<"",LOOKUP(CODE(LEFT(A1,1)),{0;48;5 8;65;91;97;123},{"other";"
numeral";"other";"letter";"other";"letter";"other" }),"")

--
Kevin Vaughn



"Sunrays17" wrote in message
ps.com...
On Jan 31, 12:25 am, Elkar wrote:
Could you give some examples of what you mean?



"Sunrays17" wrote:
Hi there...


i am looking forward to know is there any formula to know if a value
is alphanumeric too, as well as its a number or a letter...


Take care...
Sunrays17


On Jan 30, 11:41 pm, Elkar wrote:
This is a bit more involved, but this will also tell you if the first
character is something other than a letter or number.



=IF(A1="","",IF(AND(CODE(LEFT(A1,1))=48,CODE(LEFT (A1,1))<=57),"Number",IF(*
*OR(AND(CODE(LEFT(A1,1))=65,CODE(LEFT(A1,1))<=90) ,AND(CODE(LEFT(A1,1))=97*
,*CODE(LEFT(A1,1))<=122)),"Letter","Other")))

HTH,
Elkar


"bactfarmer" wrote:
I need a formula that tells you if the first character in a string

is
a number or a letter.


Thanks
Very Cunfused- Hide quoted text -- Show quoted text -- Hide quoted

text -

- Show quoted text -


Well... exactly don have any examples as i amjut trying it out...
but still...

consider A1 as "A155AbAAn", than giving
"=IF(A1="","",IF(AND(CODE(LEFT(A1,1))=48,CODE(LEF T(A1,1))<=57),"Number
",IF(**
OR(AND(CODE(LEFT(A1,1))=65,CODE(LEFT(A1,1))<=90), AND(CODE(LEFT(A1,1))
=97*,*CODE(LEFT(A1,1))<=122)),"Letter","Other")))" ,


the output is either "Letter", or "Number"....

if we can get "Aplhanumeric" tooo....


Regards,
Sunrays17