Extract letters only

Jborg

Board Regular
Joined
Feb 3, 2012
Messages
180
Office Version
  1. 365
Platform
  1. Windows
Hi Guys!!

Is there a way to extract only the letters with a formula??


35cht654ghy7656fdse


<colgroup><col style="width: 48pt;" width="64">
<tbody>

</tbody>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
It would work with a macro function :

Function extract_letters(ByVal CurrString As String)


Dim i As Integer


extract_letters = ""


For i = 1 To Len(CurrString)


If Not (IsNumeric(Mid(CurrString, i, 1))) Then extract_letters = extract_letters & Mid(CurrString, i, 1)


Next i


End Function
 
Upvote 0
Thanks Jacque.....you have been very helpful and fast, but i am not good in VBA. Is there a way with a fromula??
 
Upvote 0
With a UDF:
Code:
Function ExtractLetters(r As String) As String
With CreateObject("vbscript.regexp")
    .Pattern = "[^A-Za-z]"
    .Global = True
    ExtractLetters = .Replace(r, "")
End With
End Function
Excel Workbook
AB
135cht65cht
24ghy765ghy
36fdsefdse
Sheet1


If a native formula is possible at all, then we need to know if your sample is truly representative of your data. Is text always preceded by numbers, with or without numbers after it? Is that the only place the text will appear? etc.
 
Upvote 0
Thanks Jacque.....you have been very helpful and fast, but i am not good in VBA. Is there a way with a fromula??

Without VBA, I think it would be rather difficult.

But with vba, it is not complicated, you just have to do the following :
ALT + F11 (opens the VBA editor)
then in the menu, Insert > module
then just copy paste in the module you just created the code I gave you

an then, back in Excel, use the function extract_letters just like any other function
 
Upvote 0
Hi Scott

Sorry to have mixed you up.

Real text should read:
00120John0024
00121Steve0025
00122Karl0026

and so on.

Thanks for your great help
 
Upvote 0
Here is a non-VBA formula, brute force:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9",""),"0","")
 
Upvote 0
Thanks Jacques....You have been great. I managed at last.

This is great!!!!
 
Upvote 0

Forum statistics

Threads
1,203,453
Messages
6,055,530
Members
444,794
Latest member
HSAL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top