Results 1 to 3 of 3

Thread: autogenerate WO number
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Mar 2011
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default autogenerate WO number

    I need to autogenerate a number in a cell when other data in the row is filled out.

    Sheet is basically:


    Date Site Name several other columns of non relevant data Work Order Number


    I need the WO number to be in the following format:


    (4 digit site code)-1920-(next number for that site)


    I have another sheet with a table in it that shows:


    Site Name Site Code


    How can I pull the site code from one sheet into the number based on the site name from a previous column entry then add in the fiscal year reference and a numerical count of Work orders for that site?


    Thinking of adding a hidden column to change site name to site code then formula in the WO number column to read:

    =C2,-1920,countifs(C:C,site code 1, C :C, site code 2)

    Is that the correct use of the countif function? Is there an easier way? Perhaps a VB code with a variable that increases by one everytime the loop is run? We have over 25 site codes.

    How can I easily convert the site name to a site code based on the table in the other sheet?

  2. #2
    Board Regular Toadstool's Avatar
    Join Date
    Mar 2018
    Posts
    225
    Post Thanks / Like
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)

    Default Re: autogenerate WO number

    Hi Flyingfree,

    Here I've got the Site Name/Site Code table in the same sheet (columns G and H) but not as a table (it can of course be on another sheet and in an Excel Table so it auto-extends and you can use Names instead of references).

    When you enter a Site Name in column B then in column C it retrieves the Site Code from the table.

    Column D makes the WO code along the lines of your suggested formula but please note the mix of absolute and relative addresses in the COUNTIF so you get an ascending count.

    Cells C2 and D2 need to be copied and pasted down as far as the maximum row you'll ever use.

    NOTE: This is a calculated WO so if you change the data in any previous rows then it recalculates the WO numbers.

    B C D E F G H
    1 Site Name Site Code WO Site Name Site Code
    2 S1 0101 0101-1920-0001 S1 0101
    3 S2 0202 0202-1920-0001 S2 0202
    4 S1 0101 0101-1920-0002 S3 0303
    5 S1 0101 0101-1920-0003
    6 S2 0202 0202-1920-0002
    7 S1 0101 0101-1920-0004
    8 S1 0101 0101-1920-0005
    9 S1 0101 0101-1920-0006
    Sheet1

    Worksheet Formulas
    Cell Formula
    C2 =INDEX(Sheet1!$H$2:$H$30,MATCH(B2,Sheet1!$G$2:$G$30,0))
    D2 =IF(C2="","",C2&"-1920-"&TEXT(COUNTIFS($C$2:C2,C2),"0000"))
    Life advice found on a book of matches: "Keep cool. Keep away from children."

  3. #3
    New Member
    Join Date
    Mar 2011
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: autogenerate WO number

    INDEX...hmmm I shall have to look that command up, might come in handy another time. Thanks, I'll implement this and get back to you on the results.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •