Ask Experts Questions for FREE Help !
Ask
    joed123's Avatar
    joed123 Posts: 1, Reputation: 1
    New Member
     
    #1

    Apr 10, 2008, 01:55 AM
    Padding numbers in excel
    I have about 500,000 cells on a spreadsheet that all follow a letter and number pattern. There are two patterns that look like this:
    y124f07 and h67g02.

    So the first is:

    Letter, number, number, number, letter, number, number

    The second is:

    Letter, number, number, letter, number, number

    I need all of the patterns to follow the first pattern, so any time there are only two numbers between the two letters I need to ad a "0" before the first two numbers i.e.. Change h67g02 to h067g02 without changing y124f07 and without messing up the last two numbers (07 or 02). Please help. Thanks Joe
    KISS's Avatar
    KISS Posts: 12,510, Reputation: 839
    Uber Member
     
    #2

    Apr 10, 2008, 04:53 AM
    A couple of hints:

    1) Macro time
    2) The length of the string determines if the cell is affected.
    3) You can then split the string and add the character zero.
    KISS's Avatar
    KISS Posts: 12,510, Reputation: 839
    Uber Member
     
    #3

    Apr 10, 2008, 06:43 AM
    Here is the basic command you need to embed ina macro:

    =CONCATENATE(MID(C3,1,1),0,MID(C3,2,2),MID(C3,4,3) )

    Where C3 is a cell with a length of 6, len(C3)=6; e.g. h67q02

    It will make it h067q02

    Doing it a bit further:

    =IF(LEN(C3)=6,CONCATENATE(MID(C3,1,1),0,MID(C3,2,2 ),MID(C3,4,3)),C3)

    Will leave the cell alone if the length is not equal to 6.

    You may have to use a macro and create a totally different sheet because circular references are not allowed.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

MS Excel spreadsheet changing numbers [ 4 Answers ]

I have a spreadsheet where I enter credit card numbers, 16 digits. One note, I have the field setup as a custom format, that displays in the custom format as ####-####-####-####. This way it automatically adds the 4 dashes. For some reason, it always changes the last digit to zero. For...

Excel: Convert numbers to date [ 4 Answers ]

I'm using excel 07 and I have a cell containing the number 11291997 which represents 11/29/1997. How can I convert this to a date format. The 11291197 is number formatted. Any suggestions would help, thanks!

Phone numbers [ 3 Answers ]

Is there on the internet where you can lookup phone numbers for free and Not have to pay ANYTHING!

Laminate flooring double padding? [ 3 Answers ]

Hello, I am about to install laminate flooring on a 2nd floor condo. Can I install double padding Underneath to deaden/eliminate noise? Will it make a difference in noise for downstairs neighbors? Or is double padding not adviseable. Will there be any Con issues using two pads? I do plan on...


View more questions Search