Extract letters from cell

Fin Fang Foom

Well-known Member
Joined
Mar 20, 2005
Messages
598
Hi everyone,



I would like a formula to extract all letters in a cell but in that cell it also has numbers. I would like to extract the letters only.


Example:
HYPHEN2.xls
ABCD
1Extract letters
21f2d4g1g56gfdggg
3z1g5gzgg
4\g1h5gfghgf
5214g21g5gggg
62n5gng
7g7h69l;f9d2cw1gghdcwg
8f1ZZfZZ
912348548opop
10urrttq89urrtq
11
12
Sheet2
 
Define String

Refers to box:=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Sheet2!$A18,1,""),2,""),3,""),4,""),5,""),6,""),7,"")

In C2,

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(String,8,""),9,""),0,""),"\",""),";",""),"/","")

Expanding on this :-

Instead of the long formula in C2, this could also be assigned to a Name and referred to by the other Named formula.

To make it easier to set up, here's a macro to create the two names.
It only needs to be run once and then it can be deleted.

Code:
Sub Add_Names()
ActiveWorkbook.Names.Add Name:="Nbr2", RefersToR1C1:= _
"=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(RC[-1],0,""""),1,""""),""\"",""""),"";"",""""),"":"",""""),""/"","""")"
ActiveWorkbook.Names.Add Name:="Nbr", RefersToR1C1:= _
    "=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Nbr2,2,""""),3,""""),4,""""),5,""""),6,""""),7,""""),8,""""),9,"""")"
End Sub

In the cell immediately to the right of the cell with the alpha-numeric data enter =Nbr
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

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