Hi Steve,
Here is a user defined function that will do what you asked for
you will need to install the user defined function (UDF) and
use a helper column.
=AlphaWithDigits(A10)
=personal.xls!AlphaWithDigits(A10)
You asked to remove all spaces.
Function AlphaWithDigits(ByVal s As String) As String
'D.McRitchie, .excel, 2004-02-15 modified string for LIKE
'otherwise is same as a posting
'by Harlan Grove, worksheet.functions, 2003-10-20
Dim i As Long, n As Long
n = Len(s)
For i = 1 To n
If Not Mid(s, i, 1) Like "[0-9 A-Z a-z]" Then Mid(s, i, 1) = " "
Next i
AlphaWithDigits = Application.WorksheetFunction.Substitute(s, " ", "")
End Function
If you decided to retain a representative existing space between words,
you would have to make a few changes.
=AlphaWithDigitsSpaces(A10)
=personal.xls!AlphaWithDigitsSpaces(A10)
Function AlphaWithDigitsSpaces(ByVal s As String) As String
'D.McRitchie, .excel, 2004-02-15 modified string for LIKE
'otherwise is same as a posting
'by Harlan Grove, worksheet.functions, 2003-10-20
Dim i As Long, n As Long
n = Len(s)
For i = 1 To n
If Not Mid(s, i, 1) Like "[ 0-9A-Za-z]" Then Mid(s, i, 1) = "^"
Next i
AlphaWithDigitsSpaces = Application.Trim(Application.WorksheetFunction.Substitute(s, "^", ""))
End Function
I tried to gather Harlan's postings on Regular Expressions plus some
additional information he supplied me into a web page:
Extraction of a Group of Digits and Dashes, posted by Harlan Grove
http://www.mvps.org/dmcritchie/excel/grove_digitsid.htm
code in
http://www.mvps.org/dmcritchie/excel/code/digitsid.txt
To install see my Getting Started with Macros and User Defined Functions
http://www.mvps.org/dmcritchie/excel/getstarted.htm