Sequential numbering based on information in another column

I'm trying to create a formula (preferably one that can be converted into a column formula) that will generate a sequential Change Order Number based on the position and number of times the Contract # is used in my sheet. I'm attaching a screenshot of what I need the finished product to look like. I'm sure I will need an auto number row in here somewhere and probably a helper column but this one's got me scratching my head.

Thanks for any help!


Tags:

Best Answer

  • heyjay
    heyjay ✭✭✭✭✭
    edited 02/14/24 Answer ✓
    ="CO-0" + COUNTIF([Contact #]$1:[Contact #]2, [Contact #]@row) + "-" + [Contact #]@row
    

    Some notes:

    1. You need to drag the formula from top. Start of range is anchored to Row 1, and End of range is range at row.
    2. The serial CO-0 will need a bit of tweaking to count with leading zeroes.

    Here's with the flexible leading zeroes up to 999

    ="CO-" + 
    IF(COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) < 10, "00", 
    IF(COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) < 99, "0", "")) + 
    COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) + 
    "-" + [Contact #]@row
    

    ...

Answers

  • heyjay
    heyjay ✭✭✭✭✭
    edited 02/14/24 Answer ✓
    ="CO-0" + COUNTIF([Contact #]$1:[Contact #]2, [Contact #]@row) + "-" + [Contact #]@row
    

    Some notes:

    1. You need to drag the formula from top. Start of range is anchored to Row 1, and End of range is range at row.
    2. The serial CO-0 will need a bit of tweaking to count with leading zeroes.

    Here's with the flexible leading zeroes up to 999

    ="CO-" + 
    IF(COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) < 10, "00", 
    IF(COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) < 99, "0", "")) + 
    COUNTIF([Contact #]$1:[Contact #]1, [Contact #]@row) + 
    "-" + [Contact #]@row
    

    ...

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!