Tabellab
Accounting & financial statements

FIFO vs LIFO vs weighted average, on one worked example

FIFO, LIFO and weighted average are three ways to decide which purchase costs go into cost of goods sold (COGS) and which stay in ending inventory. FIFO (first in, first out) expenses the oldest costs first, LIFO (last in, first out) the newest, and weighted average uses one blended cost per unit. When purchase prices rise, FIFO shows the highest profit and LIFO the lowest. In the example below, a retailer that sold 520 cordless drills reports a gross profit of $18,420 under FIFO, $17,680 under weighted average and $16,940 under LIFO from the same purchases and the same sales.

Updated 21 Oct 2026 5 min read By Tabellab team

The three methods in one sentence each

  • FIFO: the units sold come from the oldest layers. Ending inventory is valued at the most recent costs.
  • LIFO: the units sold come from the newest layers. Ending inventory keeps the oldest costs, sometimes from years ago.
  • Weighted average: cost of goods available ÷ units available gives one cost per unit, used for both COGS and ending inventory.

Whatever the method, the total is fixed: cost of goods available = COGS + ending inventory. The method only decides how that total is split between this year's income statement and the balance sheet. The cash spent on stock is exactly the same.

Step 1: cost layers and units sold

The drill retailer starts the year with 100 drills at $60 and buys four more lots at rising prices: 150 at $62, 200 at $65, 150 at $68 and 100 at $70. That is 700 units with a cost of goods available of $45,500. The year-end count finds 180 drills on the shelf, so in a periodic system units sold = 700 − 180 = 520.

To allocate the 520 units to layers in Excel, take from each layer at most what it holds and never more than is still missing. For FIFO, starting at the top: =MIN(B2,$B$10-SUM(D$1:D1)), copied down. The growing range adds up what the layers above already gave. For LIFO, the same idea from the bottom up: =MIN(B5,$B$10-SUM(E6:E$6)). The check row must show 520 in both columns.

Step 2: COGS, ending inventory and gross profit

Value the units each layer gave with =SUMPRODUCT(unit costs, units sold):

  • FIFO COGS = 100 × $60 + 150 × $62 + 200 × $65 + 70 × $68 = $33,060, ending inventory $12,440
  • Weighted average: $45,500 ÷ 700 = $65.00 per unit, COGS = 520 × $65 = $33,800, ending inventory $11,700
  • LIFO COGS = 100 × $70 + 150 × $68 + 200 × $65 + 70 × $62 = $34,540, ending inventory $10,960

At $99 a drill, revenue is $51,480 under every method, so gross profit is $18,420, $17,680 and $16,940. The difference between FIFO and LIFO inventory, $1,480, is the LIFO reserve, which US companies on LIFO disclose so that readers can restate the numbers to FIFO. Gross margin moves with it, which matters for ratios like the ones in markup vs margin.

Worked example: 520 cordless drills sold, three cost methods

Purchases, the year-end count and the selling price are yellow inputs. Columns D and E allocate the units sold to the layers for FIFO and LIFO, and the bottom table compares the three methods.

Worked example: 520 cordless drills sold, three cost methods
ABCDE
1Cost layerUnitsUnit cost ($)FIFO units soldLIFO units sold
21 Jan · opening stock10060.001000
312 Feb · purchase15062.0015070
48 May · purchase20065.00200200
519 Aug · purchase15068.0070150
64 Nov · purchase10070.000100
7Total700520520
8
9Units counted on 31 Dec180
10Units sold520
11Selling price per drill ($)99.00
12Cost of goods available ($)45,500.00
13Weighted average unit cost ($)65.00
14
15MethodCOGS ($)Ending inventory ($)Gross profit ($)
16FIFO33,06012,44018,420
17Weighted average33,80011,70017,680
18LIFO34,54010,96016,940
19LIFO reserve (FIFO − LIFO inventory)1,480
Key formulas
  • D2=MIN(B2,$B$10-SUM(D$1:D1))FIFO: take from the oldest layer first (copy down)
  • E2=MIN(B2,$B$10-SUM(E3:E$6))LIFO: take from the newest layer first (E6 =MIN(B6,$B$10))
  • B13=B12/B7Weighted average cost per unit
  • B16=SUMPRODUCT(C2:C6,D2:D6)FIFO cost of goods sold
  • B18=SUMPRODUCT(C2:C6,E2:E6)LIFO cost of goods sold
  • C16=$B$12-B16Ending inventory = goods available − COGS

Fictional retailer and prices. General education on inventory accounting, not tax or accounting advice.

Which method is allowed where?

Under IFRS (IAS 2), only FIFO and weighted average are allowed for interchangeable items. LIFO is prohibited. Under US GAAP, LIFO is allowed, and its main attraction is tax: in rising prices it reports a lower profit and therefore a lower taxable income. The catch is the US LIFO conformity rule, under which a company that uses LIFO for tax must also use it in its financial statements, so it reports the lower profit to investors as well.

Once chosen, a method must be applied consistently. Switching from year to year to manage profit is not allowed, and a change of method needs a justification and disclosure. This guide is general education, not tax or accounting advice for a specific company.

Periodic versus perpetual

The example uses a periodic system: count at year end, then allocate. A perpetual system costs every sale when it happens. FIFO gives the same result in both. Weighted average becomes a moving average that is recalculated after every purchase, and perpetual LIFO can differ from periodic LIFO because a sale can only use layers that already existed on that date. Most retail and ERP systems run perpetual moving average or FIFO.

Whatever the method, inventory is also tested for impairment: if the net realisable value of an item falls below its cost, it is written down. And the inventory figure feeds days in inventory, part of the cash conversion cycle.

Common mistakes

  • Averaging the unit costs without weights. AVERAGE of $60, $62, $65, $68 and $70 treats a 100-unit layer like a 200-unit one. Use cost of goods available ÷ units available.
  • Forgetting the opening stock. The oldest layer under FIFO is last year's closing inventory. Leave it out and every number is wrong.
  • Calculating ending inventory separately. Compute COGS, then ending inventory = goods available − COGS, so the two always add up.
  • Using LIFO under IFRS. IAS 2 does not allow it. Only FIFO and weighted average (or specific identification) are permitted.
  • Thinking the method changes cash. It only changes reported profit and, where taxes follow book profit, the tax bill.
  • Mixing up periodic and perpetual LIFO. Perpetual LIFO can only use layers bought before each sale, so the results can differ.

Frequently asked questions

Which inventory method gives the highest profit?

When purchase prices rise, FIFO gives the highest gross profit because the oldest, cheapest costs go to COGS. LIFO gives the lowest, and weighted average lands in between. When prices fall, the order reverses.

Why do companies use LIFO?

Mainly for tax in the United States: in rising prices LIFO reports a higher COGS and a lower taxable income. The LIFO conformity rule then requires the company to use LIFO in its financial statements too. IFRS does not allow LIFO.

How do you calculate weighted average cost?

Divide the total cost of goods available for sale by the number of units available. Multiply that average unit cost by the units sold for COGS and by the units on hand for ending inventory.

What is the LIFO reserve?

The difference between inventory valued at FIFO and at LIFO. Companies on LIFO disclose it so that analysts can restate inventory and COGS to a FIFO basis and compare them with FIFO companies.

Practise it in a lab

Related guides

Reading is step one. Doing is step two.

Every guide links to a lab where you build the same calculation in an online spreadsheet and get instant feedback.

Open the lab