How to Check Profit After Selling Part of an Inventory Lot in Excel
A vintage shop buys ten matching chairs for $400 and pays $100 to bring them in. Four sell for $480 and two are reserved. The shop has six chairs on hand, but only four can be promised to another buyer. The four sold chairs carry $200 of the original lot cost, leaving $280 in gross profit and $300 of cost on the six unsold chairs.
This check is useful when an inventory app shows a photo and a quantity but its sales export leaves you guessing which purchase and freight records support the margin. Use the lot ID to tie the records together. If the app already tracks stock states and costs, compare its export with the original purchase and freight records first. Shopify documents separate inventory states, and Business Central shows how inbound freight can be assigned to a receipt. Use your own system’s status definitions and documented cost allocation.
Set up the purchase lots and activity
Synthetic example. Copy the purchase table into A1:E4 on a sheet named Lots. Each lot has a unique ID, a positive received quantity and a known freight amount. Enter zero freight only if the source confirms there was none. Use the same per-unit cost for units of equal cost in a lot. Where pieces have different costs or conditions, use item-level costs or your documented allocation.
| Lot | Item | Received | Purchase USD | Inbound freight USD |
|---|---|---|---|---|
| L101 | Dining chairs | 10 | 400 | 100 |
| L102 | Chandelier | 1 | 150 | 20 |
| L103 | Counter stools | 5 | 200 | 50 |
Copy the activity table into A1:E7 on a sheet named Activity. Include all activity for these lots through the same cutoff. Use one final status per activity line, and put sale proceeds after discounts in column E. For a monthly report, limit the margin calculation to sales in the month and keep the stock check cumulative through the cutoff. In this example, Sold means completed sales that have left stock. Reserved means an active hold on an unsold unit. Released means a hold that ended. A receipt, return, write-off or cancellation outside this sample needs its own stock rule. If your export is an event history, resolve each hold to its current state before summing it.
| Record | Lot | Status | Units | Net sale USD |
|---|---|---|---|---|
| T01 | L101 | Sold | 2 | 240 |
| T02 | L101 | Sold | 2 | 240 |
| T03 | L101 | Reserved | 2 | |
| T04 | L101 | Released | 1 | |
| T05 | L102 | Reserved | 1 | |
| T06 | L103 | Sold | 2 | 160 |
Calculate availability and gross profit by lot
On Lots, add these headings in F1:O1 in order: Sold, Reserved, On hand, Available, Unit cost, Net sales, Cost sold, Gross profit, Unsold cost and Quantity check. Put the ten formulas in F2:O2 and fill them down through row 4. Set the currency display to two decimals. Keep full precision in the unit cost so rounding does not accumulate across sales.
=SUMIFS(Activity!$D$2:$D$7,Activity!$B$2:$B$7,A2,Activity!$C$2:$C$7,"Sold")
=SUMIFS(Activity!$D$2:$D$7,Activity!$B$2:$B$7,A2,Activity!$C$2:$C$7,"Reserved")
=C2-F2
=H2-G2
=(D2+E2)/C2
=SUMIFS(Activity!$E$2:$E$7,Activity!$B$2:$B$7,A2,Activity!$C$2:$C$7,"Sold")
=F2*J2
=K2-L2
=H2*J2
=IF(I2<0,"Check quantities","OK")
| Lot | Sold | Held | On hand | Available | Unit cost USD | Net sales USD | Cost sold USD | Gross profit USD | Unsold cost USD |
|---|---|---|---|---|---|---|---|---|---|
| L101 | 4 | 2 | 6 | 4 | 50 | 480 | 200 | 280 | 300 |
| L102 | 0 | 1 | 1 | 0 | 170 | 0 | 0 | 0 | 170 |
| L103 | 2 | 0 | 3 | 3 | 50 | 160 | 100 | 60 | 150 |
At Lots!M2, the $280 comes from $480 in Activity!E2:E3 less four units at $50. The $50 comes from Lots!C2:E2. The two held chairs in Activity!D4 reduce availability and carry no sale proceeds. Across the three lots, $640 in net sales less $300 in cost sold gives $340 gross profit. The remaining $620 is the cost of unsold stock. This is item-level gross profit before platform fees, outbound delivery and overhead.
To test the flag, change the active chair hold in Activity!D4 from two to seven. Available stock becomes −1 and the quantity check asks you to investigate. The four completed chair sales still produce $280 in gross profit. Restore the original value after the check. In a real export, also review missing or repeated lot IDs and unknown statuses before you rely on these calculations.
Use the check on the next export
For a recurring report, use Power Query’s Group By to summarize activity by lot and final status before joining it to the purchase table. Keep a detail query you can drill into for each total. Verify that the source has one purchase-cost row per lot and check activity rows with no matching lot. If all you need is the stock-state check, see how to reconcile on-hand and available inventory.
To review the exported workbook in Jolene.pro, try: “For each lot, separate sold, currently reserved and available units. Show which activity rows make up the chair sales, and which purchase and freight cells explain the sold-unit cost. Flag missing lot matches and negative availability.” Compare the references to the source before rerunning the question on the next export. The synthetic figures were checked independently. A live Jolene.pro result was not verified.