+ Reply to Thread
Results 1 to 5 of 5

Select from drop down menu then assign unique sequence based on selection and year

  1. #1
    Registered User
    Join Date
    04-22-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Select from drop down menu then assign unique sequence based on selection and year

    I have 4 items in a drop-down menu:

    CEO
    CORPCOMMS
    AUDIT
    SE

    I need a unique number to be generated depending on which item is selected and depending on the year of the entry. For instance:
    • If in cell A1, I select CEO, I need a unique number to be generated in A2: 14-CEO-01; "14" is the year 2014;
    • If in cell B1, I select CEO again, B2 should have the number: 14-CEO-02;
    • If CORPCOMMS is selected in cell C1, C2 should automatically have the number: 14-CORPCOMMS-01;
    • CEO is selected again in cell D1, D2 will generate: 14-CEO-03;

    Let's assume there are 300 entries for CEO in 2014. The 301st CEO entry is in 2015, and the number to be generated for that would be: 15-CEO-01.

    Is this possible?

    Alternatively, I can ask the users to enter their unique ID manually, and then display the last entry for each selection in a table. For instance:

    CEO: 14-CEO-51
    CORPCOMMS: 14-CORPCOMMS-20
    AUDIT: 14-AUDIT-5
    SE: 14-SE-11

    I'm not sure how to do that either.

    Any help will be much appreciated.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,912

    Re: Select from drop down menu then assign unique sequence based on selection and year

    Copy this code, right-click the sheet tab, select "View Code" and paste the code into the window that appears. Any entry in row 1 will have an appropriately numbered entry placed into row 2.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    04-22-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Select from drop down menu then assign unique sequence based on selection and year

    Quote Originally Posted by Bernie Deitrick View Post
    Copy this code, right-click the sheet tab, select "View Code" and paste the code into the window that appears. Any entry in row 1 will have an appropriately numbered entry placed into row 2.

    Please Login or Register  to view this content.
    Hi there, thanks so much for the code! I tested it out and it works perfectly! However, I don't know how to modify it to fit the document I'm working with. For instance, the tracking number needs to appear in column C after the selection has been made in column A in the same row. Is it possible for me to send you what I have or will you be kind enough to help me modify the code such that the entries are all on column A and the tracking numbers will appear in Column C?

    I PM'ed you this alraedy but figured that others may benefit from your reply.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,912

    Re: Select from drop down menu then assign unique sequence based on selection and year

    This should work on values entered in column A, placing the coded entry in column C: one thing to note is that if you want to sort on the coded values, you should probably use 3 digits instead of two for the last number - just change Format(i, "00") to Format(i, "000")


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-22-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Select from drop down menu then assign unique sequence based on selection and year

    Thank you so much! I just tried it and it works flawlessly. You are awesome!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula based on drop down menu selection
    By danjpalmer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-21-2014, 03:45 PM
  2. Replies: 3
    Last Post: 01-31-2013, 06:22 PM
  3. Hide a row based on a drop down menu selection
    By AMechEng in forum Excel General
    Replies: 4
    Last Post: 06-20-2012, 03:57 AM
  4. Changing values based on drop down menu selection
    By henro8 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2010, 03:47 AM
  5. [SOLVED] Drop Down Lists - assign a value based on selection
    By Neil M in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-19-2005, 11:30 AM

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