+ Reply to Thread
Results 1 to 7 of 7

Remove characters in cells that "may" contain

  1. #1
    Registered User
    Join Date
    12-09-2012
    Location
    spokane
    MS-Off Ver
    Excel 2010
    Posts
    25

    Remove characters in cells that "may" contain

    Hello again excel experts,

    I have another request, I have a column that receives data from another source. Some of the data includes "wp05" in the beginning, so I need that deleted in cells located within a column. Now other cell use this cell as a reference in a index and match function. I'm using =right(e3,Len (e3)-5)

    WP05 201302500
    WP05 201309700
    201304600
    201307700
    WP05 20138800
    201302212

    If I use this formula in all cells I get;

    201309700
    4600

    What would the formula be not to remove 5 characters in a cell that didn't have "WP05"

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Remove characters in cells that "may" contain

    Try
    =TRIM(SUBSTITUTE(A1,"WP05",""))
    Does that work for you?
    IF you want it to be recognized as a number (if they will all be numbers when done)
    =TRIM(SUBSTITUTE(A1,"WP05",""))+0
    Last edited by ChemistB; 02-26-2013 at 03:55 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Remove characters in cells that "may" contain

    jusy fyi =if(left(e3,5)="wpo5 ",right(e3,Len (e3)-5),e3)
    the substitute() version is better
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    12-09-2012
    Location
    spokane
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Remove characters in cells that "may" contain

    Thanks a lot you guys that works great.

    What if? The "WP05 012675" was actually a result of a formula? I tried your formulas nothing happened.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Remove characters in cells that "may" contain

    Shouldn't matter if it's the result of a formula. Can you upload an example? (Go Advanced > Manage Attachments)

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Remove characters in cells that "may" contain

    I'd guess
    =TRIM(SUBSTITUTE(your formula,"WP05",""))

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Remove characters in cells that "may" contain

    I copied the data and tried the formulae and they worked perfectly. Perhaps in the WP05 the 0 (zero) might be an O (letter).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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