+ Reply to Thread
Results 1 to 3 of 3

filtering out text from an alphanumeric string

Hybrid View

  1. #1
    Registered User
    Join Date
    10-04-2010
    Location
    Gurgaon
    MS-Off Ver
    Excel 2008 for mac
    Posts
    1

    filtering out text from an alphanumeric string

    Hi,

    I have a list of data pieces having a numeric character in the following format:

    9 dupont
    Reliance
    IBM 10
    Quest 11
    12
    Avon Corp 13
    .
    .
    .

    Can someone suggest a function to remove the numerals from the list and get the following output:

    dupont
    Reliance
    IBM
    Quest
    Avon Corp

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: filtering out text from an alphanumeric string

    A UDF like this would do the trick:

    Public Function NoNumbers(rngMyRange As Range) As String
    
    Dim lngMyCount As Long
    
    For lngMyCount = 1 To Len(rngMyRange)
       
        If Not IsNumeric(Mid(rngMyRange, lngMyCount, 1)) Then
             
            NoNumbers = NoNumbers & Mid(rngMyRange, lngMyCount, 1)
            
        End If
        
    Next lngMyCount
    
    NoNumbers = Trim(NoNumbers)
    
    End Function

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: filtering out text from an alphanumeric string

    Not sure about Mac2008, but this works in 2007

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A3,"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9",""),"0",""))

    There is a more "elegant" way, but I can't remember it, I'll keep on trying!

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1