Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a simple udf that will return the position of the first non-numeric
character in a string. Put it in a standard code module and use it like this in a cell. =mid(a1, firstletter(a1), 1) Public Function FirstLetter(ByVal InputString As String) As Integer Dim lngCounter As Long Dim lngStringLength As Long Dim lngReturnValue As Long lngReturnValue = -1 lngStringLength = Len(InputString) For lngCounter = 1 To lngStringLength If Not IsNumeric(Mid(InputString, lngCounter, 1)) Then lngReturnValue = lngCounter Exit For End If Next lngCounter FirstLetter = lngReturnValue End Function -- HTH... Jim Thomlinson "J.W. Aldridge" wrote: Hi, I have a list of codes in column A. I need to extract the first four letters in every row (disregaurding any numbers or spaces) and paste them in the same adjacent row in column C. I also need to do the same for column B to D. CODE EXTRACTED VALUE 00APPLES APPL APPLE APPL APPLE APPL 12313APPL APPL .....APPLES APPL Thanx |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract Uppercase Letters | Excel Programming | |||
Extract Capital Letters | Excel Discussion (Misc queries) | |||
Extract two letters | Excel Discussion (Misc queries) | |||
Extract letters from a cell | Excel Worksheet Functions | |||
How will I do Excel user-defined function to extract letters from string | Excel Programming |