BOM Cost Roll-Up from a CSV
Operator: Abdulla Al Fahad. How tools are built and checked
One bill of materials has to answer three different questions: what a finished unit costs, how much of each part to order, and when the build can start. Each needs a different calculation over the same parent-and-component table, and shared sub-assemblies, scrap allowances and stock on hand make the by-hand version error-prone.
Give the page a table of parent, component and quantity per, optionally with unit, scrap percent, unit cost, lead time, stock on hand and labour or overhead per assembly, and it builds the multi-level tree, rolls cost up from the leaves, shows where any part is used, and works out what to buy for a build quantity.
Key features
- A loop in the BOM (B, then C, then B) is refused with the loop named, because a part cannot contain itself
- Cost per assembly split into material, labour and overhead, with shared sub-assemblies costed once
- An indented BOM for any top-level item or assembly, with quantities per root unit and extended costs
- Where-used for any part: direct parents, quantity per unit of each top-level item and every path up to the top
- A requirement explosion for a build quantity that subtracts stock on hand at every level, giving a purchase list, a build list and the purchase cost
- The critical-path lead time through items that still need action, plus CSV and XLSX export and a cost chart of the root's direct components
Columns, scrap rules, how shared sub-assemblies are costed and how the explosion nets stock
Each row says that one parent uses a quantity of a component. A component's unit, scrap, cost, lead time, stock and labour or overhead come from its first line; later lines that disagree on unit, cost or lead time raise a warning and the first line is used. Names are matched exactly, and names that differ only by capitalisation are reported as two parts. Cells like $12.50 or 5% are accepted; a quantity must be above 0. Up to 50,000 lines are read and the indented list stops at 20,000 lines.
Scrap can be applied two ways. Add scrap multiplies the quantity by 1 plus the scrap fraction, so 36 spokes with 5% become 37.8. Yield loss divides by 1 minus the fraction, which gives 37.89 and is the right rule when scrap is a share of what is started rather than of what is needed.
How it works
Cost is computed from the leaves up. A purchased part costs its unit cost; an assembly costs its labour and overhead plus, for each child, the scrap-adjusted quantity times the child's own rolled-up cost. Results are memoised per part, so the cost of a shared sub-assembly is computed once however many parents use it. An assembly's own unit cost, if it has one, is ignored and a warning says so.
The explosion visits parts in topological order from the root. For each part the net need is the gross need minus stock on hand, floored at zero, and only the net need is passed down to its components. Parts with a net need that have components go to the build list; the rest go to the purchase list, sorted by extended cost.
The critical path is the longest sum of lead times along a chain of parts that still need action, starting from the root, which is why a part you already have in stock does not add days.
Common use cases
- A purchasing planner turning a customer order for 250 e-bikes into a purchase list with stock netted off.
- Will a change in the price of one fastener move the cost of 14 assemblies? A cost accountant finds out with where-used.
- A small manufacturer finding out why the BOM export from a quoting tool contains a loop between a kit and its sub-kit.
- Add-scrap against yield-loss costing on a part with 8% scrap, compared by an engineer.
- A buyer reading the critical path to see which long-lead item sets the earliest build date.
How to use this tool
- Drop the BOM table, or load the bicycle example, and match the parent, component and quantity columns.
- Match the optional columns and choose the scrap rule.
- Pick the top-level assembly to show and read the indented BOM and the assembly costs.
- Enter a build quantity and read the purchase list, build list and critical path.
- Pick a part to see where it is used, then download CSV or XLSX.
Example
A bicycle assembler entering its six-line BOM and planning a build of 10 bicycles
parent,component,qty_per,unit,scrap_pct,unit_cost,lead_time_days,on_hand,labour_cost,overhead_cost
Bicycle,Frame,1,ea,2,85,10,3,0,0
Bicycle,Wheel assembly,2,ea,0,0,3,5,4,1
Bicycle,Brake set,1,ea,1,22,7,0,0,0
Wheel assembly,Rim,1,ea,0,14,12,4,0,0
Wheel assembly,Spoke,36,ea,5,0.18,6,100,0,0
Wheel assembly,Tire,1,ea,0,9.5,9,0,0,0Assembly costs, purchase list and critical path
Wheel assembly costs 35.304 (material 30.304, labour 4, overhead 1)
Bicycle costs 179.528 (material 169.528, labour 8, overhead 2)
Building 10: buy Frame 7.20, Brake set 10.10, Rim 11, Tire 15 and Spoke 467, purchase cost 1,214.76
Critical path 15 days: Bicycle, Wheel assembly (3 days), Rim (12 days)Common pitfalls
Stock on hand of a component is counted once, at the first assembly that needs it in the explosion, not split between competing orders.
The page does not model lot sizes, minimum order quantities, alternates or effectivity dates. It computes gross and net needs for one build.
Costs are in whatever currency your column uses; labour and overhead are per unit of the assembly, not per hour.
Net quantities are exact and never rounded up. Frame 7.20 in the example comes from 10 bicycles with 2% scrap less 3 in stock, and Brake set 10.10 from 1% scrap. Round to whole units, packs or minimum order quantities yourself before ordering, because the purchase cost is also computed on the fractional quantity.
- Give shared sub-assemblies one name everywhere. A second spelling creates a second part with its own cost.
- Use where-used on a component before changing its price, scrap or lead time; the table lists every top-level item it ends up in.
Common errors and how to fix them
- The BOM contains a loop: B -> C -> B. A part cannot be built from itself, directly or through other assemblies.
- Open the BOM at the parts named and remove the line that closes the loop.
- Row 12: "two" in quantity per is not a plain number.
- Use digits; the page accepts 12.5 but not words.
- Every part is used by another part, so there is no top-level assembly.
- The parent and component columns may be swapped, or the top assembly's line is missing.
- Row 9: both a parent and a component are needed.
- Fill the blank cell or delete the line.
Best practices
- Keep one line per parent and component pair. Two lines for the same pair add quantities in the tree but make the where-used paths harder to read.
- Enter stock only for items you will actually allocate to this build.
Checking the roll-up by hand
The numbers in the example can be reproduced on paper. A wheel assembly uses one rim at 14.00, 36 spokes at 0.18 with 5% scrap (36 x 1.05 x 0.18 = 6.804) and one tire at 9.50, so material is 30.304; adding 4 labour and 1 overhead gives 35.304. The bicycle needs a frame at 2% scrap (85 x 1.02 = 86.70), two wheel assemblies (70.608) and a brake set at 1% scrap (22.22), which sums to 179.528 with 8 labour and 2 overhead included.
The explosion for 10 bicycles follows from those costs: 20 wheel assemblies are needed and 5 are in stock, leaving 15; each needs 36 spokes at 5% scrap, so 567 spokes gross and 467 net after 100 in stock; 10 frames at 2% scrap is 10.2 gross and 7.20 after 3 in stock. A loop such as B to C to B is rejected by name before any costing starts.
Frequently asked questions
Can an assembly have its own purchase cost?
Its own unit cost is ignored, with a warning, because the cost of an assembly is rolled up from its parts plus its labour and overhead. Put an assembly's purchase price on a purchased-part line instead.
What does the build list contain?
Sub-assemblies that still have a net need after stock. They are manufactured, not bought, so they appear separately from the purchase list and their cost is already counted in the purchase list through their components.