Dollar Cost Averaging Formula, With a Worked Example
The dollar cost averaging formula is: average cost per share = total amount invested ÷ total shares bought, where each month's shares = that month's amount ÷ that month's price. With a fixed amount every month this is the harmonic mean of the prices, so it always lands at or below their simple average, because the same money buys more shares when prices are low. In the real-price example below, $12,000 bought 129.41 shares of VT, an average cost of $92.73 against a simple average price of $93.12.
The formula does not tell you whether DCA beat a lump sum; that depends on what prices did after your first buy. In the VT example monthly buying won by a wide margin, because the price fell hard in 2022 and was back where it started by the end of 2023. Over decades of index data, Vanguard found the lump sum ahead more often than not. The lump sum vs dollar cost averaging calculator runs that comparison for any fund and every start month.
The dollar cost averaging formula
- Shares bought each time = amount invested ÷ price per share on that day
- Average cost per share = total amount invested ÷ total shares bought
"Amount invested" is the money that left your account for each purchase, fees included. "Price" is what you paid per share on the day of that purchase. "Total shares" is the sum of every purchase, fractions included if your broker sells fractional shares.
The amounts don't have to be equal: with $500 one month and $800 the next, you still add up the dollars, add up the shares and divide; only the harmonic-mean shortcut in the next section needs equal amounts.
Why your average cost lands below the average price
A fixed amount buys more shares when the price is low and fewer when it is high, so the cheap months carry more weight in your average. Take two buys of $100 each: at $50 a share you get 2 shares, at $100 you get 1. You now own 3 shares for $200, an average cost of $66.67, while the average of the two prices is $75.
With equal amounts, the average cost is the harmonic mean of the prices, and the harmonic mean of positive numbers is never above their ordinary (arithmetic) mean. The two are equal only when the price never moves, and the gap widens as the swings get bigger. A low average cost still doesn't protect you from a loss, since what you own is worth today's price, and today's price can sit below your average cost for months.
Worked example: $500 a month into VT, 2022 to 2023
Say $500 goes into the Vanguard Total World Stock ETF (VT) at every month-end close for two years, so 24 buys and $12,000 in all. Prices are plain closes from Yahoo Finance's VT price history, not adjusted for dividends, with fractional shares and no fees. VT closed January 2022 at $102.51, sank to $78.88 by the end of September 2022 (23% lower) and finished December 2023 at $102.88, so the run catches a whole fall and recovery.
| Month | VT close ($) | Shares bought | Total shares | Total invested ($) | Average cost ($) | Value ($) |
|---|---|---|---|---|---|---|
| Jan 2022 | 102.51 | 4.8776 | 4.8776 | 500 | 102.51 | 500.00 |
| Feb 2022 | 99.67 | 5.0166 | 9.8941 | 1,000 | 101.07 | 986.15 |
| Mar 2022 | 101.29 | 4.9363 | 14.8304 | 1,500 | 101.14 | 1,502.18 |
| Apr 2022 | 93.09 | 5.3711 | 20.2016 | 2,000 | 99.00 | 1,880.57 |
| May 2022 | 93.55 | 5.3447 | 25.5463 | 2,500 | 97.86 | 2,389.86 |
| Jun 2022 | 85.34 | 5.8589 | 31.4052 | 3,000 | 95.53 | 2,680.12 |
| Jul 2022 | 91.30 | 5.4765 | 36.8817 | 3,500 | 94.90 | 3,367.30 |
| Aug 2022 | 87.60 | 5.7078 | 42.5895 | 4,000 | 93.92 | 3,730.84 |
| Sep 2022 | 78.88 | 6.3387 | 48.9282 | 4,500 | 91.97 | 3,859.46 |
| Oct 2022 | 83.91 | 5.9588 | 54.8870 | 5,000 | 91.10 | 4,605.57 |
| Nov 2022 | 90.86 | 5.5030 | 60.3899 | 5,500 | 91.07 | 5,487.03 |
| Dec 2022 | 86.19 | 5.8011 | 66.1911 | 6,000 | 90.65 | 5,705.01 |
| Jan 2023 | 92.78 | 5.3891 | 71.5802 | 6,500 | 90.81 | 6,641.21 |
| Feb 2023 | 89.83 | 5.5661 | 77.1462 | 7,000 | 90.74 | 6,930.05 |
| Mar 2023 | 92.09 | 5.4295 | 82.5757 | 7,500 | 90.83 | 7,604.40 |
| Apr 2023 | 93.40 | 5.3533 | 87.9290 | 8,000 | 90.98 | 8,212.57 |
| May 2023 | 92.27 | 5.4189 | 93.3479 | 8,500 | 91.06 | 8,613.21 |
| Jun 2023 | 96.98 | 5.1557 | 98.5036 | 9,000 | 91.37 | 9,552.88 |
| Jul 2023 | 100.59 | 4.9707 | 103.4743 | 9,500 | 91.81 | 10,408.48 |
| Aug 2023 | 97.73 | 5.1161 | 108.5904 | 10,000 | 92.09 | 10,612.54 |
| Sep 2023 | 93.18 | 5.3660 | 113.9564 | 10,500 | 92.14 | 10,618.46 |
| Oct 2023 | 90.46 | 5.5273 | 119.4837 | 11,000 | 92.06 | 10,808.49 |
| Nov 2023 | 98.61 | 5.0705 | 124.5542 | 11,500 | 92.33 | 12,282.29 |
| Dec 2023 | 102.88 | 4.8600 | 129.4142 | 12,000 | 92.73 | 13,314.13 |
After 24 buys the account held 129.41 shares, so the average cost is 12,000 ÷ 129.41 = $92.73 a share, 0.43% below the $93.12 simple average of the closes (on unrounded prices). Buying the same $12,000 at that average price would have bought 128.86 shares, so the fixed monthly amount picked up 0.55 extra shares, worth about $57 at the final price.
Data: Yahoo Finance VT price history, month-end closes without dividends; model buys $500 at each close, Jan 2022 to Dec 2023.
The running average cost falls through 2022 as the cheaper months pile up, bottoms at $90.65 in December 2022, then drifts back up to $92.73 because the 2023 buys came in at higher prices. The position still spent 12 of the 24 months under water, the worst of it at the September 2022 low, when the $4,500 put in so far was worth $3,859.46.
At the December 2023 close of $102.88, the 129.41 shares were worth $13,314.13: a gain of $1,314.13, or 10.95% on the $12,000 put in. Dividends paid along the way are not in that figure, since the table uses plain closes. Reinvested, they buy extra shares that compound with the rest and lift the gain to 13.71%.
Did it beat investing the lump sum?
Put the same $12,000 in at the January 2022 close of $102.51 and it buys 117.06 shares, worth $12,043.31 at the end of December 2023. That's a gain of $43.31, or 0.36%, and $1,270.82 behind the monthly buys.
| VT, Jan 2022 to Dec 2023 | $500 a month (DCA) | $12,000 in January 2022 |
|---|---|---|
| Shares owned at the end | 129.41 | 117.06 |
| Average cost per share | $92.73 | $102.51 |
| Value at the September 2022 low | $3,859.46 of $4,500 invested | $9,233.83 of $12,000 invested |
| Value at the December 2023 close | $13,314.13 | $12,043.31 |
| Gain on $12,000 | +10.95% | +0.36% |
VT ended December 2023 almost exactly where it started, so every monthly buy below $102.88 made money while the lump sum only climbed back to even. With dividend-adjusted closes the ranking stays the same: DCA +13.71%, lump sum +4.86%.
Vanguard tested the same question on the MSCI World index from 1976 to 2022. A lump sum invested straight away beat cost averaging about two-thirds of the time, and the cost of waiting grew as the averaging period got longer (Vanguard, "Cost averaging: Invest now or temporarily hold your cash?"). On a 60/40 portfolio the lump sum ended 1.8% higher on average than spreading the same money over three months. The same paper notes that cost averaging temporarily lowers risk and can limit the drawdown, and the regret, of buying right before a crash. Vanguard's investor guidance calls delaying a form of market timing.
Money that arrives with each paycheck has no lump sum to compare against, so all of this is about a windfall. If you have one and are tempted to drip it in, set the lump sum vs DCA calculator to the spread you're weighing (3, 6, 12, 24 or 36 months) and it shows how often that spread beat investing at once in your fund, across every start month in its price history. It works on total-return prices with dividends reinvested, so its VT figures come out a little higher than the table's plain closes.
The formula in a spreadsheet
Put the month in column A, the amount invested in column B and the price per share in column C, starting in row 2. Then add these columns and fill each formula down to the last month; they work the same in Excel and Google Sheets.
| Column | What it holds | Formula in row 2 |
|---|---|---|
| D | Shares bought | =B2/C2 |
| E | Running shares | =SUM($D$2:D2) |
| F | Running average cost | =SUM($B$2:B2)/E2 |
| G | Value at that month's price | =E2*C2 |
| H | Gain or loss | =G2/SUM($B$2:B2)-1 |
For the 24 VT rows above, the final average cost is =SUM(B2:B25)/SUM(D2:D25), which returns 92.73. With equal monthly amounts you can check it with =HARMEAN(C2:C25), also 92.73, and compare it with =AVERAGE(C2:C25), which returns 93.12. The HARMEAN check stops matching as soon as the amounts differ from month to month; the SUM version keeps working.
What fees do to the formula
A per-trade fee is part of the cost: if it comes out of each buy, shares = (amount − fee) ÷ price, and you still divide the full amount that left your account by the shares you got. If your broker charges the fee on top instead, make column B the total that left your account, fee included. Either way, enter each month's fee in the next free column (I2 downwards) and change the shares formula to =(B2-I2)/C2.
The same 24-month VT run with a flat $1 fee on every buy:
| Monthly buy | Fee as % of each buy | Fees over 24 months | Average cost, no fee | Average cost with $1 fee | Increase |
|---|---|---|---|---|---|
| $100 | 1.00% | $24 | $92.73 | $93.66 | +1.01% |
| $500 | 0.20% | $24 | $92.73 | $92.91 | +0.20% |
On $100 buys, the fee adds 1.01% to the average cost, more than twice the 0.43% by which the averaging put the average cost below the simple average price. At $500 a month it shrinks to 0.20%.
US brokers such as Fidelity list $0 commission for online US stock and ETF trades. European brokers often charge per order: DEGIRO charges €1 per trade for ETFs in its core selection on Tradegate and €3 for most others, according to Curvo's breakdown. The fund's own expense ratio (0.06% a year for VT, per Vanguard's fact sheet) is a separate cost, and it is already inside the daily price, so it doesn't go into the formula.
If your broker charges per trade and your monthly amount is small, work out the fee as a percentage of one buy before you set up the order. At $1 on $100, buying every second month with $200 halves the drag to 0.50% and keeps the same yearly total going in. Then check what $500 a month grows to in 10, 20 and 30 years once fees and inflation are taken out.
Frequently asked questions
- How do you calculate dollar cost averaging?
- Divide each purchase amount by that day's price to get the shares it bought, add up all the shares, then divide the total amount invested by the total shares. With $500 a month into VT from January 2022 to December 2023, $12,000 bought 129.41 shares, an average cost of $92.73. In a spreadsheet, =SUM(B2:B25)/SUM(D2:D25) does it, with column D holding =B2/C2.
- Is the average cost the same as the average price?
- No. With a fixed amount per purchase, the average cost is the harmonic mean of the prices, which is never higher than their simple average and equal only if the price never moves. Over 24 months of VT closes from 2022 to 2023 the average cost was $92.73, 0.43% below the simple average price of $93.12 (on unrounded prices), because the same $500 bought more shares in the cheap months.
- Does dollar cost averaging work?
- It works as a way to invest money as it arrives, and it lowers your average cost below the average price. It does not reliably beat investing a lump sum at once: Vanguard's study of the MSCI World from 1976 to 2022 found the lump sum ahead about two-thirds of the time. In VT from January 2022 to December 2023 DCA won, +10.95% against +0.36%, because the price fell 23% and then recovered.
- Can you use dollar cost averaging when selling?
- Yes, but selling a fixed dollar amount each month sells more shares when the price is low, so your average sale price is the harmonic mean, the lower figure. On the same 24 VT closes, selling $500 a month averages $92.73 a share, while selling a fixed number of shares each month averages $93.12. For withdrawals, selling a fixed number of shares avoids that.
Free Financial Tools
Stay updated
Get notified when we publish new articles.
Related posts
How Long Do Bear Markets Last? The Fall vs the Recovery
Since 1993, S&P 500 bear markets took 14.5 months on average to hit bottom and 3.5 years to get back to the old high, with dates in dollars and euros.
Invest 500 a Month: What It Grows To in 10, 20, 30 Years
500 a month at 7% grows to about 86,500 in 10 years, 260,000 in 20 and 610,000 in 30. What fees and inflation leave you, and when growth beats deposits.
Should You Increase Your Monthly Investment Every Year?
A monthly ETF transfer frozen since 2020 buys about 22% less today, and a 10% savings rate drifts to about 8%. Automate the buy, not the amount.