FIFO Cost Calculator

Under the FIFO (first in, first out) method, the cost of goods sold is found by deducting the quantity sold from the oldest purchase onward, in purchase order, and multiplying each portion by its own purchase price; the remaining stock is valued at the price of the most recent purchases. This tool calculates the cost of goods sold across up to five purchase batches, the value of the remaining stock, and how many units were deducted from which batch, and places the same figures side by side with weighted average and LIFO.

FIFO Cost Calculator

FIFO cost of goods sold
—
—
FIFO remaining stock value
—
—
FIFO gross profit
—
sales amount − cost
Cost using weighted average
—
—
Cost using LIFO
—
for comparison
FIFO − average difference
—
—

Calculation formula

FIFO satılan malın maliyeti = Satılan miktar en eski alıştan başlanarak düşülür:
    1. alıştan düşülen × 1. fiyat + 2. alıştan düşülen × 2. fiyat + …
FIFO kalan stok değeri     = Toplam alış tutarı − FIFO satılan malın maliyeti

Ağırlıklı ortalama birim maliyet = Toplam alış tutarı ÷ Toplam alış miktarı
Ortalama ile satılan malın maliyeti = Satılan miktar × Ağırlıklı ortalama birim maliyet

LIFO = aynı düşme işlemi, en son alıştan başlayarak

Example: three purchases, 190 units sold

You bought a product three times during the month at rising prices and sold a total of 190 units over the month (3,420 ₺ revenue excluding VAT):

MovementQuantityUnit priceAmountDeducted from sales under FIFO
Purchase 110010 ₺1.000 ₺100 × 10 = 1.000 ₺
Purchase 26012 ₺720 ₺60 × 12 = 720 ₺
Purchase 38013 ₺1.040 ₺30 × 13 = 390 ₺
Total2402.760 ₺190 units = 2,110 ₺

Cost of goods sold (FIFO): 1,000 + 720 + 390 = 2,110 ₺. Remaining stock: 50 units left from purchase 3 × 13 ₺ = 650 ₺. Check: 2,110 + 650 = 2,760 ₺, which is the total of the purchases.

Gross profit: 3,420 − 2,110 = 1,310 ₺.

The same example with weighted average and LIFO

MethodCost of goods soldValue of the remaining 50 unitsGross profit
FIFO2.110 ₺650 ₺1.310 ₺
Weighted average (2,760 ÷ 240 = 11.50 ₺)190 × 11,50 = 2.185 ₺575 ₺1.235 ₺
LIFO1.040 + 720 + 50 × 10 = 2.260 ₺500 ₺1.160 ₺

When prices are rising, FIFO shows the lowest cost of goods sold and the highest profit and remaining-stock value; when prices are falling, the opposite happens. The total is the same under all three methods (2,760 ₺) — what changes is how much of this amount goes to this month’s expenses and how much is recorded as stock sitting on the shelf.

LIFO is calculated here for comparison only. International financial reporting standards (IFRS; in Turkey TFRS/UFRS, TMS 2 — the equivalent of IAS 2) do not permit LIFO; determine which inventory valuation method to use in your financial records with your accountant (mali müşavir, Turkey’s licensed accountant).

If there are multiple sales during the month

The practical convenience of FIFO is that you don’t need to enter sales one by one. Even if you made three separate sales of 40, 70 and 80 units during the month, the oldest batches are used up in the same order each time, so the result is the same as deducting the total of 190 units at once. You only need to enter the period’s total quantity sold in the tool.

This is not true for weighted average and LIFO: the perpetual method, which recalculates the average after each sale, and the method that calculates once at period end can give different results. The tool calculates these two using the period-end method.

If you have stock carried over from the start of the period, enter it at its own cost in the purchase 1 row; under FIFO it is used up first.

If you don’t track batches individually and only keep opening stock, total purchases and a period-end count, use the cost of goods sold calculator to find the cost of goods sold with the periodic formula.

The FIFO formula in Excel

You can build a multi-batch FIFO calculation in Excel with a single helper column. Enter the purchase quantities in column A and the unit prices in column B, from oldest to newest; let the total quantity sold be in cell F1:

C2 (kümülatif miktar):   =TOPLA($A$2:A2)
D2 (satıştan düşülen):   =MİN(A2;MAK(0;$F$1-(C2-A2)))
E2 (maliyet payı):       =D2*B2
Satılan malın maliyeti:  =TOPLA(E2:E6)
Kalan stok değeri:       =TOPLAMÇARPIM(A2:A6;B2:B6)-TOPLA(E2:E6)

Drag C2, D2 and E2 down to the end of the purchase rows. In Turkish-language Excel the function names are TOPLA, MİN, MAK and TOPLA.ÇARPIM, and the separator is a semicolon instead of a comma. For each batch, the formula deducts “the part of the quantity sold that remains after earlier batches, but no more than the batch itself” — that is the definition of FIFO.

If you will track FIFO cost for more than one product, set up a separate block for each product: FIFO works per product, and batches of different products don’t get mixed up. To record the date, quantity and price of purchases, the warehouse receipt and issue voucher is a ready starting point, and for stock movements by product, the inventory tracking template.

How does FIFO cost affect pricing decisions?

When prices are rising, FIFO carries the cost of the old, cheap goods sitting on the shelf into the profit calculation. The unit cost shown in your report for a product you bought at 13 ₺ this month appears as 11.11 ₺ (2,110 ÷ 190); if you set your price based on this number, your margin suddenly narrows when the old stock runs out.

So when setting the selling price, look at the latest purchase price: enter the latest purchase price in the profit margin calculator. FIFO cost is for measuring period profit correctly, not for setting the new price.

The physical counterpart of FIFO on the shelf — stacking new arrivals at the back and selling the old ones first — is a separate habit on the warehouse side; how it is applied is explained in the guide what is FIFO and how to apply it on the shelf.

Frequently asked questions

How is cost calculated with the FIFO method?

The quantity sold is deducted starting from the oldest purchase, in purchase order, and each portion is multiplied by its own purchase price; the sum of these products is the cost of goods sold. If you bought 100 units at 10 ₺, 60 at 12 ₺ and 80 at 13 ₺ and sold 190, the cost is 100 × 10 + 60 × 12 + 30 × 13 = 2,110 ₺.

How is remaining stock valued under FIFO?

Remaining stock is valued at the price of the most recent purchases, because the older batches were used up first. The practical way: subtract the FIFO cost of goods sold from the total purchase amount. In the example above, 2,760 − 2,110 = 650 ₺, that is 50 units × 13 ₺.

What is the difference between FIFO and weighted average?

FIFO costs goods sold at the oldest purchase prices; weighted average uses the average unit cost of all purchases. When prices are rising, FIFO gives a lower cost and higher profit, while the average method gives a more balanced result. The total purchase amount is the same under both methods.

What is the difference between FIFO and LIFO?

Under FIFO the oldest purchase is treated as sold first; under LIFO the most recent purchase is. When prices are rising, LIFO shows a higher cost and lower profit. LIFO is not accepted under international financial reporting standards (IAS 2 / TMS 2); the tool calculates it for comparison only.

How do I write the FIFO formula in Excel?

If the purchase quantity is in column A, the unit price in column B and the quantity sold in F1: C2 =SUM($A$2:A2), D2 =MIN(A2,MAX(0,$F$1-(C2-A2))), E2 =D2*B2. The cost of goods sold is =SUM(E2:E6). Drag the formulas down to the end of the purchase rows.

I made several sales during the month — should I enter each one separately?

Not under FIFO. Because batches are used up in the same order with every sale, deducting the period’s total quantity sold once gives the same result. For weighted average and LIFO, the perpetual and period-end calculations can differ; the tool calculates these two with the period-end method.

Where should I enter the opening stock?

Enter the stock you have left at the start of the period, at its recorded cost, in the purchase 1 row. Under FIFO it is the oldest batch and sales are deducted from it first.

Which inventory valuation method should I use?

This is a financial-records decision and depends on tax legislation; the tool does not recommend a method. Determine which method to use in your financial records with your accountant. The tool is there so you can see how the chosen method changes profit and stock value.

Are the numbers I enter saved?

No. The calculation is done entirely in your browser; quantities and prices are not sent to any server.

Related calculators

Profit Margin Calculator

From purchase price to selling price, from selling price to margin. It shows markup on cost and margin on sales separately.

Inventory Turnover

How many times a year does your stock turn over, in how many days does it sell out, and how much cash is tied up in the warehouse?

To keep this calculation in Excel

Inventory Tracking Excel

Automatically calculates remaining stock from incoming and outgoing movements, the low-stock alert, and total stock value.

Warehouse Receipt and Issue Voucher

A printable voucher that documents every item entering or leaving the warehouse line by line, with the signatures of the person handing over and the person receiving; a log of all vouchers and totals by movement type are on separate tabs.

Search terms: fifo cost calculationfifo calculationfifo calculation excelfifo method examplefifo lifo calculationfirst in first out cost calculation

Last updated: October 5, 2026