+ Reply to Thread
Results 1 to 7 of 7

Generate new commodity code

  1. #1
    Registered User
    Join Date
    02-22-2009
    Location
    MORRISTOWN, NJ
    MS-Off Ver
    MICROSOFT 365
    Posts
    60

    Generate new commodity code

    I need to generate NEW COMMODITY CODES (Column I).

    Cell I29 correctly displays the commodity code generation scheme which should use the 4-digit Sub-Category Code as the number prefix and add 4 digits in sequential order (i.e. 0001, 0002) for each new commodity code.

    When I attempted to create a formula that looks at the row above, it did not properly generate the new commodity code. As you can see the rows are not in numerical order and are filtered (not sure if that's the reason why the formula doesn't work when looking at the row above).

    If done correctly, Row I71 would stay as is, and Row I79 would end in 11020002, and I84 would end in 11020003.

    Your assistance in a formula that will generate the new commodity codes for COLUMN I is greatly appreciated.

    Thanks you.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by COGICPENNY; 11-20-2015 at 04:29 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Generate new commodity code

    We can't do much with a picture - please attach a sample workbook instead.

    Pete

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Generate new commodity code

    Without a sample worksheet, but try to guess:

    In I46:

    =F46&TEXT(COUNTIF($F$1:F46,F46),"0000")

    or:

    =IF(F46="","",F46&TEXT(COUNTIF($F$1:F46,F46),"0000")

    Drag down.
    Quang PT

  4. #4
    Registered User
    Join Date
    02-22-2009
    Location
    MORRISTOWN, NJ
    MS-Off Ver
    MICROSOFT 365
    Posts
    60

    Re: Generate new commodity code

    Hi,

    The formula almost worked but out of nowhere created the ending "0017" for the first instance of a new commodity code combination (should have been 001).

    I am attaching a sample spreadsheet. Can't find where to attach it so I'll try to edit the original post and attach it there.

    Thank you!

    Penny

  5. #5
    Registered User
    Join Date
    02-22-2009
    Location
    MORRISTOWN, NJ
    MS-Off Ver
    MICROSOFT 365
    Posts
    60

    Re: Generate new commodity code

    I attached the sample spreadsheet.

    Thanks,
    Penny
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Generate new commodity code

    Is this what you expected?

    Using formula previously supplied.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-22-2009
    Location
    MORRISTOWN, NJ
    MS-Off Ver
    MICROSOFT 365
    Posts
    60
    Quote Originally Posted by JohnTopley View Post
    Is this what you expected?

    Using formula previously supplied.
    I think this works! Looks like the only reason why I95 wasn't sequential is because I didn't sort by commodity name first, but that's not important as long as the codes didn't repeat. Thank you!

+ 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. Forecast commodity price cycle - Time and price variables
    By Carlito Riego in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2015, 09:53 AM
  2. Find conflicts within the same commodity number
    By COGICPENNY in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-07-2015, 04:02 PM
  3. [SOLVED] Loop for calculating the sales for a given area and a commodity
    By crr.potluri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2013, 11:44 PM
  4. [SOLVED] VBA code to generate Y or N in cells
    By Jim885 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-07-2013, 09:55 PM
  5. VBA code to generate Autonumber
    By ActualReality in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2012, 08:49 PM
  6. Feed .csv table into master ledger commodity prices
    By ccampb1346 in forum Excel General
    Replies: 2
    Last Post: 05-08-2012, 02:50 PM
  7. Commodity Trading? Solver maybe....
    By bonjella in forum Excel General
    Replies: 3
    Last Post: 06-08-2005, 01:05 PM

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