+ Reply to Thread
Results 1 to 4 of 4

Replace a * with Numbers

  1. #1
    Registered User
    Join Date
    08-25-2008
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    80

    Replace a * with Numbers

    I have a list of about 1,000 numbers with the following formats:

    4010*0
    1100*200
    1100*10

    That covers pretty much all of them. They all begin with 4 numbers, followed by a *, then have either 1, 2 or 3 numbers. I need to turn each of them into 7 digit numbers, without the *. Whatever it begins with are the first numbers, and whatever it ends with are the last numbers, and however many numbers it is short of 7 are all 0's in between the first and last numbers (basically the 0's replace the *). So the ones listed above would become:

    4010000
    1100200
    1100010

    Is there a formula I could use for all of these? I have quite a few of them and am hoping there is a way to get around typing them all.

    Thanks!

  2. #2
    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: Replace a * with Numbers

    Maybe, with your data in A2 down
    Please Login or Register  to view this content.
    Drag/Fill Down.
    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.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,822

    Re: Replace a * with Numbers

    Assuming the first one is in A1, put this formula in B1:

    =LEFT(SUBSTITUTE(A1,"*","")&REPT("0",3),7)

    This will return a text value. If you want it to be a number then you can do this:

    =LEFT(SUBSTITUTE(A1,"*","")&REPT("0",3),7)*1

    Then copy this formula down and fix the values, then you can get rid of column A.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    08-25-2008
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    80

    Re: Replace a * with Numbers

    Worked like a charm! I really appreciate the help from both of you!

+ 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