Cellwise Start free

Excel guide · 5 min read

How to calculate the payback period in Excel

Quick answerAdd a cumulative cash flow column, find the last year it is still negative, and add the fraction of the next year needed to cover what is left: years before payback + unrecovered amount / next year's cash flow. For an 85,000 machine that has 9,000 left to recover after year 3 and brings in 24,000 in year 4, payback is 3 + 9,000/24,000 = 3.375 years.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFGHIJK
1YearCash flowCumulativeDiscountedCum. discountedCrossingWith overhaulCumulativeCrossingDiscount rate0.08
20-85000-85000-85000-85000-85000-85000
3122000-6300020370.37037-64629.6296322000-63000
4226000-3700022290.809328-42338.82030226000-37000
5328000-900022227.302749-20111.5175533.37528000-90003.375
64240001500017640.716467-2470.80108612400015000
75200003500013611.66394111140.862855-25000-100005.5555555556
86180005300011343.05328422483.916138180008000

Download this sheet as an Excel practice file (.xlsx)

Step 1: a cumulative cash flow column

List the years in A, starting at 0 for the upfront cost, and each year's net cash flow in B: the investment as a negative, then the yearly savings or extra profit as positives. The example is an 85,000 packaging machine expected to bring in 22,000, 26,000, 28,000, 24,000, 20,000 and 18,000 over six years.

In C2 enter =B2, then in C3 =C2+B3 and fill down. The cumulative total starts at -85,000 and climbs: -63,000, -37,000, -9,000, then 15,000 in year 4. Payback happens somewhere in the year where it turns from negative to positive.

=C5

Result: -9000

-9,000: after three years, 9,000 of the 85,000 is still not recovered.

Step 2: the fractional year with one formula (Excel 365)

XMATCH finds the first row where the cumulative total reaches zero or more; one row before that is the last negative year. LET names that position n, then the formula takes that year and adds the unrecovered amount divided by the next year's cash flow.

The fraction assumes cash comes in evenly through the year. That is the usual convention for payback; if your savings are seasonal, work in months or quarters instead of years.

In Excel 2019 or earlier there is no LET or XMATCH. Use the helper column in the next step, or MATCH(TRUE,C2:C8>=0,0), which must be entered with Ctrl+Shift+Enter in those versions.

=LET(n,XMATCH(TRUE,C2:C8>=0)-1,INDEX(A2:A8,n)-INDEX(C2:C8,n)/INDEX(B2:B8,n+1))

Result: 3.375

3.375 years: 3 full years plus 9,000 / 24,000 of year 4. In months, =ROUNDUP(3.375*12,0) is 41: the machine has paid for itself during month 41.

Step 3: a helper column you can see (any version)

If you want the logic on the sheet, add a Crossing column. In F2 enter =IF(AND(C2<0,C3>=0),A2-C2/B3,"") and fill down to the row before the last year. It stays blank except in the year where the cumulative total crosses zero, where it shows the payback.

Then =MAX(F2:F7) picks out the number. A visible column is easier to audit than one long formula, and it works in every version of Excel.

=MAX(F2:F7)

Result: 3.375

3.375, the same payback as the LET formula. Only F5 has a value; the other rows are empty text, which MAX ignores.

When cash flow dips negative later

Real projects are not always a clean climb. Columns G and H show the same machine with a 45,000 overhaul in year 5, so that year's net flow is -25,000. The cumulative total goes positive in year 4 (15,000), back to -10,000 in year 5, and positive again in year 6 (8,000).

The first crossing still says 3.375 years, which is optimistic: the money is not truly recovered until year 6. To find the last crossing, search from the bottom with XMATCH's search mode -1, or use MAX on the helper column in I, which has two crossings (3.375 and 5.56) and returns the later one.

A popular shortcut, COUNTIF(H3:H8,"<0") to count the negative years, breaks here too: it counts four negative years and gives 4.6, a payback that matches neither crossing.

=LET(n,XMATCH(TRUE,H2:H8<0,0,-1),ROUND(INDEX(A2:A8,n)-INDEX(H2:H8,n)/INDEX(G2:G8,n+1),2))

Result: 5.56

5.56 years: 5 years plus the 10,000 still owed / 18,000 from year 6. If the last cumulative value is negative, the project never pays back in the horizon; test for that first with =IF(H8<0,"Not paid back",...).

Discounted payback

Plain payback treats 24,000 in year 4 as worth the same as 24,000 today. Discounted payback converts each year's cash flow to today's money first, using a discount rate in an input cell. K1 holds 8% as an example; use the rate your business uses for investment decisions.

In D2, =B2/(1+$K$1)^A2 discounts each year's flow (year 0 is divided by 1, so it stays -85,000). Build the cumulative column E exactly as before, then run the same payback formula on D and E. After year 4 the discounted total is still -2,471, and year 5's 20,000 is worth 13,612 today.

Discounted payback is always longer than plain payback when the rate is above zero. It still ignores everything after the payback year, so pair it with NPV if the later years matter.

=LET(n,XMATCH(TRUE,E2:E8>=0)-1,ROUND(INDEX(A2:A8,n)-INDEX(E2:E8,n)/INDEX(D2:D8,n+1),2))

Result: 4.18

4.18 years at 8%, against 3.375 years without discounting.

Which method to pick

Equal cash flows every year: cost divided by the yearly amount is enough. Uneven flows: the cumulative column with the fractional year. Any year after payback can go negative (an overhaul, a replacement, a lost contract): find the last crossing, not the first. Comparing projects or long horizons: add discounted payback, and look at NPV and IRR as well, because payback says nothing about the cash after the payback date.

Payback answers "how long is our money at risk?". A project with a 2-year payback and nothing after it can be worse than a 4-year payback that keeps paying for a decade.

Common mistakes

Dividing the cost by the average cash flow

85,000 / AVERAGE(B3:B8) gives about 3.7 years, not 3.375, because the big early years and small later years are averaged together. Only use cost / yearly flow when every year is the same.

Rounding up to whole years

Reporting "4 years" hides that the money comes back about a quarter into year 4. Show the fraction, or convert to months with ROUNDUP(years*12,0).

Leaving the investment out of year 0

The upfront cost must be the first, negative value in the cumulative column. Starting at year 1 shifts every answer by a year.

A #N/A when the project never pays back

XMATCH finds no row with a cumulative total of 0 or more. Wrap the formula in IFERROR(...,"Not paid back") or test the last cumulative value first.

FAQ

What is the formula for payback period in Excel?

With even cash flows, cost / yearly cash flow. With uneven flows, build a cumulative column and use years before payback + unrecovered amount / next year's cash flow, for example =LET(n,XMATCH(TRUE,C2:C8>=0)-1,INDEX(A2:A8,n)-INDEX(C2:C8,n)/INDEX(B2:B8,n+1)).

Is there a payback period function in Excel?

No. Excel has NPV, IRR and their dated versions, but no PAYBACK function. You build it from a cumulative total and a lookup, as shown above.

How do I calculate discounted payback period in Excel?

Discount each year's cash flow with =B2/(1+rate)^year, build a cumulative total of the discounted values, and apply the same fractional-year formula to those columns.

How do I show the payback period in years and months?

Split the decimal: =INT(F)&" years "&ROUND(MOD(F,1)*12,0)&" months", where F is the payback cell. 3.375 years reads as 3 years 5 months (0.375 × 12 = 4.5, which ROUND takes up to 5).

What is a good payback period?

It depends on the business and how risky the project is. Compare against a cutoff your organization sets in an input cell, and check NPV too, since payback ignores cash after the payback date.

Functions used

Related guides

Updated