Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a cell which contains a mix of letters and numbers. I want to remove all the none numeric characters to give me the numbers.

    eg

    a 12 v would give 12
    3412 fgd would give 3412
    1234 would give 1234
    sdf would give blank


    I've thought about using substitution, but that would require lots of nested substitution functions to remove "a" then "b" then "c" etc

    Any thoughts of how I can do this WITHOUT using VB?

    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Assuming that there will only be one (contiguous) number part in the string, you can do this with a series of formulas, including some array formulas (confirmed with Ctrl+Shift+Enter). See the attached sample workbook.
    Attached Files Attached Files

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    There are probably nicer formulas but this seems to work (array-entered):
    =IF(ISNA(MATCH(TRUE,ISNUMBER(-MID(A1,ROW($1:$255),1)),0)),"",--MID(A1,MATCH(TRUE,ISNUMBER(-MID(A1,ROW($1:$255),1)),0),SUM(LEN(A1)-LEN(SUBSTITUTE(A1,{0,1,2,3,4,5,6,7,8,9},"")))))
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Many thanks

    I'll adapt it to work with what I need

    John

Posting Permissions

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