+ Reply to Thread
Results 1 to 13 of 13

Create Flat BOM from indented BOM using macro/vba code

  1. #1
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Create Flat BOM from indented BOM using macro/vba code

    Hi,
    I am trying to create a flat Bill of Materials (BOM) from an indented bill of materials.
    The flat BOM of material should contain the list of all purchased parts required within the indented BOM.
    My difficulty is trying to exclude lines on the indented BOM that belong to a purchased item.
    I have attached a sample spreadsheet which contains an indented BOM and i have identified the lines i want to include in column A with explanation in column M.
    When going through the BOM, if the item is MAKE, then the components of the make item should be included if they are purchased.
    Basically my problem is trying to ignore the BOMs associated with purchased parts from the list.

    In the sample spreadsheet, the item on line 9 (12620200) is purchased, however it has a BOM. I do not want to include the any of the parts within the BOM of 12620200 in my flat BOM.
    in this example - i do not want to identify any part in lines 10 to line 30 in my flat BOM.
    line 9 is at level 4 within the BOM - as its purchased - i want to ignore the next set of lines until i reach a part with a level less than or equal to 4 (1, 2, 3 or 4).
    I want to apply this logic to all lines with the indented BOM.
    A purchased item with a BOM can appear at any given level within the BOM.
    I find the best method to understand the BOM structure is to look at one level at a time in sequence
    Filter on levels 1 & 2 to see parent with relevant child, the look at levels 1,2 & 3. Then look at levels 1, 2, 3 & 4 and so on until you are looking at all levels.
    Any help would be appreciated.

    SampleBOM.xlsx
    Last edited by haugheym; 01-02-2016 at 05:39 PM. Reason: added attachment

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Create Flat BOM from indented BOM using macro/vba code

    Hi, welcome to the forum

    I think you forgot to attach the file?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Re: Create Flat BOM from indented BOM using macro/vba code

    ExcelForumError.JPGI am getting error message when I try to attach file

    "underfinedYou do not have permissions to perform this action. Please refresh page and login before trying again"

    It loops when I click ok - I have to kill internet explorer to get out of loop.
    Attached Images Attached Images
    Last edited by haugheym; 01-02-2016 at 05:25 PM.

  4. #4
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Re: Create Flat BOM from indented BOM using macro/vba code

    attachmentSampleBOM.xlsx

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Create Flat BOM from indented BOM using macro/vba code

    Thanks for the file.

    FFiltering on Y/N produces a list that are all >=3 and BUY - is that what you want?

  6. #6
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Re: Create Flat BOM from indented BOM using macro/vba code

    I have manually input entries into column A to replicate what I want to achieve.
    unfortunately some of the purchased items have a BOM against them. I need to somehow hide these lines before I filter on the make/buy field.
    For example, If I come across a buy item at level 3, I want to mark the lines beneath that line until I come to another item at level 1, 2 or 3. All the lines directly beneath it at a level higher 4,5,6,7 etc.. are components of the buy item and therefore I don't want to included them in my flat BOM.
    You will see that some of the buy items on my flat BOM are at different levels.
    Last edited by haugheym; 01-02-2016 at 07:39 PM.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Create Flat BOM from indented BOM using macro/vba code

    So what would the rules be to selecting?

  8. #8
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Re: Create Flat BOM from indented BOM using macro/vba code

    Yes, I want to filter on column A for "Y". I am looking for the macro/code to input Y/N into column A.
    The BOM has multiple levels, starting at line 2, when I come to a BUY item I want to input "Y" in column A. However, if the BUY part contains components, I do not want to include the components of that BUY part, so if the BUY part is at level 3, i want to input "N" in column A until I get to the next part at Level 1, 2 or 3.

    In the sample spreadsheet, the item on line 9 (12620200) is purchased, I have input "Y" into column A for this line. however, from lines 10 to line 30 represent the components of the part on line 9. I do not want to include the any of the parts within my flat BOM..
    line 9 is at level 4 within the BOM - as its purchased - i want to ignore the next set of lines until i reach a part with a level less than or equal to 4 (1, 2, 3 or 4). So these lines have "N" in column A.
    I want to apply this logic to all lines with the indented BOM.
    Last edited by haugheym; 01-02-2016 at 08:48 PM.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Create Flat BOM from indented BOM using macro/vba code

    In the sample spreadsheet, the item on line 9 (12620200) is purchased, I have input "Y" into column A for this line
    why?

    I have this so far...
    IF(AND(D2<=3,E2="Buy"),"Y","N")
    Changing <=3 to <=4 fixes row 9 and some others, but then, you decide to include 5?
    What makes the rule change?

  10. #10
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    Re: Create Flat BOM from indented BOM using macro/vba code

    Sorry to join this:
    I modify FD's formula = IF(AND(D2<=4.1,E2="Buy"),"Y","N")

    but I found there's few more condition in below (if my guess is right )



    Regards,
    tt3
    Attached Files Attached Files

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Create Flat BOM from indented BOM using macro/vba code

    tuongtu3 no apologies needed - the more the merrier (maybe you can see something I missed)

  12. #12
    Registered User
    Join Date
    01-02-2016
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    6

    Re: Create Flat BOM from indented BOM using macro/vba code

    Hi,
    I have created a new spreadsheet that will hopefully illustrate how I want to identify whether or not to include that line.
    This may give you a better understanding of the issue.
    The indented BOM contains multiple levels, I am interested in identifying the lowest level purchased items within the BOM to give me a flat BOM.
    The issue is that some BUY items also have a BOM. I don't want to include any item within the BOM for the BUY items.
    I have created a workbook showing a sample of an indented BOM structure for making a car. The car consists of a DRIVER SIDE FRONT DOOR
    and a PASSENGER SIDE FRONT DOOR.
    The DRIVER SIDE FRONT DOOR consists of
    DOOR SKIN
    ELECTRICAL HARNESS
    DOOR FRAME
    WINDOW
    DOOR HANDLE
    LOCK MECHANISM
    INNER PANEL
    Looking at the individual parts, the ELECTRICAL HARNESS consists of a 1000MM LG BLUE WIRE which itself consists of
    BLUE WIRE
    MALE ELECTRICAL CONNECTOR
    FEMALE ELECTRICAL CONNECTOR
    Similarly the LOCK MECHANISM consists of a LOCK BAR which in turn consists of STEEL BAR
    CLIP
    and INNER PANEL consist of PVC PANEL.
    The PASSENGER SIDE FRONT DOOR has similar BOM.
    If I Make the DRIVER SIDE FRONT DOOR then the flat BOM for the DRIVER SIDE FRONT DOOR will contain
    Level makebuy Item UOM Quantity EXT QTY
    3 BUY DOOR SKIN EA 1.00 1
    5 BUY BLUE WIRE MTR 1.00 2
    5 BUY MALE ELECTRICAL CONNECTOR EA 1.00 2
    5 BUY FEMALE ELECTRICAL CONNECTOR EA 1.00 2
    3 BUY DOOR FRAME EA 1.00 1
    3 BUY WINDOW EA 1.00 1
    3 BUY DOOR HANDLE EA 1.00 1
    5 BUY STEEL BAR MTR 0.50 1
    5 BUY CLIP EA 4.00 8
    4 BUY PVC COVER EA 1.00 1
    However, If I later decide to buy the DRIVER SIDE FRONT DOOR, then none of the above would be included. only
    DRIVER SIDE FRONT DOOR itself.
    I am probably not explaining this very well, but the defining factor would be if a part is BUY, the BOM associated with the part should not be included - irrespective of whether or not the component part is BUY.
    In this instance - the DRIVER SIDE FRONT DOOR is at level 2 within the BOM. I want to flag the lines beneath this as "N" until I come to the next item which is at level 2 or less (L1 or L2)

    SampleBOMGraphic.xlsx

  13. #13
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    Re: Create Flat BOM from indented BOM using macro/vba code

    Hi Haugheym,
    Please try sample attached and hope it work. If it works then give big thank to "joe31623"

    ps: line 218 in your sample is wrong. You said N but it should be Y

    Regards,
    tt3
    Attached Files Attached Files
    Last edited by tuongtu3; 01-10-2016 at 03:30 AM.

+ 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. have code to create indented BOM. Need a small mod.
    By PeteABC123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2015, 05:20 PM
  2. [SOLVED] Excel macro to create a flat file?
    By jlang11 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2013, 03:05 PM
  3. Formula or VBA to fill down a hierarchy to create a flat file
    By bmb163 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-28-2012, 09:34 AM
  4. Hierarchy Indented List, Table, Column and Value - need to create uniqueid column
    By mcolli01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-06-2012, 01:09 PM
  5. Create flat file from data download
    By msmithdynamicsgp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2011, 09:54 PM
  6. VBA code for Conditional Loop on flat trades
    By ChristopherC in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2011, 09:14 PM
  7. Create Flat File from Macro
    By jackfsm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2009, 02:15 PM

Tags for this Thread

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