Keystroke Labs

NPV and IRR on the HP 12C with uneven cash flows (CFo, CFj, Nj)

Clear everything with f CLEAR REG, enter the initial flow with g CFo (negative for an investment), each later flow with g CFj (g Nj repeats one), the rate in i, then f NPV (16,748.73) and f IRR (21.84%).

fCLEAR REGCLx50000CHSgPVCF₀15000gPMTCFj18000gPMTCFj3gFVNj20000gPMTCFj10ifNPVPVfIRRFV

Numbers checked on 2026-11-23Works on: HP 12C, 12C Gold and 12C Platinum in RPN mode

The HP 12C keeps cash flows in its storage registers: gPVCF₀ (CFo) stores the flow at time 0, each gPMTCFj (CFj) stores the next one, and gFVNj (Nj) says how many times in a row the last one repeats. fNPVPV then gives the NPV at the rate in i, and fIRRFV the IRR.

Example: NPV and IRR of a project

A project costs 50,000 today and returns 15,000 in year 1, 18,000 in each of years 2 to 4, and 20,000 in year 5. Is it worth it at a 10% cost of capital, and what is its IRR?

StepKeysDisplay showsWhat it does
1fCLEAR REGCLx0.00CLEAR REG: erase old cash flows and registers.
250000CHSgPVCF₀-50,000.00CF0: the investment today, negative.
315000gPMTCFj15,000.00CF1: year 1.
418000gPMTCFj18,000.00CF2: year 2.
53gFVNj3.00Nj: the 18,000 happens 3 times in a row (years 2, 3 and 4).
620000gPMTCFj20,000.00The flow of year 5.
710i10.00Discount rate: 10% per period.
8fNPVPV16,748.73NPV at 10%.
9fIRRFV21.84IRR in % per period (the display may show "running" for a few seconds on a real calculator).

The NPV at 10% is 16,748.73: positive, so the project earns more than 10%. The IRR is 21.84% a year. Both are "per period": with monthly flows, i and the IRR are monthly rates.

Got a different number?

These are the wrong results this example gives when one thing is off. Each one was produced by replaying the mistake on our engine.

You seeWhyFix
116,748.73CF0 was entered as positive (CHS forgotten), so the investment is counted as money received.Key the investment with CHS before gPVCF₀. With every flow positive, IRR gives Error 7.
-6,461.31The 18,000 was entered once without Nj, so years 3 and 4 are missing and the 20,000 lands in year 3.After a repeated flow press 3gFVNj, or press 18000gPMTCFj three times.
38,723.66The rate was keyed as a decimal (0.1). i takes percent.10i for 10%.
0.00PV was pressed without f. That stores or computes the TVM present value, not the NPV.NPV is the gold function: fNPVPV.

Checking what you entered

The HP 12C reviews flows from the last one back: RCLgFVNj shows the Nj of flow n, and RCLgPMTCFj shows flow n and lowers n by one. Because n goes down, store the number of flows in n again when you finish.

StepKeysDisplay showsWhat it does
1RCLn3.00How many flows (groups) follow CF0: 3 (15,000; 18,000 × 3; 20,000).
2RCLgFVNj1.00Nj of the last flow.
3RCLgPMTCFj20,000.00The last flow; n drops to 2.
4RCLgFVNj3.00Nj of flow 2.
5RCLgPMTCFj18,000.00Flow 2; n drops to 1.
63n3.00Put the count back before computing NPV or IRR.

To correct a flow, store the new amount in its register: 16000STO2 replaces flow 2. If an Nj or the order is wrong, the simplest fix is fCLEAR REGCLx and entering the flows again.

Limits and messages

See all messages on HP 12C error codes.

Related

How we checked this page: every display above comes from replaying the keys on a tested engine, and the final answer is compared with an independent formula. How we check every answer.