LAMBDA · Financial
APR to APY LAMBDA
xl.apy converts an APR and a compounding count into an APY. Six percent compounded monthly is 6.1678%, and the reverse returns the APR.
Syntax =xl.apy(rate, periods, [to])
=LAMBDA(rate,periods,[to],
LET(
direction, IF(ISOMITTED(to), "apy", IF(to="", "apy", LOWER(TRIM(to&"")))),
IF(OR(NOT(ISNUMBER(rate)), NOT(ISNUMBER(periods)), periods<=0, AND(direction<>"apy", direction<>"apr")), NA(),
IF(direction="apy", (1+rate/periods)^periods-1, periods*((1+rate)^(1/periods)-1)))
)
)Arguments
| Name | Required | What to pass |
|---|---|---|
| rate | Required | The rate as a decimal. 6% is 0.06, or a cell formatted as a percent. The default treats this as a nominal APR. Pass apr in the third argument when this number is already an APY. |
| periods | Required | Compounding periods per year. 1 is annual, 4 is quarterly, 12 is monthly, and 365 is daily. Any positive number is used as written. A fraction is not cut down to an integer. Zero or less returns |
| to | Optional | apy, the default, converts an APR into an APY. apr converts an APY back into the nominal APR for the same period count. Omit it, or pass a blank, for apy. Anything else returns |
Examples
6% nominal, compounded monthly, with the direction left out
=xl.apy(0.06, 12)Result 6.1678%
That effective rate, converted back to the nominal APR
=xl.apy(xl.apy(0.06, 12), 12, "apr")Result 6%
5% nominal, compounded monthly
=xl.apy(0.05, 12)Result 5.1162%
5% nominal, compounded daily
=xl.apy(0.05, 365)Result 5.1267%
6% nominal, compounded 12.9 times a year
=xl.apy(0.06, 12.9)Result 6.1689%
| A | B | |
|---|---|---|
| 1 | Nominal rate | 6% |
| 2 | Periods per year | 12 |
| 3 | Effective rate | 6.1678% |
xl.apy converts a nominal annual rate and a compounding count into the effective annual rate. Six percent compounded monthly is 6.1678%. That is (1 + 0.06/12)^12 - 1, the same figure EFFECT returns for EFFECT(0.06, 12). Pass "apr" and the name runs the conversion back, which is what NOMINAL does. Leave the third argument out for the effective rate. This is not a quoted savings yield, and it is not a forecast.
The 5% on How to calculate compound interest in Excel and on xl.compound.fv is a nominal rate compounded monthly. xl.apy(0.05, 12) is 5.1162%. That effective rate already includes the monthly compounding. Passing it into xl.compound.fv as a new nominal rate compounds it a second time.
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.apy, 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.apy(...). Leave the last argument out to turn an APR into an APY. The brackets on to make that argument optional, and ISOMITTED is the test that supplies apy. A blank cell passed as the direction is also apy.
The sample workbook, with the name already saved, is apr-to-apy.xlsx. Its Result column is the Excel 2021 formula below, aimed at the yellow inputs. In Microsoft 365 that column can be =xl.apy(B5,C5) when the direction is omitted, or =xl.apy(B5,C5,D5) when D5 says apr.
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. With the rate in B2, the periods in C2, and the direction in D2, Excel 2021 can use this instead. A blank direction returns the APY.
=IF(OR(NOT(ISNUMBER(B2)),NOT(ISNUMBER(C2)),C2<=0),NA(),IF(OR(D2="",LOWER(TRIM(D2&""))="apy"),(1+B2/C2)^C2-1,IF(LOWER(TRIM(D2&""))="apr",C2*((1+B2)^(1/C2)-1),NA())))
How it works
A nominal rate of 6% compounded monthly credits 0.06/12 each month. Twelve of those credits grow one dollar to (1.005)^12, which is 1.06167781…. Subtract 1 and the effective rate is 6.1678% when a percent format shows four decimals. The reverse divides that growth back into twelve equal nominal credits. xl.apy(xl.apy(0.06, 12), 12, "apr") returns the 6% nominal rate. The periods on the way back have to be the periods that built the APY. Twelve on one side and four on the other is a different rate.
EFFECT and NOMINAL truncate the period count to an integer. The EFFECT page says a fraction is cut down, so 12.9 is treated as 12. EFFECT(0.06, 12.9) is the same 6.1678% as EFFECT(0.06, 12). This name does not truncate. xl.apy(0.06, 12.9) is 6.1689%. Use the count the contract states. If the contract says monthly, pass 12, not 12.9.
The rate is a decimal. A cell formatted as a percent stores 6% as 0.06, and that cell is the right input. The number 6 is 600%. xl.apy(6, 12) is (1.5)^12 - 1, about 12,874.63%.
Continuous compounding is the limit as the period count grows without bound. That limit is EXP(rate) - 1. EXP of 5% is about 5.1271%. Daily compounding of the same 5%, xl.apy(0.05, 365), is 5.1267%. EFFECT has no way to ask for the continuous limit. A very large period count is still a finite count, and EFFECT would truncate it to an integer before using it.
A zero nominal rate returns 0. There is nothing to compound. EFFECT returns #NUM! for a rate of 0. This name returns the mathematical result, which is zero.
Limits
The deposits on the compound-growth page are monthly even when the quoted rate compounds daily. This name only converts the rate. It does not grow a balance, and it does not apply a monthly deposit. A bank’s quoted APY is already effective. Do not run it through this name as if it were a nominal APR unless the third argument is apr and the period count is the one the bank used.
Inflation is not subtracted. Nothing here is a tax-deferred account. The compound interest calculator is a separate workbook. Its sample nominal rate is the same 5%.