How to Calculate Ending Inventory Using Weighted Average Method | Free Calculator & Guide
:root {
–primary-color: #004a99;
–secondary-color: #003366;
–success-color: #28a745;
–bg-color: #f8f9fa;
–text-color: #333;
–border-color: #ddd;
–white: #ffffff;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(–text-color);
background-color: var(–bg-color);
}
.container {
max-width: 960px;
margin: 0 auto;
padding: 20px;
background-color: var(–white);
}
header {
background-color: var(–primary-color);
color: var(–white);
padding: 2rem 1rem;
text-align: center;
margin-bottom: 2rem;
}
h1 {
font-size: 2.2rem;
margin-bottom: 0.5rem;
}
h2 {
color: var(–primary-color);
margin-top: 2rem;
margin-bottom: 1rem;
font-size: 1.8rem;
border-bottom: 2px solid var(–border-color);
padding-bottom: 0.5rem;
}
h3 {
color: var(–secondary-color);
margin-top: 1.5rem;
margin-bottom: 0.8rem;
font-size: 1.4rem;
}
p {
margin-bottom: 1rem;
}
/* Calculator Styles */
.calc-wrapper {
background-color: var(–white);
border: 1px solid var(–border-color);
border-radius: 8px;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
margin-bottom: 3rem;
}
.input-section {
margin-bottom: 2rem;
}
.inventory-row {
display: flex;
flex-wrap: wrap;
gap: 15px;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px dashed var(–border-color);
}
.inventory-row:last-child {
border-bottom: none;
}
.input-group {
flex: 1;
min-width: 200px;
}
.input-group label {
display: block;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(–secondary-color);
font-size: 0.9rem;
}
.input-group input {
width: 100%;
padding: 10px;
border: 1px solid var(–border-color);
border-radius: 4px;
font-size: 1rem;
transition: border-color 0.3s;
}
.input-group input:focus {
border-color: var(–primary-color);
outline: none;
}
.helper-text {
font-size: 0.8rem;
color: #666;
margin-top: 4px;
}
.section-title {
font-weight: bold;
color: var(–primary-color);
margin-bottom: 1rem;
display: block;
font-size: 1.1rem;
background: #eef4fa;
padding: 8px;
border-radius: 4px;
}
.btn-container {
display: flex;
gap: 10px;
margin-top: 1rem;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 600;
font-size: 1rem;
transition: background-color 0.3s;
}
.btn-reset {
background-color: #6c757d;
color: white;
}
.btn-copy {
background-color: var(–primary-color);
color: white;
}
.btn:hover {
opacity: 0.9;
}
/* Results Section */
.results-section {
background-color: #f1f8ff;
padding: 1.5rem;
border-radius: 8px;
margin-top: 2rem;
border: 1px solid #d0e3f5;
}
.main-result {
text-align: center;
margin-bottom: 1.5rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid #d0e3f5;
}
.main-result-label {
font-size: 1.1rem;
color: var(–secondary-color);
margin-bottom: 0.5rem;
}
.main-result-value {
font-size: 2.5rem;
font-weight: 800;
color: var(–primary-color);
}
.sub-results {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: space-between;
}
.sub-result-item {
flex: 1;
min-width: 140px;
background: white;
padding: 15px;
border-radius: 6px;
text-align: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.sub-label {
font-size: 0.9rem;
color: #666;
margin-bottom: 5px;
}
.sub-value {
font-size: 1.4rem;
font-weight: 700;
color: var(–success-color);
}
/* Table Styles */
.data-table {
width: 100%;
border-collapse: collapse;
margin-top: 2rem;
font-size: 0.95rem;
}
.data-table th, .data-table td {
padding: 12px;
text-align: right;
border-bottom: 1px solid var(–border-color);
}
.data-table th {
background-color: var(–primary-color);
color: white;
text-align: right;
}
.data-table th:first-child, .data-table td:first-child {
text-align: left;
}
.data-table tr:nth-child(even) {
background-color: #f8f9fa;
}
/* Chart Styles */
.chart-container {
margin-top: 2rem;
position: relative;
height: 300px;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
canvas {
max-width: 100%;
max-height: 100%;
}
.chart-legend {
display: flex;
gap: 15px;
margin-top: 10px;
font-size: 0.9rem;
}
.legend-item {
display: flex;
align-items: center;
gap: 5px;
}
.color-box {
width: 15px;
height: 15px;
border-radius: 3px;
}
/* Article Styles */
.article-content {
margin-top: 3rem;
padding: 0 10px;
}
ul, ol {
margin-left: 2rem;
margin-bottom: 1rem;
}
li {
margin-bottom: 0.5rem;
}
.formula-box {
background-color: #eef4fa;
padding: 1.5rem;
border-left: 4px solid var(–primary-color);
margin: 1.5rem 0;
font-family: "Courier New", Courier, monospace;
font-weight: bold;
}
.faq-item {
margin-bottom: 1.5rem;
}
.faq-question {
font-weight: 700;
color: var(–secondary-color);
margin-bottom: 0.5rem;
}
.internal-links {
background-color: #f8f9fa;
padding: 1.5rem;
border-radius: 8px;
margin-top: 2rem;
}
.internal-links a {
color: var(–primary-color);
text-decoration: none;
font-weight: 600;
}
.internal-links a:hover {
text-decoration: underline;
}
@media (max-width: 600px) {
h1 { font-size: 1.8rem; }
.inventory-row { flex-direction: column; gap: 10px; }
.sub-results { flex-direction: column; }
.main-result-value { font-size: 2rem; }
}
Ending Inventory Value
$1,222.22
Total value of unsold goods
Weighted Avg Cost / Unit
$12.22
Cost of Goods Sold (COGS)
$4,277.78
| Description |
Units |
Unit Cost |
Total Cost |
| Totals Available |
450 |
– |
$5,500.00 |
What is the Weighted Average Method?
The weighted average method is an inventory valuation technique used to determine the cost of goods sold (COGS) and the value of ending inventory. Unlike FIFO (First-In, First-Out) or LIFO (Last-In, First-Out), which track specific layers of inventory based on time, the weighted average method assigns a single average cost to all units available for sale during a specific period.
This method is particularly useful for businesses that sell items that are identical or difficult to distinguish from one another, such as chemicals, fuels, or grains. Learning how to calculate ending inventory using weighted average method ensures that your financial statements reflect a balanced view of inventory costs, smoothing out price fluctuations that occur over time.
By averaging the cost of all units, this method sits between FIFO and LIFO in terms of financial impact. It is widely accepted under both GAAP (Generally Accepted Accounting Principles) and IFRS (International Financial Reporting Standards).
Weighted Average Formula and Mathematical Explanation
To understand how to calculate ending inventory using weighted average method, you must first calculate the Weighted Average Unit Cost (WAC). This figure is the cornerstone of the entire calculation.
Weighted Average Unit Cost = Total Cost of Goods Available for Sale / Total Units Available for Sale
Once you have the average unit cost, you can determine your key financial metrics:
Ending Inventory Value = Ending Inventory Units × Weighted Average Unit Cost
Cost of Goods Sold (COGS) = Units Sold × Weighted Average Unit Cost
Variable Definitions
| Variable |
Meaning |
Unit |
| Beginning Inventory |
Value of unsold goods from the previous period |
Currency ($) |
| Purchases |
New inventory acquired during the current period |
Currency ($) |
| Goods Available for Sale |
Sum of Beginning Inventory + Purchases |
Currency ($) |
| WAC |
Weighted Average Cost per unit |
Currency ($) |
Practical Examples (Real-World Use Cases)
Example 1: The Coffee Shop
Imagine a coffee roaster wants to know how to calculate ending inventory using weighted average method for their coffee beans. Prices fluctuate weekly due to market conditions.
- Beginning Inventory: 100 lbs @ $5.00/lb = $500
- Purchase 1: 200 lbs @ $5.50/lb = $1,100
- Purchase 2: 100 lbs @ $6.00/lb = $600
- Total Available: 400 lbs with a Total Cost of $2,200
Calculation: $2,200 / 400 lbs = $5.50 per lb (WAC).
If they sold 350 lbs, the COGS is 350 × $5.50 = $1,925. The Ending Inventory is 50 lbs × $5.50 = $275.
Example 2: Hardware Store Bolts
A hardware store mixes batches of identical bolts in a bin. Tracking individual costs is impossible.
- Batch A: 1,000 units @ $0.10 = $100
- Batch B: 2,000 units @ $0.12 = $240
- Total: 3,000 units costing $340.
Calculation: $340 / 3,000 = $0.1133 per unit. This average is applied to every bolt sold, regardless of which batch it physically came from.
How to Use This Weighted Average Calculator
Our tool simplifies the process of how to calculate ending inventory using weighted average method. Follow these steps:
- Enter Beginning Inventory: Input the quantity and unit cost of items you had at the start of the period.
- Enter Purchases: Add up to three layers of new inventory purchases with their respective unit costs.
- Input Sales: Enter the total number of units sold during the period.
- Review Results: The calculator instantly updates the Weighted Average Cost (WAC), Ending Inventory Value, and COGS.
- Analyze the Chart: Use the visual breakdown to see the proportion of costs expensed (COGS) versus costs retained (Asset).
Key Factors That Affect Weighted Average Results
When learning how to calculate ending inventory using weighted average method, consider these influencing factors:
- Price Volatility: In periods of high inflation, the weighted average method yields a cost between FIFO (lower cost) and LIFO (higher cost), smoothing out profit margins.
- Purchase Frequency: Frequent purchases at different price points will constantly shift the average unit cost, requiring careful tracking.
- Inventory Turnover: High turnover rates mean the average cost closely reflects current market prices. Low turnover may result in an average cost that lags behind current replacement costs.
- Bulk Discounts: Large purchases at discounted rates will significantly lower the weighted average unit cost, potentially increasing reported gross profit.
- Freight and Handling: These costs should be included in the unit cost to ensure accurate valuation. Excluding them undervalues inventory.
- Accounting Standards: While GAAP allows FIFO, LIFO, and Weighted Average, IFRS does not permit LIFO. Weighted Average is a safe, globally compliant choice.
Frequently Asked Questions (FAQ)
Is the weighted average method better than FIFO?
It depends on your business goals. FIFO usually results in higher profit during inflation, while the weighted average method produces more stable, consistent results by smoothing out price peaks and valleys.
Can I use this method for tax purposes?
Yes, the weighted average method is approved by the IRS and most international tax authorities. It is often preferred for its simplicity in record-keeping.
How do I handle returns using this method?
Returns are typically added back to inventory at the weighted average cost current at the time of the return, or the cost is recalculated if the return significantly impacts the pool.
Does this calculator handle perpetual or periodic inventory?
This calculator uses the logic of the periodic weighted average method, where the average is calculated at the end of the period. Perpetual systems require recalculating the average after every single purchase.
What happens if I sell more units than I have available?
This is physically impossible in a real inventory scenario. The calculator will show an error or negative ending inventory if "Units Sold" exceeds "Total Units Available".
Why is my Weighted Average Cost different from the market price?
The WAC is a historical average. If market prices have risen recently, your WAC will be lower than the current replacement cost because it includes older, cheaper inventory.
Related Tools and Resources
Enhance your financial analysis with our other specialized calculators:
// Initialize calculator on load
window.onload = function() {
calculateInventory();
};
function getVal(id) {
var el = document.getElementById(id);
var val = parseFloat(el.value);
return isNaN(val) ? 0 : val;
}
function formatMoney(num) {
return '$' + num.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
function calculateInventory() {
// 1. Get Inputs
var begUnits = getVal('begUnits');
var begCost = getVal('begCost');
var p1Units = getVal('p1Units');
var p1Cost = getVal('p1Cost');
var p2Units = getVal('p2Units');
var p2Cost = getVal('p2Cost');
var p3Units = getVal('p3Units');
var p3Cost = getVal('p3Cost');
var unitsSold = getVal('unitsSold');
// 2. Calculate Totals (Goods Available for Sale)
var totalUnitsAvailable = begUnits + p1Units + p2Units + p3Units;
var totalCostAvailable = (begUnits * begCost) +
(p1Units * p1Cost) +
(p2Units * p2Cost) +
(p3Units * p3Cost);
// 3. Calculate Weighted Average Cost (WAC)
var wac = 0;
if (totalUnitsAvailable > 0) {
wac = totalCostAvailable / totalUnitsAvailable;
}
// 4. Calculate Results
// Validate units sold cannot exceed available
if (unitsSold > totalUnitsAvailable) {
// Simple error handling visual
document.getElementById('unitsSold').style.borderColor = 'red';
} else {
document.getElementById('unitsSold').style.borderColor = '#ddd';
}
// Cap units sold for calculation purposes to avoid negative inventory in math
var validUnitsSold = Math.min(unitsSold, totalUnitsAvailable);
var cogs = validUnitsSold * wac;
var endingUnits = totalUnitsAvailable – validUnitsSold;
var endingInventoryValue = endingUnits * wac;
// 5. Update UI Results
document.getElementById('resEndingInv').innerText = formatMoney(endingInventoryValue);
document.getElementById('resWAC').innerText = formatMoney(wac);
document.getElementById('resCOGS').innerText = formatMoney(cogs);
document.getElementById('resEndUnits').innerText = endingUnits.toLocaleString();
// 6. Update Table
var tbody = document.getElementById('tableBody');
tbody.innerHTML = ";
var rows = [
{ desc: 'Beginning Inventory', units: begUnits, cost: begCost },
{ desc: 'Purchase #1', units: p1Units, cost: p1Cost },
{ desc: 'Purchase #2', units: p2Units, cost: p2Cost },
{ desc: 'Purchase #3', units: p3Units, cost: p3Cost }
];
for (var i = 0; i 0 || rows[i].cost > 0) {
var tr = document.createElement('tr');
tr.innerHTML =
'
' + rows[i].desc + ' | ' +
'
' + rows[i].units.toLocaleString() + ' | ' +
'
' + formatMoney(rows[i].cost) + ' | ' +
'
' + formatMoney(rows[i].units * rows[i].cost) + ' | ';
tbody.appendChild(tr);
}
}
document.getElementById('tblTotalUnits').innerText = totalUnitsAvailable.toLocaleString();
document.getElementById('tblTotalCost').innerText = formatMoney(totalCostAvailable);
// 7. Draw Chart
drawChart(endingInventoryValue, cogs);
}
function drawChart(endingInv, cogs) {
var canvas = document.getElementById('inventoryChart');
var ctx = canvas.getContext('2d');
var width = canvas.width;
var height = canvas.height;
var radius = Math.min(width, height) / 2 – 10;
var centerX = width / 2;
var centerY = height / 2;
// Clear canvas
ctx.clearRect(0, 0, width, height);
var total = endingInv + cogs;
if (total <= 0) return;
var endAngle = 0;
var startAngle = 0;
// Draw Ending Inventory Slice (Green)
var slice1 = endingInv / total;
endAngle = startAngle + (slice1 * Math.PI * 2);
ctx.beginPath();
ctx.moveTo(centerX, centerY);
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
ctx.fillStyle = '#28a745';
ctx.fill();
startAngle = endAngle;
// Draw COGS Slice (Blue)
var slice2 = cogs / total;
endAngle = startAngle + (slice2 * Math.PI * 2);
ctx.beginPath();
ctx.moveTo(centerX, centerY);
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
ctx.fillStyle = '#004a99';
ctx.fill();
}
function resetCalculator() {
document.getElementById('begUnits').value = 100;
document.getElementById('begCost').value = 10.00;
document.getElementById('p1Units').value = 200;
document.getElementById('p1Cost').value = 12.00;
document.getElementById('p2Units').value = 150;
document.getElementById('p2Cost').value = 14.00;
document.getElementById('p3Units').value = 0;
document.getElementById('p3Cost').value = 0;
document.getElementById('unitsSold').value = 350;
calculateInventory();
}
function copyResults() {
var text = "Weighted Average Inventory Calculation:\n";
text += "Ending Inventory Value: " + document.getElementById('resEndingInv').innerText + "\n";
text += "Weighted Avg Cost/Unit: " + document.getElementById('resWAC').innerText + "\n";
text += "COGS: " + document.getElementById('resCOGS').innerText + "\n";
text += "Ending Units: " + document.getElementById('resEndUnits').innerText;
var tempInput = document.createElement("textarea");
tempInput.value = text;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
var btn = document.querySelector('.btn-copy');
var originalText = btn.innerText;
btn.innerText = "Copied!";
setTimeout(function(){ btn.innerText = originalText; }, 2000);
}