Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Letter recognition

Is there a simple formula that can recognised the first character in a cell
as being a letter as opposed to a number or symbol?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Letter recognition

one way

IsNumeric(Left(Range("A1").Value, 1))
will be true if the first character is a number, false if it's a character



--


Gary


"General" wrote in message
...
Is there a simple formula that can recognised the first character in a cell
as being a letter as opposed to a number or symbol?

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Letter recognition

Hi General,

Try:

'=============
Public Function IsFirstAlpha(sStr) As Boolean
Dim iAsc As Long

iAsc = Asc(Left(sStr, 1))

IsFirstAlpha = iAsc = 65 And iAsc <= 90 _
Or iAsc = 97 And iAsc <= 122
End Function
'<<=============

The function may be used from VBA:

'=============
Public Sub TestIt()
MsgBox IsFirstAlpha("ABC123")
End Sub
'<<=============

Alternatively, it may be used in Excel as a user
defined function (UDF):

=IsFirstAlpha(A1)


---
Regards,
Norman


"General" wrote in message
...
Is there a simple formula that can recognised the first character in a
cell
as being a letter as opposed to a number or symbol?

Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
letter recognition in drop down lists henben Excel Discussion (Misc queries) 1 September 8th 09 07:57 PM
Adding a number to a letter of the alphabet to get a letter [email protected] Excel Worksheet Functions 5 May 21st 07 04:25 PM
New Validation option to format 1st letter as Capital letter Jeff Excel Discussion (Misc queries) 5 July 13th 06 05:11 AM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM
press letter and go 2 entry begin w letter in data validation drop MCP Excel Programming 1 August 28th 04 05:07 PM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"