About MrExcel
Consulting Services
Learn Excel Resources
Challenge of the Month
MrExcel Seminars

Message Board

MrExcel Store


Extracted from Message Board

Mike asks "Is there any way I can simply remove certain characters from a text string. For example, I have a post code BN19 4GX and I want to remove all numeric charaters to leave BN GX."

This is easier using VBA.

Go to the VB Editor (Alt + F11), go to Insert, Module. Paste this code in there.

Function RemoveNumeric(Rng As String) As String
Dim Tmp As String
Dim i As Integer

Tmp = Rng
For i = 0 To 9
Tmp = Application.Substitute(Tmp, i, "")
Next i
RemoveNumeric = Tmp
End Function

Now, back in Excel, if your initial text is in A1, put this formula where you want the result


and you'll get 'BN GX'. The function removes all numeric characters, that is, {0,1,2,3,4,5,6,7,8,9}, but can be adapted to substitute something else.

By Juan Pablo Gonzalez on 05-Feb-2002 Consulting can be hired to implement this concept, or many other cool applications, with your data. provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.


Excel is a registered trademark of the Microsoft® Corporation.

All contents Copyright 1998-2008 by MrExcel Consulting.