Solved

Remove only Alpha Characters

Posted on 2015-01-09
7
131 Views
Last Modified: 2015-01-12
Hello,

i need help, i have the below code that somehow works through UDF. but what i need is a solution with formula.
that for example in Cell A1 if i have a string like this  Edward E%E-(510)-797-2145 @ %  then it extracts everything but the alphas and in A2 i need %-(510)-797-2145 @ %

is this possible with excel formula?

Function RemoveAlpha(cellInput) As String
           
    Set cellInput = Intersect(cellInput.Parent.UsedRange, cellInput)
    
    For i = 1 To Len(cellInput)
        Select Case Mid(cellInput, i, 1)
            Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, " ", "-", "/" ,"@" ,"%"
                Charval = Mid(cellInput, i, 1)
            Case Else
                Charval = ""
        End Select
    RemoveAlpha = RemoveAlpha & Charval
    Next i
        
End Function

Open in new window

0
Comment
Question by:Flora
7 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 40540837
I assume what you mean is, "I need something that works using only built-in Excel functions."

In which the answer is no, you need to stick with a UDF, which you can of course refer to in a formula.
0
 
LVL 25

Expert Comment

by:ProfessorJimJam
ID: 40540944
Thanks Patrick. I had faced similar question before. frankly, I did not know that it is not possible by built in formula.
0
 
LVL 6

Author Closing Comment

by:Flora
ID: 40540953
Thanks for clarification.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 39

Expert Comment

by:als315
ID: 40541061
Dear Flora. It is possible to do it witoout UDF, but there is one problem: you can't use cycles in formula, so you should analyze and replace each character in your string. Length of formula is limited, so you are also limited in string length.
Attached is sample for strings less then 30 symbols
Remove-alpha.xlsx
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 40541191
Or you can try

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"a",""),"b",""),"c",""),"d",""),"e",""),"f",""),"g",""),"h",""),"i",""),"j",""),"k",""),"l",""),"m",""),"n",""),"o",""),"p",""),"q",""),"r",""),"s",""),"t",""),"u",""),"v",""),"w",""),"x",""),"y",""),"z",""),"A",""),"B",""),"C",""),"D",""),"E",""),"F",""),"G",""),"H",""),"I",""),"J",""),"K",""),"L",""),"M",""),"N",""),"O",""),"P",""),"Q",""),"R",""),"S",""),"T",""),"U",""),"V",""),"W",""),"X",""),"Y",""),"Z","")

for any number of characters
0
 
LVL 39

Expert Comment

by:als315
ID: 40541709
Thanks, great idea. You can even simplify it:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LOWER(A1),"a",""),"b",""),"c",""),"d",""),"e",""),"f",""),"g",""),"h",""),"i",""),"j",""),"k",""),"l",""),"m",""),"n",""),"o",""),"p",""),"q",""),"r",""),"s",""),"t",""),"u",""),"v",""),"w",""),"x",""),"y",""),"z","")
0
 
LVL 6

Author Comment

by:Flora
ID: 40544552
thank you very much als315 and Saqib
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question