Sub topic 2
Goods available for sale, COGS, and ending inventory
This chapter assumes you know basic bookkeeping (debits, credits, the income statement and the balance sheet). It also assumes you know what inventory and cost of goods sold (COGS) mean, and that you can do simple arithmetic with units and unit costs. The chapter builds the one equation that every cost flow method must satisfy. Later chapters on FIFO, LIFO, and weighted average only change how the total is split.
The core idea: one pool of cost, two destinations
A merchandiser starts a period with some inventory and buys more during the period. Everything it could have sold is the goods available for sale. By period end, each unit is in one of two places:
- Sold. Its cost becomes an expense, cost of goods sold (COGS), on the income statement.
- Still on hand. Its cost stays on the balance sheet as ending inventory, an asset.
Cost cannot disappear or appear. Whatever is not in COGS must be in ending inventory. A cost flow method is only a rule for deciding which unit costs go to which side.
The two equations
Goods available for sale is the sum of beginning inventory and net purchases:
Goods available for sale = Beginning inventory + Net purchases
COGS is what remains after you remove ending inventory:
COGS = Goods available for sale − Ending inventory
Rearranged, the same relationship says that Beginning inventory + Net purchases = COGS + Ending inventory. Both equations hold in dollars and in units. In units, you have Units available = Units sold + Units on hand.
What goes into net purchases
Net purchases is not just the invoice price of what you bought. It is every cost to get the goods to your warehouse in sellable condition, less reductions.
| Item | Effect on net purchases |
|---|---|
| Purchases at invoice price | Add |
| Freight-in (shipping you pay to receive goods) | Add |
| Purchase returns and allowances | Subtract |
| Purchase discounts taken (for example 2/10, n/30) | Subtract |
Freight-out, the cost of shipping goods to customers, is a selling expense. It does not enter inventory or COGS. Likewise, the cost of running a warehouse for finished goods is usually an operating expense, not part of goods available for sale, unless it is a cost of getting the goods ready for sale.
A worked example
Use one data set throughout this tutorial. A company has these cost layers, listed oldest first:
| Layer | Units | Unit cost | Total cost |
|---|---|---|---|
| Beginning inventory | 100 | $10 | $1,000 |
| Purchase 1 | 200 | $12 | $2,400 |
| Purchase 2 | 100 | $14 | $1,400 |
| Total available | 400 | $4,800 |
The company sells 250 units during the period at $20 each, so sales are $5,000. The units on hand at the end are 400 − 250 = 150.
The goods available for sale are $4,800 no matter which method is chosen. Only the split changes. Under FIFO, the company charges the oldest costs to COGS first, so COGS is $2,800 and ending inventory is $2,000. You will derive these figures properly in the FIFO chapter. For now, notice how the equation works as a check on the result:
- COGS $2,800 + ending inventory $2,000 = $4,800.
- Gross profit = $5,000 − $2,800 = $2,200.
Checking the equation in code
The following program builds the pool, assigns the 250 units sold to the oldest layers first, and checks that the two destinations add back to the pool. It then shows what happens when ending inventory is wrong.
# Layers are (units, unit_cost), oldest first.
beginning_inventory = [(100, 10)]
purchases = [(200, 12), (100, 14)]
units_sold = 250
sales_price = 20
layers = beginning_inventory + purchases
units_available = sum(u for u, _ in layers)
goods_available = sum(u * c for u, c in layers)
units_ending = units_available - units_sold
def cost_of_first(layers, n):
"""Cost of the first n units, reading layers in the order given."""
cost = 0
for units, unit_cost in layers:
take = min(units, n)
cost += take * unit_cost
n -= take
if n:
raise ValueError("asked for more units than available")
return cost
# FIFO: COGS takes the oldest units; ending inventory is the newest units.
cogs = cost_of_first(layers, units_sold)
ending = cost_of_first(layers[::-1], units_ending)
assert cogs + ending == goods_available
sales = units_sold * sales_price
print("Units available:", units_available)
print("Goods available for sale:", goods_available)
print("Units in ending inventory:", units_ending)
print("COGS", cogs, "+ ending inventory", ending, "=", cogs + ending)
print("Gross profit:", sales - cogs)
# An error: ending inventory overstated by 300 in a physical count.
wrong_ending = ending + 300
wrong_cogs = goods_available - wrong_ending
print("Gross profit with ending inventory overstated by 300:", sales - wrong_cogs)Running it prints:
Units available: 400
Goods available for sale: 4800
Units in ending inventory: 150
COGS 2800 + ending inventory 2000 = 4800
Gross profit: 2200
Gross profit with ending inventory overstated by 300: 2500The assert line is the point of the chapter. Any method you build later must pass the same check.
Why ending inventory errors matter
In a periodic system, COGS is calculated by subtraction. That means any mistake in ending inventory moves COGS by the same amount in the opposite direction.
- Ending inventory overstated by $300 means COGS is understated by $300, so gross profit and net income (before tax) are overstated by $300. Assets and equity are also overstated.
- Ending inventory understated by $300 does the reverse.
The error also carries into the next period, because this period's ending inventory is the next period's beginning inventory. If the count is correct next year, the error reverses and the two-year total income is right. The error is therefore called self-correcting. It is still a misstatement in both years, and a lender or investor looking at either year gets the wrong profit.
Journal entries for the equation
How the equation shows up in the ledger depends on the system (the next chapter covers periodic and perpetual in detail). Here is the essential picture for a periodic system, with the example numbers and no tax:
- During the period, purchases are debited to a Purchases account, not to Inventory.
- At period end, after a physical count, an adjusting or closing entry moves the amounts: debit COGS (or Income Summary) for beginning inventory and net purchases, and credit Inventory for the beginning balance and Purchases for the period total.
- Debit Inventory for the counted ending balance, and credit COGS for the same amount.
The net effect is that the Inventory account ends with the ending inventory balance, and COGS ends with the goods available for sale less that balance. In the example, Inventory ends at the cost of the 150 units counted, and COGS holds the rest of the $4,800.
Common errors
- Using units where dollars belong. Units available is 400, but goods available for sale is $4,800. Keep the two columns separate and do the unit check first.
- Forgetting beginning inventory. Goods available includes what you already own. Using only purchases of $3,800 understates the pool by $1,000.
- Treating the sold units as a dollar amount. Units sold is 250. The dollar COGS depends on the method.
- Including freight-out in net purchases. It is a selling expense.
- Subtracting returns twice. If purchases are already recorded net of returns, do not subtract them again.
- Mixing methods for the two sides. If COGS comes from FIFO, ending inventory must also come from FIFO. A mix will not add to $4,800.
Practice
Exercise
A company has beginning inventory of $3,000. During the period it buys goods with an invoice price of $9,000, pays $500 of freight-in, returns goods that cost $400, and spends $700 delivering goods to customers. A physical count values ending inventory at $2,600. What are net purchases, goods available for sale, and COGS?
Show answer
Net purchases = $9,000 + $500 − $400 = $9,100. The $700 delivery cost is freight-out, a selling expense, so it is excluded. Goods available for sale = $3,000 + $9,100 = $12,100. COGS = $12,100 − $2,600 = $9,500.
Exercise
In the chapter example (400 units, $4,800 available, 250 units sold at $20), a warehouse worker double-counts a pallet, so ending inventory is overstated by $500 at cost. By how much is COGS misstated, and what is reported gross profit if the correct FIFO gross profit is $2,200?
Show answer
COGS is understated by $500, because COGS = $4,800 − ending inventory and ending inventory is $500 too high. Reported COGS is $2,800 − $500 = $2,300 instead of $2,800 is not the right reading here: the correct COGS is $2,800, so reported COGS is $2,300. Reported gross profit is $5,000 − $2,300 = $2,700, which is $500 higher than the correct $2,200.