LAMBDA · Financial
CAGR LAMBDA
xl.cagr returns the compound annual growth rate. $1,000 growing to $1,628.894627 in 10 years is 5% a year, the same rate as RRI and the POWER page.
Syntax =xl.cagr(start_value, end_value, years)
=LAMBDA(start_value, end_value, years,
LET(
growth, end_value / start_value,
IF(OR(start_value<=0, end_value<=0, years<=0), NA(), growth ^ (1 / years) - 1)
)
)Arguments
| Name | Required | What to pass |
|---|---|---|
| start_value | Required | The beginning amount. It must be positive. |
| end_value | Required | The ending amount. It must be positive. |
| years | Required | How many years between the two amounts. |
Examples
Ten years of 5% growth
=xl.cagr(1000, 1628.894627, 10)Result 5%
| A | B | |
|---|---|---|
| 1 | Start | 1000 |
| 2 | End | 1628.894627 |
| 3 | Years | 10 |
| 4 | CAGR | 0.05 |
xl.cagr is the annual rate that compounds from a start amount to an end amount. One thousand dollars becoming $1,628.894627 in ten years is 5% a year. That ending figure is the exact 1000 × 1.05^10 from the POWER page, before it is rounded to $1,628.89.
RRI does this calculation and has since Excel 2013. The LAMBDA exists because people search for CAGR, and because a negative or zero input should be #N/A instead of a #NUM! they then wrap in IFERROR.
Add it to the workbook
Copy the formula in the block above, including the line breaks. Choose Formulas, Name Manager, New. Set the name to xl.cagr, the scope to Workbook, and paste into Refers to. Excel Labs can do the same step: open the Advanced Formula Environment, add that name, and save it back to the workbook. A cell then calls =xl.cagr(...).
The name needs Microsoft 365, Excel 2024, or Excel for the web. Excel 2021 returns #NAME? for LAMBDA even when it already has XLOOKUP, FILTER, or LET.
How it works
The ratio of the end to the start is the total growth factor. Raising it to 1 / years is the annual factor. Subtract 1 and you have the rate. Five percent is 0.05 until you format it as a percent.
Limits
The years have to be the real span. Using 10 for a period that started in July and ended in January overstates the rate. Deposits in the middle are not a CAGR. They are an IRR problem. Both amounts have to be positive. STOCKHISTORY can fetch a price history in Microsoft 365. This name still wants the starting amount and the ending amount, not the spill.