Closed Thread
Results 1 to 10 of 10

How do you auto number?

  1. #1
    Registered User
    Join Date
    04-30-2007
    Posts
    1

    Question How do you auto number?

    I want to auto number a spreadsheet but I can't seem to get the formula right. I want to number the rows based on the neighboring cells. If the first name and last name match then number it the same then move on. Can someone help me in the right direction please? I would like the numbering to look like this:

    1 John Doe
    1 John Doe
    2 Jane Doe
    3 Frank Johnson
    4 Ralph Smith
    4 Ralph Smith
    4 Ralph Smith
    Last edited by xcentric; 04-30-2007 at 12:28 AM.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    This is one way to do it:

    I put a number 1 in the first row. Then in cell A2 (this is assuming the numbers are in column A, and names in B):

    Please Login or Register  to view this content.
    Try that and let me know if it works.

    EDIT to add: You can fill that formula down as far as necessary. If there is no name in the corresponding cell in column B, it will return blank.

  3. #3
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Increment by one

    If the names are entered in identical ways, meaning that John Doe is not written John, Doe or Doe, John, the below can be used.

    I let the names start in A1, so I put 1 in B1.
    Then I put =B1--(A1<>A2) in B2, and copy the formula downward.
    Done

    //Ola

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Quote Originally Posted by olasa
    If the names are entered in identical ways, meaning that John Doe is not written John, Doe or Doe, John, the below can be used.

    I let the names start in A1, so I put 1 in B1.
    Then I put =B1--(A1<>A2) in B2, and copy the formula downward.
    Done

    //Ola

    Please Login or Register  to view this content.
    Olasa.... Interesting formula; however, I don't think that would work if the names were out of order. For example, if John Doe was added again after Ralph Smith, it would assing him a brand new number. Is there a way around that using your setup.

  5. #5
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    ...assumption/method...

    Thanks BigBas, yea well they way xcentric presented the problem, I assumed he would sort the list, which would lead to no blanks. And it would help him keep a "consistancy"; 'John Doe' would not become 'John, Doe' or 'John Doe_'.

    xcentric has to answer but if the first assumption is wrong I would stick with your proposal* and if the second assumption is wrong I'd use the method of first clear all spaces and commas.

    But if the inconsistancy is - call it - 'level three difficulty', meaning 'John Doe could also be 'Doe, John ', the pattern recognition would have to be steped up bit more.

    But all in all, let's hope that one of the proposed options suit xcentric, and if not, we'll see if we can find another way.

    //Ola


    ...This line of resoning might help xcentric to forsee some future problems

    * ...BigBas I just read you last question, could my setup be used if John Doe was added at the end...sure if the formula (in B2) is changed to: =B1+MIN(--(A2<>$A$1:A1)) and entered as an 'array formula';
    xcentric: type the formula but don't hit enter. Instead hold down Ctrl and Shift and then hit Enter. If Excel now has added two squiggly brackets { } around the formula, it should work.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    in A2

    =IF(B2=B1,A1,A1+1)

    works for me.
    Last edited by mikerickson; 04-30-2007 at 09:31 PM.

  7. #7
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Quote Originally Posted by olasa
    * ...BigBas I just read you last question, could my setup be used if John Doe was added at the end...sure if the formula (in B2) is changed to: =B1+MIN(--(A2<>$A$1:A1)) and entered as an 'array formula';
    xcentric: type the formula but don't hit enter. Instead hold down Ctrl and Shift and then hit Enter. If Excel now has added two squiggly brackets { } around the formula, it should work.
    Ola... Your strength and understanding of the array formulas never ceases to amaze me. Nevertheless, your formula did not work for me (unless either we have a misunderstanding or I have done something wrong). Assuming the list is NOT sorted, let's use the data you have previously supplied. If John Doe repeats at the end of the list, out of order with the other John Doe, it does not assume the same number as previous John Doe. It is assigned the same number as the last entry. Does that make sense?

  8. #8
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Thanks but

    Thanks for the compliment BigBas, but I missed your point - that all John Doe should have the same number. I can hardly blame the IRS and late night for diverting my focus (it's due tomorrow here). So to do what your meant, I would basically use the same formula.

    //Ola

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-15-2010
    Location
    Atlanta, USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do you auto number?

    But my requirement is little different, please let me know how to do that.
    Here is the example
    Below Serial number column should come automatically and re-initialized when column A (Name) get changed.
    --
    Name Pay rate Serial no
    John 12 1
    John 13 2
    John 14 3
    Mike 10 1
    Mike 12 2
    Mike 14 3
    Mike 16 4
    Sam 10 1
    Sam 11 2
    --

    Thanks
    Sam

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How do you auto number?

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then start your own thread.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

Closed 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