+ Reply to Thread
Results 1 to 9 of 9

Flatten multilevel Bill of materials

  1. #1
    Registered User
    Join Date
    01-09-2023
    Location
    Roeselare
    MS-Off Ver
    365
    Posts
    4

    Flatten multilevel Bill of materials

    Hello,
    I have a Excel bill of material i can get out of Solidworks (3D design program).
    I either have the option to do this as parts only (without the subs) or full structure (as the example).
    I would like Excel to calculate every Doc Nr and quantity.
    Parts and subs can be have quantities that need to be multiplied to get a complete bom.

    example of what i would like to create: (column numbers in the example in brackets)

    level(A) docnr(C) quantity (N)
    1...........SW1...........1
    1.1........SW2...........2
    1.1.1.....SW3...........2
    2...........SW4...........2
    2.1........SW3..........4

    Export should be
    Docnr quantity

    SW1 1
    SW2 2
    SW3 8
    SW4 2

    is this feasable? can somebody put me in the right direction?
    Attached Files Attached Files
    Last edited by MerrinC; 01-09-2023 at 09:49 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    435

    Re: Flatten multilevel Bill of materials

    I do not think a VBA solution is necessary. Try this:

    On a new sheet, in Cell A1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    On that same sheet, in cell B2. Then copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-09-2023
    Location
    Roeselare
    MS-Off Ver
    365
    Posts
    4

    Re: Flatten multilevel Bill of materials

    Hey

    it doesn't multiply the multi level
    the example is would become

    SW1 1
    SW2 2
    SW3 4 (this needs to be 8 because its used 2 time in SW2 and 2 times in SW4 which are both used 2 times)
    SW4 2

    does that make any sense?

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Flatten multilevel Bill of materials

    I guess, SW3 - 12 (4 in SW4 x 2 SW4 + 2 in SW2 x 2 SW2)?
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  5. #5
    Registered User
    Join Date
    01-09-2023
    Location
    Roeselare
    MS-Off Ver
    365
    Posts
    4

    Re: Flatten multilevel Bill of materials

    yes, correct, i messed up

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Flatten multilevel Bill of materials

    First, you must fix the way you import the data, as for your current file, the column A is set as mixed data format (some as "Text", other as "Number") , this will ruin the calculation.
    For example, on cell A12, the value is "1.1", while it should be "1.10" (the zero is discarded by Excel, because Excel treat this cell as "Number")
    Other example, on cell A22, the value is "1.2", while it should be "1.20"
    .. etc --> I have fix the data and set the background cell as red, so you can see.

    After the data is cleaned up, you then can run this macro :
    Please Login or Register  to view this content.
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  7. #7
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,069

    Re: Flatten multilevel Bill of materials

    Try this,

    Helper column, Q2:=$N2*IFERROR(INDEX($N$2:$N2,XMATCH(--LEFT($A2,FIND(".",$A2)-1),--$A$2:$A2,0,-1)),1)*IFERROR(INDEX($N$2:$N2,XMATCH(--LEFT($A2,FIND(".",$A2,FIND(".",$A2)+1)-1),--$A$2:$A2,0,-1)),1)*IFERROR(INDEX($N$2:$N2,XMATCH(--LEFT($A2,FIND(".",$A2,FIND(".",$A2,FIND(".",$A2)+1)+1)-1),--$A$2:$A2,0,-1)),1), copy down

    S2:=UNIQUE(C2:C334) and T2:=SUMIFS($Q$2:$Q$334,$C$2:$C$334,S2#)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-09-2023
    Location
    Roeselare
    MS-Off Ver
    365
    Posts
    4

    Re: Flatten multilevel Bill of materials

    Hey,

    this works great!
    thank you!

  9. #9
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Flatten multilevel Bill of materials

    You are welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Bill of Materials / Macro VBA
    By mervecevik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2018, 08:03 AM
  2. Bill of Materials
    By DennisWA in forum Excel General
    Replies: 7
    Last Post: 11-27-2017, 06:05 PM
  3. Condensing Bill of Materials
    By AndyStanton in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-23-2016, 12:11 PM
  4. Help with Designing a Bill of Materials!
    By blakewalker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2012, 11:52 AM
  5. Bill of Materials
    By tonyhindmarsh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2007, 05:37 AM
  6. bill of materials
    By stevekirk in forum Excel General
    Replies: 7
    Last Post: 12-10-2006, 05:12 PM
  7. Bill of Materials / Router
    By MStim in forum Excel General
    Replies: 0
    Last Post: 09-14-2005, 10:05 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