Cellwise Start free

Excel guide · 5 min read

How to calculate cost per unit in Excel

Quick answerDivide the total cost by the number of units: =D2/C2. A $212.50 invoice for 500 mailer boxes is $0.425 per box. To include shipping, add it first: =(D2+E2)/C2. For the average cost across several orders, divide total cost by total units, =SUMIFS(D2:D8,B2:B8,"Mailer box")/SUMIFS(C2:C8,B2:B8,"Mailer box"), not the AVERAGE of each order's unit cost.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFGHI
1POItemUnitsInvoice totalFreightUnit costLabel roll price18.9
2PO-1180Mailer box500212.5180.425Labels per roll500
3PO-1186Tissue sheet2000969.50.048ItemMailer box
4PO-1194Mailer box1200465240.3875
5PO-1207Mailer box300141150.47
6PO-1213Tissue sheet1000529.50.052
7PO-1221Packing tape3679.202.2
8PO-1230Label roll56.76

Download this sheet as an Excel practice file (.xlsx)

Cost per unit for one purchase

The sheet is a small online shop's packaging purchases: the item, the number of units, the invoice total and the freight charged on each order. Column F holds =IF(C2>0,D2/C2,"") for every row. The IF stops a #DIV/0! on PO-1230, where the label rolls were received but the units have not been entered yet.

Format the unit cost with more decimals than you would use for a price. Packaging, ingredients and parts often cost fractions of a cent, and a 2-decimal format would show 0.43 here and hide the real number.

=D2/C2

Result: 0.425

0.425: each mailer box on PO-1180 cost 42.5 cents before freight.

Price per pack: convert to the unit you count

Suppliers often price per pack, case or roll, while you use single items. Divide the pack price by the number of items in the pack. A roll of 500 shipping labels for $18.90 is 0.0378 per label.

Decide on one unit and keep to it. If a recipe uses grams and the supplier sells by the kilo, or you sell single boxes but buy in bundles of 25, convert in a clearly labelled cell like I2 instead of typing the pack size inside a formula. Mixing per-pack and per-item costs in one column is the most common reason a margin looks far too good or far too bad.

=I1/I2

Result: 0.0378

0.0378: $18.90 per roll divided by 500 labels per roll.

Landed cost: include freight

What a unit really costs you includes getting it to you. Add the freight to the invoice before dividing: (D2+E2)/C2. On PO-1180 that moves the box from 0.425 to 0.461, an 8% difference, which matters when you set prices from it.

Freight on the invoice is the simple case. If one shipping charge covers several different items, split it by units (each item's units / total units * freight), or by value or weight if the items differ a lot in size. Write the rule down in a note next to the cell, because whoever updates the sheet next will have to follow it. Duties, payment fees and packaging can be added the same way.

=(D2+E2)/C2

Result: 0.461

0.461: $212.50 plus $18 freight, divided by 500 boxes.

Blended cost across several orders

You bought mailer boxes three times at different prices: 0.425, 0.3875 and 0.47 per box. The tempting answer is the average of the three, 0.4275. It is wrong, because it gives the 300-box order the same say as the 1,200-box order. The true cost of the 2,000 boxes you bought is all the money spent divided by all the boxes: 818.50 / 2,000 = 0.40925.

SUMIFS does it for one item in one formula, with the item name in I3. Add the freight SUMIFS to the top line for the blended landed cost: =(SUMIFS(D2:D8,B2:B8,I3)+SUMIFS(E2:E8,B2:B8,I3))/SUMIFS(C2:C8,B2:B8,I3) returns 0.43775.

Never divide all the cost by all the units across different items. =SUM(D2:D7)/SUM(C2:C7) returns about 0.2076, a number that is not the cost of anything, because tissue sheets at under 5 cents drag it down.

=SUMIFS(D2:D8,B2:B8,I3)/SUMIFS(C2:C8,B2:B8,I3)

Result: 0.40925

0.40925 per mailer box across all three orders. AVERAGE of the three unit costs would say 0.4275.

When you only have unit prices: SUMPRODUCT

Supplier price lists and some exports give you a unit price and a quantity, not an invoice total. Then weight each price by its quantity: SUMPRODUCT multiplies units by unit cost row by row and adds the results, and you divide by the total units. It gives the same 0.40925 as the SUMIFS version.

Write the condition as a separate argument with --, as below. The shorter form =SUMPRODUCT((B2:B8=I3)*C2:C8*F2:F8) returns #VALUE!, because multiplying with * fails on the empty text in F8. Comma-separated arrays treat text as 0.

=SUMPRODUCT(--(B2:B8=I3),C2:C8,F2:F8)/SUMIFS(C2:C8,B2:B8,I3)

Result: 0.40925

0.40925: the quantity-weighted cost per mailer box, matching the SUMIFS result.

Rounding to cents: when to do it and when not to

Keep unit costs unrounded while you calculate. The labels cost 0.0378 each. =ROUND(I1/I2,2) gives 0.04, and 500 labels at 0.04 come to $20.00, not the $18.90 you paid: a 6% error from one rounding. Even at larger amounts it adds up: PO-1194's 0.3875 rounds to 0.39, and 1,200 boxes at 0.39 is $468 against an invoice of $465.

Round only where a cent amount is final: a selling price, an invoice line, a figure in a report. Use ROUND(...,4) or more for unit costs you will multiply again, and ROUNDUP(...,2) when you set a price from a cost and never want to round below it.

=ROUND(F4,2)*C4

Result: 468

468: 1,200 boxes at the rounded 0.39, three dollars more than the $465 invoice.

Which formula to pick

One purchase: total cost / units, plus freight on top if it was charged. A pack price: pack price / items per pack. Several purchases of the same item: SUMIFS of cost / SUMIFS of units, or SUMPRODUCT when you only have unit prices. Never AVERAGE a column of unit costs, and keep the decimals until the final price. From the cost per unit, the markup and profit margin guides take you to a selling price.

Common mistakes

Averaging unit costs from different orders

AVERAGE ignores how many units each order had. Divide total cost by total units with SUMIFS, or weight with SUMPRODUCT.

Rounding the unit cost to cents before multiplying

0.0378 becomes 0.04 and 500 labels cost $20.00 instead of $18.90. Keep 4 or more decimals until the final amount.

Leaving freight out

Add shipping to the cost before dividing, or your margins look better than they are.

#DIV/0! when units are missing

Use =IF(C2>0,D2/C2,"") so the cell stays blank until the units are entered.

FAQ

What is the formula for cost per unit in Excel?

Total cost divided by the number of units: =D2/C2. Add any freight or fees to the cost first: =(D2+E2)/C2.

How do I calculate average cost per unit for multiple purchases?

Divide total spend by total units. For one item in a longer list use =SUMIFS(cost,item,"Mailer box")/SUMIFS(units,item,"Mailer box"). Do not average the individual unit costs.

How do I calculate cost per unit from a case or pack price?

Divide the pack price by the number of items in the pack, for example $18.90 / 500 labels = $0.0378 per label. Keep the pack size in its own cell so it is easy to check.

Should I round cost per unit to 2 decimals?

Not while you calculate with it. Small unit costs lose a large share of their value when rounded to cents. Round only the final price or total.

How do I get from cost per unit to a selling price?

Multiply the cost by 1 plus your markup, =cost*(1+markup), or divide by 1 minus your target margin, =cost/(1-margin). The markup and profit margin guides explain the difference.

Functions used

Related guides

Updated