How to Calculate Cost of Goods Sold (CoGS)

Hello, is there a possibility that the account “Purchase Invoice” add these two items.
“Cost price” that is calculated automatically for each Artil and “Margin” to add manually in percent (%).

When using the periodic method of inventory, Cost of Goods Sold is calculated using the following equation:

eginning Inventory + Inventory Purchases – End Inventory = Cost of Goods Sold

This equation makes perfect sense when you look at it piece by piece.

Beginning inventory, plus the amount of inventory purchased over the period gives you the total amount of inventory that could have been sold (sometimes known, understandably, as Cost of Goods Available for Sale).

We then assume that, if an item isn’t in inventory at the end of the period, it must have been sold. (And conversely, if an item is in ending inventory, it obviously wasn’t sold, hence the subtraction of the ending inventory balance when calculating CoGS).

EXAMPLE: Corina has a business selling books on eBay. An inventory count at the beginning of November shows that she has $800 worth of inventory on hand. Over the month, she purchases another $2,400 worth of books. Her inventory count at the end of November shows that she has $600 of inventory on hand.

Using the equation above, we learn that Corina’s Cost of Goods Sold for November is $2600, calculated as follows:

Beginning Inventory + Purchases – Ending Inventory = Cost of Goods Sold
800 + 2400 – 600 = 2600

Granted, this equation isn’t perfect. For instance, it doesn’t keep track of the cost of inventory theft. Any stolen items will accidentally get bundled up into CoGS, because:

They aren’t in inventory at the end of the period, and
There is no way to know which items were stolen as opposed to sold, because inventory isn’t being tracked item-by-item.
Assumptions Used in Calculating CoGS under the Periodic Method

Of course, the calculation of CoGS is a bit more complex out in the real world. For example, if a business is dealing with changing per-unit inventory costs, assumptions have to be made as to which ones were sold (the cheaper units or the more expensive units).

EXAMPLE: Maggie has a business selling t-shirts online. She gets all of her inventory from a single vendor. In the middle of April, the vendor raises its prices from $3 per shirt to $3.50 per shirt. If Maggie sells 100 shirts during April—and she has no way of knowing which of those shirts were purchased at which price—should her CoGS be $300, $350, or somewhere in between?

The answer depends upon which inventory-valuation method is used. The three most used methods are known as FIFO, LIFO, and Average Cost. Under GAAP, a business can use any of the three.

First-In, First-Out (FIFO)

Under the “First-In, First-Out” method of calculating CoGS, we assume that the oldest units of inventory are always sold first. So in the above example, we’d assume that Maggie sold all of her $3 shirts before selling any of her $3.50 shirts.

Last-In, First-Out (LIFO)

Under the “Last-In, First-Out” method, the opposite assumption is made. That is, we assume that all of the newest inventory is sold before any older units of inventory are sold. So, in the above example, we’d assume that Maggie sold all of her $3.50 shirts before selling any of her $3 shirts.

EXAMPLE (CONTINUED): At the beginning of April, Maggie’s inventory consisted of 50 shirts—all of which had been purchased at $3 per shirt. Over the month, she purchased 100 shirts, 60 at $3 per shirt, and 40 at $3.50 per shirt. In total, Maggie’s Goods Available for Sale for April consists of 110 shirts at $3 per shirt, and 40 shirts at $3.50 per shirt.

If Maggie were to use the FIFO method of calculating her CoGS for the 100 shirts she sold in April, her CoGS would be $300. (She had 110 shirts that cost $3, and FIFO assumes that all of the older units are sold before any newer units are sold.)

100 x 3 = 300

If Maggie were to use the LIFO method of calculating her CoGS for the 100 shirts she sold in April, her CoGS would be $320. (LIFO assumes that all 40 of the newer, $3.50 shirts would have been sold, and the other 60 must have been $3 shirts.)

(40 x 3.5) + (60 x 3) = 320

It’s worth pointing out that the two methods result not only in different Cost of Goods Sold for the period, but in different ending inventory balances as well.

Under FIFO—because we assumed that all 100 of the sold shirts were the older, $3, shirts—it would be assumed that, at the end of April, her 50 remaining shirts would be made up of 10 shirts that were purchased at $3 each, and 40 that were purchased at $3.50 each. Grand total ending inventory balance: $170.

In contrast, the LIFO method would assume that—because all of the newer shirts were sold—the remaining shirts must be the older, $3 shirts. As such, Maggie’s ending inventory balance under LIFO is $150.

Average Cost

The average cost method is just what it sounds like. It uses the beginning inventory balance and the purchases over the period to determine an average cost per unit. That average cost per unit is then used to determine both the CoGS and the ending inventory balance.

[Beginning Inventory + Purchases (in dollars)]
÷ [Beginning Inventory + Purchases (in units)]
= Average Cost per Unit

Average Cost per Unit x Units Sold = Cost of Goods Sold

Avgerage Cost per Unit x Units in Ending Inventory = Ending Inventory Balance

EXAMPLE (CONTINUED): Under the average cost method, Maggie’s average cost per shirt for April is calculated as follows:

Beginning Inventory: 50 shirts ($3/shirt)
Purchases: 100 shirts (60 at $3/shirt and 40 at $3.50/shirt)

Her total units available for sale over the period is 150 shirts. Her total Cost of Goods Available for Sale is $470 (110 shirts at $3 each and 40 at $3.50 each).

Maggie’s average cost per shirt = $470/150 = $3.13

Using an average cost/shirt of $3.13, we can calculate the following:

CoGS in April = $313 (100 shirts x $3.13/shirt)
Ending Inventory = $157 (50 shirts x $3.13/shirt)
Simple Summary

The perpetual method of inventory involves tracking each individual item of inventory on a minute-to-minute basis. It can be expensive to implement, but it improves and simplifies accounting.
The periodic method of inventory involves doing an inventory count at the end of each period, then mathematically calculating Cost of Goods Sold.
FIFO (first-in, first-out) is the assumption that the oldest units of inventory are sold before the newer units.
LIFO (last-in, first-out) is the opposite assumption: The newest units of inventory are sold before older units are sold.
The average cost method is a formula for calculating CoGS and ending inventory based upon the average cost per unit of inventory available for sale over a given period.

Please take this option into consideration.
Thank you.

1 Like

Two points:

You seem to be completely misusing purchase invoices. A purchase invoice is not an account. It records the amount paid to a supplier. It has nothing to do with your margin, which you determine independently. See the Guide:

Manager uses the average cost method. You cannot change that.

And your copied-and-pasted tutorial was completely unnecessary.


In Manager the Purchase Invoice automatically by default updates the Average Cost field not the Cost Price field as the Cost Price is static whereas the Average Cost correctly reflex’s the moving average of the inventory cost.

I understand that stocks are taking the average cost prices.My request was, if you are able to cost price and the selling price is entered through the purchase invoice, rather than manually in warehouse inventories. To stock add two more options, First-In, First-Out (FIFO) and Last-In, First-Out (LIFO).

As I said before, this is not the purpose of a purchase invoice.

Is it possible to create such a form.


Is it possible to create such a form in the warehouse inventory.

will not affect on other elements of inventories.

This is very important.
Thank you.

No. Your first screen shot is just a summary of what you’ve entered for various inventory items, as in your second screen shot.

Thank you. You are very helpful …!

What does base on to vary the average cost of these items .(…the last items on top in red) from the last production order in black dated 01/06/2021

Manager uses the current average cost of items in inventory to determine the cost of goods sold. If the item is not in stock at the time, it waits until further acquisitions occur to assign costs to sales transactions. For items you produce, it uses the average cost of items on the bill of materials when the production order is issued.

If you want more specific information, ask more specific questions.

Okay…so why is it that the average cost of the receipt dated 01/06/2021 differs from the production order dated 01/06/2021…I thought they are supposed to be the same since they were made on the same day

A receipt reduces the balance for an inventory item based on the average cost when it is created. But it does not change the average cost. In other words, it causes a reduction of inventory at the average cost then existing. A production order adds to the balance for a finished inventory item based on the average cost of the input items plus any non-inventory cost. Accordingly, a production order can change the average cost of an item, depending on current average costs of other items. The processes are entirely different.

Your screen shot shows that on 25/5/2021, before you started making blocks, you had some in inventory at an average cost of 1,348.87. You then produced four batches at various costs, but averaging less than that. So your write-off and sale on 01/06/2021 both occurred at a somewhat lower average cost of 1,335.98. All perfectly ordinary and as expected.

If you do not understand the concepts behind average cost inventory valuation, you can read about it on any of dozens of accounting instruction websites.