+ Reply to Thread
Results 1 to 8 of 8

Advanced find and replace specific text within a cell

  1. #1
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Advanced find and replace specific text within a cell

    In column F Ive got a list of skus which look similar to this - DEC-RAINB-0916-1

    At the end of every one is a number from 1 to 50. I want to make it so that the single numbers (ie 1-9 still have two numbers so 01, 02, 03). Obviously if I do a simple find and replace it will mess up the two figure numbers too (ie find 1 and replace with 01 will also change the number 10 to 010). Is there an easy way around this?

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced find and replace specific text within a cell

    Hi,
    Put your test in A1 and try this formula on it
    Please Login or Register  to view this content.
    This will use the last digit of your sku and return a sku with a 2 digit (really text) ending.
    Note you will have to adjust to work with col F and a zero on the last digit will need to be included in the choose function.

    Also - I hope you don't have a 2 digit on the end of you sku's

    hope this works for you.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  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: Advanced find and replace specific text within a cell

    Here's a bit of a mouthful
    In a spare column row #2, with your data beginning F2
    Please Login or Register  to view this content.

    This should work for any amount of digits after the last hyphen

    @ Marvin
    I can't get your formula to run past -9
    Attached Files Attached Files
    Last edited by Marcol; 03-26-2011 at 01:49 PM. Reason: Added example attachment
    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.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced find and replace specific text within a cell

    I thought he had only a single digit (1 to 9) as the question. If he had stuff after the dash like "-43" I'd return a "-403".

    The Choose shouldn't work after 9 as there are only 9 choices. After posting it I realized I didn't cover the digit of zero. I should have really done a:
    Please Login or Register  to view this content.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced find and replace specific text within a cell

    OK how about this formula that should put a zero in front of those single digit last numbers and leave the 2 digit ones alone.
    Please Login or Register  to view this content.
    I hope this is better than my last choose function.

  6. #6
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: Advanced find and replace specific text within a cell

    Quote Originally Posted by MarvinP View Post
    OK how about this formula that should put a zero in front of those single digit last numbers and leave the 2 digit ones alone.
    Please Login or Register  to view this content.
    I hope this is better than my last choose function.
    Ive been on holiday so havent tried these yet but I think this last one sounds the most promising as there are two digits also ie 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 etc up to 50 so I only want to add the zero before the single digits 1-9 - Ill give them a go when I get back to the office later today and let you know how I get on.

  7. #7
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Advanced find and replace specific text within a cell

    Perhaps this
    Please Login or Register  to view this content.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  8. #8
    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: Advanced find and replace specific text within a cell

    This might be simpler
    Please Login or Register  to view this content.

    [EDIT]
    If the suffix could be "-0" then
    Please Login or Register  to view this content.

    Hope this helps
    Last edited by Marcol; 04-14-2011 at 04:47 AM. Reason: Added safeguard formula

+ 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