Aggregate Bill Of Material

Suhtka

New Member
Joined
Feb 19, 2016
Messages
8
Hi, I have a program that generates a cut list of materials depending on size and type of unit. Now the guys just take the files and manually aggregate it. I would like to do this programatically. I want to sum the quantity where the width, length, thick, and Matl. match. Red totals 20 parts. I would send the file but it seems I can't attach one.

Thank You!

[TABLE="width: 408"]
<tbody>[TR]
[TD]ITEM[/TD]
[TD]QTY[/TD]
[TD]WIDTH[/TD]
[TD]LENGTH[/TD]
[TD]THICK[/TD]
[TD]MATL[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]4[/TD]
[TD]23 [/TD]
[TD]42 [/TD]
[TD] 13/16[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]26 3/8[/TD]
[TD]32 7/8[/TD]
[TD] 3/4[/TD]
[TD]Oak Ply[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]16 3/4[/TD]
[TD]32 7/8[/TD]
[TD] 3/4[/TD]
[TD]Oak Ply[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]32 3/8[/TD]
[TD] 3/4[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]2 3/4[/TD]
[TD]32 3/8[/TD]
[TD] 3/4[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]2[/TD]
[TD]1 1/2[/TD]
[TD]32 3/8[/TD]
[TD] 3/4[/TD]
[TD]Birch Ply[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]4[/TD]
[TD]1 3/4[/TD]
[TD]32 3/8[/TD]
[TD] 3/4[/TD]
[TD]Birch Ply[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]9 1/2[/TD]
[TD]1 1/4[/TD]
[TD]Hardwood[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]4[/TD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TD] 13/16[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[TD]26 3/8[/TD]
[TD]64 7/8[/TD]
[TD] 3/4[/TD]
[TD]Oak Ply[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]4[/TD]
[TD]16 3/4[/TD]
[TD]64 7/8[/TD]
[TD] 3/4[/TD]
[TD]Oak Ply[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4[/TD]
[TD]3[/TD]
[TD]64 3/8[/TD]
[TD] 3/4[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD]2 3/4[/TD]
[TD]64 3/8[/TD]
[TD] 3/4[/TD]
[TD]Solid Ash[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]4[/TD]
[TD]1 1/2[/TD]
[TD]64 3/8[/TD]
[TD] 3/4[/TD]
[TD]Birch Ply[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]8[/TD]
[TD]1 3/4[/TD]
[TD]64 3/8[/TD]
[TD] 3/4[/TD]
[TD]Birch Ply[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]9 1/2[/TD]
[TD]1 1/4[/TD]
[TD]Hardwood[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]8[/TD]
[TD]1 1/2[/TD]
[TD]19 1/2[/TD]
[TD] 3/4[/TD]
[TD]Birch Ply[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]4[/TD]
[TD]14 1/2[/TD]
[TD]61 3/8[/TD]
[TD] 1/2[/TD]
[TD]CDX Plywood[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try this for results on sheet2.
Rich (BB code):
Sub MG03Nov36
Dim Rng As Range, Dn As Range, n As Long, txt As String, Ac As Long
Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
ReDim ray(1 To Rng.Count, 1 To 6)
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
    txt = Dn.Offset(, 2).Value & "," & Dn.Offset(, 3).Value & "," & _
        Dn.Offset(, 4).Value & Dn.Offset(, 5).Value
    If Not .Exists(txt) Then
        n = n + 1
        For Ac = 1 To 6
            ray(n, Ac) = Format(Dn.Offset(, Ac - 1), "@")
        Next Ac
        .Add txt, n
    Else
        ray(.Item(txt), 2) = ray(.Item(txt), 2) + Dn.Offset(, 1)
    End If
Next
End With
With Sheets("Sheet2").Range("A1").Resize(n, 6)
.Value = ray
 .Borders.Weight = 2
  .Columns.AutoFit
End With
End Sub
Regards Mick
 
Last edited by a moderator:
Upvote 0
Hi, I have a program that generates a cut list of materials depending on size and type of unit. Now the guys just take the files and manually aggregate it. I would like to do this programatically. I want to sum the quantity where the width, length, thick, and Matl. match. Red totals 20 parts. I would send the file but it seems I can't attach one.

Thank You!

ITEMQTYWIDTHLENGTHTHICKMATL
1423 42 13/16Solid Ash
2226 3/832 7/8 3/4Oak Ply
3216 3/432 7/8 3/4Oak Ply
42332 3/8 3/4Solid Ash
522 3/432 3/8 3/4Solid Ash
621 1/232 3/8 3/4Birch Ply
741 3/432 3/8 3/4Birch Ply
8429 1/21 1/4Hardwood
941 1/219 1/2 3/4Birch Ply
10214 1/229 3/8 1/2CDX Plywood
1423 42 13/16Solid Ash
2226 3/846 7/8 3/4Oak Ply
3216 3/446 7/8 3/4Oak Ply
42346 3/8 3/4Solid Ash
522 3/446 3/8 3/4Solid Ash
621 1/246 3/8 3/4Birch Ply
741 3/446 3/8 3/4Birch Ply
8429 1/21 1/4Hardwood
941 1/219 1/2 3/4Birch Ply
10214 1/243 3/8 1/2CDX Plywood
1823 42 13/16Solid Ash
2426 3/852 7/8 3/4Oak Ply
3416 3/452 7/8 3/4Oak Ply
44352 3/8 3/4Solid Ash
542 3/452 3/8 3/4Solid Ash
641 1/252 3/8 3/4Birch Ply
781 3/452 3/8 3/4Birch Ply
8829 1/21 1/4Hardwood
981 1/219 1/2 3/4Birch Ply
10414 1/249 3/8 1/2CDX Plywood
1823 42 13/16Solid Ash
2426 3/864 7/8 3/4Oak Ply
3416 3/464 7/8 3/4Oak Ply
44364 3/8 3/4Solid Ash
542 3/464 3/8 3/4Solid Ash
641 1/264 3/8 3/4Birch Ply
781 3/464 3/8 3/4Birch Ply
8829 1/21 1/4Hardwood
981 1/219 1/2 3/4Birch Ply
10414 1/261 3/8 1/2CDX Plywood

<tbody>
</tbody>
hi could repost or msg the working code please. i am getting error, subscript out of range
 
Upvote 0
If you are referring to the code in post#4 try copying it again, I have removed the bb code.
 
Upvote 0
Thanks Fluff, i tried, it worked. But not as desired. The output throws nearly 30 rows in sheet2, instead of summing up the qty of unique materials. Could you please check on this.
 
Upvote 0
In that case I suggest that you start a new thread, providing some more information, along with some data.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top