FIFO Inventory Valuation in Excel using Data Tables – How To

Inventory can be valued in number of ways, FIFO, LIFO and AVCO being the most famous. To learn few more inventory valuation methods have a quick look at this: What are different inventory valuation methods?

FIFO inventory infoEntities purchase inventory as and when they feel the need or based on a particular method for example Economic Order Quantity (EOQ). Often the the purchase price is different every time order is placed. Therefore, the price of each purchase lot is different from each other as you can see in the data at left

First In First Out (FIFO) assumes that every time units are taken from store, they are issued from the oldest available lot first and next lot to be consumed only if needed.

This requirement makes the calculations a little too complex for formulas. May be there is a way to do it via formulas but I am unaware of it yet and would love to know. On the other hand VBA is also an alien knowledge for me so far. So is there a way? Yes there is!

By the end of the tutorial we will be able to get this:

Excel FIFO Calculation and Report

This is where Excel Data Tables comes handy. One of the less known and used tool for sure. But it can make this process super smooth and easy. So lets get to learn it!

Important: Excel Data Tables are different from Excel Tables so please don’t confuse the two

In a hurry?

Skip the tutorial for now and get the file. This fully unlocked no secrets held Excel file is available for you to change and use at your disposal. It is designed to input data easily. You just have to give the units sold and all calculations will be done automatically.

ALSO And any future revisions to this template will be sent to you absolutely free!

Buy Now

Got a question? Contact details are here

FIFO Inventory Valuation in Excel – Step by Step

Step 1: Download this workbook. It has the dummy data that we can use to understand the process.

Step 2: Format the worksheet as follows so that we know exactly what information is where:

FIFO inventory info 2

Step 3: Suppose we have made a sale of 1000 units. So enter that in cell G1 and name the cell as “sales” by typing in the name box having cell G1 active.

excel fifo inventory data tables 1

Step 4: Now we want the total units sold to be divided as per lots available deducting from the first available lot. Go to cell F4 and put this formula and drag it down to cell F10.


Step 5: Next put the following formulas in the mentioned cells and drag them to row 10:

G4: =F4*C4
H4: =B4-F4
I4: =H4*C4

excel fifo inventory data table 2

Step 6: Calculate the totals of each column by simply selecting the 11th row and hitting ALT+=

excel fifo inventory data table 3

So we have completed the calculations and if you change the value in sales we can easily update the records of each column showing the correct cost and value of inventory at hand

excel fifo inventory data table 4

Though the above process has helped me get the numbers but its not helping much if I want to calculate the cost of sales for different quantities. For example if I want to know the cost of sales of all the quantities by the end of the month, I simply need a report instead of punching each quantity in cell and then record the value somewhere. To solve this we will take few more steps

Step 7: Format the cells as follows. This is where we will have a mini report generator for the units you mention and Excel will automatically calculate the CGS of units mentioned on FIFO basis:

FIFO inventory info 3

Step 8: In cell L4 put the following formula and drag the fill handle down to cell L10


excel fifo inventory data table 5

Step 9: In cell M3 refer to total of CGS we calculated before in cell G11 with this formula: =G11

Step 10: Select the range L3: M10 and go to Data tab > Forecast group > Click what-if drop down button > click Data table. A pop up will appear. Leave the row input cell empty and mention units sold in column input cell G1. Click OK.

excel fifo inventory data table 6

Step 11: Put the following formula in CGS column’s cells:

N4: =M4
N5: =M5-SUM($N$4:N4), drag the fill handle down to cell N10

excel fifo inventory data table 7

Step 12: Select cells N4:N10 and hit Ctrl+1. Go to Custom and in the input bar mention the following and click OK:


Step 13: Hide the columns L and M. Now test your report by typing the units in “Units” column and it will give you the correct CGS as per FIFO.

excel fifo inventory data table 8

So here you have fully working FIFO Calculator and a mini report generator!

FIFO Stock Valuation in Excel - Template
Download the fully working and unlocked Excel file that can serve as a template for your FIFO calculations and also help learning the techniques applied.

And any future revisions to this template will be sent to you absolutely free!

Buy Now

Got a question? Contact details are here

More tutorials on Inventory valuation in Excel

ABC Analysis using Conditional Formatting in Excel
ABC Inventory Analysis using Excel Charts
Budget vs Actual Variance Reports with “In the Cell Charts” in Excel
LIFO valuation in Excel

Liked it? Pin it!


  1. This is nice, Here’s the formula made in Excel 365 making it dynamic.

    purchase = sales
    avail = units
    uNeed = Formula used in F4 downwards
    logic = extra formula to remove negative numbers
    remain = Formula used in H4 downwards

    This doesn’t calculate the CGS or value, but follow the ‘remain’ principal to achieve.


  2. I followed your lead and created a FIFO share register in the form of a data table. The final COGS calculation is off by a fair amount. If you could help me out, please tell me how to send you my Excel sheet.

  3. Black magic for love back is a kind of spell that is black magic but it is not for evil purposes. It will help you to get your love back in your life.

  4. Consult Shastri Ji For Problems Related To Love, Relationships, After Marriage Issues, Parents Against Love Marriage, Breakup With Lover, Husband/Wife Asking For Divorce, Business Disputes, Career Issues, Health Problems, Visa Disapproval, Family Disputes And Other Life Related Issues.

  5. Thanks for sharing such a great information.. It really helpful to me..I always search to read the quality content and finally i found this in you post. keep it up!

  6. This blog is very informative thank you to share this kind of informartion.

  7. articles that are nice and very interesting I like to read the articles you make

  8. Thanks for sharing such a great information.. It really helpful to me..I always search to read the quality content and finally i found this in you post. keep it up!

  9. Thanks for sharing such a great information.. It really helpful to me..I always search to read the quality content and finally i found this in you post. keep it up!

  10. This is really great thanks to share this kind of blog.

  11. I bookmarked this site to check out new stuff post. Keep it up, you’re great! This is an awesome motivating article. Keep it up. Thanks

  12. Thank you very much for sharing good content. Useful blog information, wanted to thank you for this excellent read!! Keep it up!

  13. We need you to make some adjustments to the formulae so that the sheet uses LIFO for its calculations.

  14. Try using this in cell F4 instead if you are having problems:


    If you find this helpful please consider sending a small gratitude amount
    Boba, BSC, ETH, MATIC


    Thanks pakaccountants for helping us!

  15. Is there a way to get the cost of goods sold in cell G11 only by using one formula?

  16. Great Job,

    Works very well for me.

    But I am a bit of a geek, I would like to know how the Min function works in this example and how does the DATA Table part work.

    If it is not too much, would you reply on my email.

    Thanks for the wonderful work that you are doing Hassan Fazal.

    Best Regards,

    • By the way forgot to mention in the earlier comment that when the rows for the data input become more than a thousand the excel slows down……..

  17. I need an excel spreadsheet to buy foreign currency then use it to purchase goods in foreign currency and translate back to dollars. since each purchase of currency is at a different rate, I need a FIFO function to account for use of funds at 2 different rates

  18. Thanks you solved my problem

  19. What if Multiple sales/issuance of inventory in different dates? You are only showing to calculate a specific single item calculation.

  20. Nice article. It’s informative blog.

  21. Hi, the formula =MIN(B4,sales-SUM($F$3:F3)) doesn’t works for me, too. Is there any solution?

    • It’s OK! 😀 I have to write SZUM


      You wrote a comma (,) after cell B4. In fact, semicolons are written (;)

      Here it is


  22. What about weight or moving average formula?

  23. this is genius work!

  24. Will this work with an invoicing template in Excel?
    Specifically, using FIFO for COGS associated with each invoice.

    • Yes, it should work. You have the technique and the template. Try it out. And if you get any questions you can always ask.

  25. Karanbir Singh Soin Karanbir Singh Soin

    I have made a FIFO share register using a data table as in your example. Somehow the COGS part in the end is not coming right. How can I mail you my excel sheet if you could guide me?

  26. Tell me how can we merge previous sheet cell record in next sheet cell e.g
    1- Sheet1 In First Semester cell show three exam result with subject code (Fail 5101,5102,5103)
    2- Sheet2 In second Semester cell show two exam result (*************Fail 5201,5202)
    tell me by which formula 1st semester cell record will show in 2nd semester cell record until he will pass the exam…………….same condition will apply next more 6 semesters e.g 3rd, 4th, 5th, 6th, 7th, 8th so on. I hope that you will give me answer.

  27. Awesome! and very easy to understand.

    • Can you give me the copy that you done

  28. Could you make some changes to the formulas and have the sheet calculate using LIFO?

    • A detailed tutorial is already in process and will be published today. Will update the comment with link.

  29. Hi, thanks, Great template!
    is it possible to tune these formulas to have the same template for weighted average?

  30. Could you make some changes to the formulas and have the sheet calculate using LIFO?

  31. Dear,

    can uyou please help in establishing Stock card using FIFO with multiple items. I HV around 300 item and want stock card using FIFO

    • Let me try tomorrow Nice

  32. =MIN(B4,sales-SUM($F$3:F3))

    This first formula is wrong… could anyone help me please?


    • Hey,
      Yes here to help. Ask please

      • Hi, the formula =MIN(B4,sales-SUM($F$3:F3)) doesn’t works for me, too. Is there any solution?

      • I have the same issue and you haven’t answered Kriszta. What is wrong here? Excel sais, thi sis not a formula 😐
        And to be honest, I haven’t really understood, what the formula should do, otherwise I would have done it by my own :-/

      • Hi Hasaan, any chance that you post the fix to the wrong excel formula?

        • click on the box where you typed in 1000. On the far left you will see “G1”. Now click on that box and replace “G1” with sales. renaming the box as “sales” should do the trick

  33. This has been super helpful information, but i can’t get the formula’s to work in my google drive spreadsheet.

    • For this to work we need data tables like functionality implemented. I will have to check if google spreadsheets allow this method to work or not as I am not using google sheets frequently.

  34. prakash rajendhran prakash rajendhran

    its very use full guide for ever…………

  35. Very productive indeed

Comments are closed.