Excel Guides

How to Count Packaging Costs Once per Shipment in Excel

One shipment has three sales lines and uses $4.25 of packaging. Join that shipment cost to the sales lines and sum the result, and Excel reports $12.75. Each sales row inherited the full cost. To get the shipment’s contribution, total the sales lines and packaging events separately before combining them.

An Odoo user raised a related question about tracking box sizes, material costs and reusable packaging returns per delivery. Start with your shipping system’s delivery and package records. Odoo 19 documents how one delivery can span multiple packages. The example below works from a prepared export of actual packaging events. Odoo’s multi-package documentation.

Use one row per shipment for the result

Keep three tables. The sales table has one row per sales line, the packaging table one row per issue or approved return, and the shipment register one row per shipment. In Power Query, group sales and validated packaging separately by Shipment ID, then left-merge those summaries onto the shipment register. Keep the completeness flag. An empty match means zero cost only when you know the packaging log is complete. Microsoft’s merge guide.

Copy the synthetic USD data

Import the following blocks at A1 on sheets called Sales, Packaging and Shipments, in that order. This fictional snapshot uses USD throughout. It leaves freight, discounts, tax and product returns outside the contribution calculation.

ShipmentID,RevenueUSD,ProductCostUSD,SalesLineID
S01,100,70,L01
S01,120,80,L02
S01,80,60,L03
S02,120,80,L04
S03,80,60,L05
S03,120,90,L06
S04,100,60,L07
EventID,ShipmentID,Material,Type,Quantity,UnitCostUSD,OriginalIssue
P01,S01,Small box,Issue,2,2,
P02,S01,Flyer,Issue,1,0.25,
P03,S02,Large box,Issue,1,4,
P04,S02,Flyer,Issue,1,0.25,
P05,S03,Reusable crate,Issue,1,5,
P06,S03,Reusable crate,Return,1,5,P05
P07,S03,Flyer,Issue,1,0.25,
ShipmentID,PackLogComplete
S01,Yes
S02,Yes
S03,Yes
S04,No

Validate returns before signing the cost

Review duplicate line, event and shipment IDs before calculating. Check that each event’s shipment exists, quantities and unit costs are numeric, and each approved return links to one original issue for the same shipment and material at the original unit cost. Across all returns linked to that issue, quantity returned cannot exceed quantity issued. P06 passes these checks against P05. Use the formula below only on checked rows. Put it in Packaging H2 and fill down to H8.

=IF(D2="Return",-E2*F2,E2*F2)

Calculate contribution on the shipment sheet

Put the next six formulas in Shipments C2 through H2, then fill down to row 5. They give revenue, product cost, net packaging, contribution, sales-line count, and the packaging total you would get by repeating the whole charge across those lines. Resize the ranges for your own export.

=SUMIF(Sales!$A$2:$A$8,A2,Sales!$B$2:$B$8)
=SUMIF(Sales!$A$2:$A$8,A2,Sales!$C$2:$C$8)
=IF(B2="Yes",SUMIF(Packaging!$B$2:$B$8,A2,Packaging!$H$2:$H$8),"Pending")
=IF(ISNUMBER(E2),C2-D2-E2,"Pending")
=COUNTIF(Sales!$A$2:$A$8,A2)
=IF(ISNUMBER(E2),E2*G2,"Pending")

On Shipments, use the next four formulas for confirmed packaging, confirmed contribution, repeated packaging, and the full contribution if every shipment is complete.

=SUM(E2:E5)
=SUM(F2:F5)
=SUM(H2:H5)
=IF(COUNT(F2:F5)=ROWS(F2:F5),SUM(F2:F5),"Pending")
ShipmentRevenue (USD)Product cost (USD)Packaging (USD)Contribution (USD)
S01$300.00$210.00$4.25$85.75
S02$120.00$80.00$4.25$35.75
S03$200.00$150.00$0.25$49.75
S04$100.00$60.00PendingPending

S01 through S03 contribute $171.25 after $8.75 of net packaging. Repeating each shipment’s packaging across its sales lines doubles the packaging amount to $17.50. S04 has $100 in revenue and $60 in product cost, but its packaging log is incomplete, so full contribution stays pending.

In Jolene.pro, ask which shipment IDs account for the gap between the two packaging totals and which event rows support the crate return. Follow the citations to the original issue, return and shipment completeness cells. Save the check to rerun on the next comparable shipment export. A live Jolene.pro result was not verified for this example.

For packaging losses on the production floor, see how to find runs with high packaging scrap.

Leave a comment