Excel Formula to Calculate Payback Period

acool

Board Regular
Joined
Feb 10, 2023
Messages
107
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I am currently trying to create an excel formula which calculates the Payback Period (Months) based on a a Total Purchase Amount of $4.8M using the inputs A7:C7. While I would normally use a sum product to multiply monthly unit sales by Contribution margin divide that by the total purchase amount to get to the payback period , this differs in the fact that their is a limited number of months on hand for each of the products. For Example, Product #1 only has 8 months of units on hand, and can therefore only have contribution margin dollars for 8 Months. I have exemplified this idea in the table below which breaks down at which month CM for each of the products. I am curious if there is a way to incorporate this idea into a simplified excel formula. Based on the more manual table created below, the payback period should be 10 months. Any help would be greatly appreciated. Thank You!

1702612977022.png
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
One option would be a simple Goal Seek:

Book6
ABC
1
26,3008$23.15
35,2009$5.55
44,80013$36.90
55,50014$6.65
62,10024$39.65
73,25025$14.90
8
9Months1.0
10Amount520,090
Sheet1
Cell Formulas
RangeFormula
C10C10=SUMPRODUCT(IF(B2:B7<N,B2:B7,N),A2:A7,C2:C7)
Named Ranges
NameRefers ToCells
N=Sheet1!$C$9C10

1702614447042.png

--->

6,3008$23.15
5,2009$5.55
4,80013$36.90
5,50014$6.65
2,10024$39.65
3,25025$14.90
Months9.9
Amount4,833,000
 
Upvote 0
Solution
How about?:
Excel Formula:
=LET(
s;A2:A7*C2:C7;
m;B2:B7;
ms;SEQUENCE(;MAX(m));
res;s*(ms<=m);
VSTACK(ms;IF(res<>0;res;""))
)
 
Upvote 0
How about?:
Excel Formula:
=LET(
s;A2:A7*C2:C7;
m;B2:B7;
ms;SEQUENCE(;MAX(m));
res;s*(ms<=m);
VSTACK(ms;IF(res<>0;res;""))
)
@felixstrabue I am getting an error code. Is this excel VBA code?
 
Upvote 0
One option would be a simple Goal Seek:

Book6
ABC
1
26,3008$23.15
35,2009$5.55
44,80013$36.90
55,50014$6.65
62,10024$39.65
73,25025$14.90
8
9Months1.0
10Amount520,090
Sheet1
Cell Formulas
RangeFormula
C10C10=SUMPRODUCT(IF(B2:B7<N,B2:B7,N),A2:A7,C2:C7)
Named Ranges
NameRefers ToCells
N=Sheet1!$C$9C10

View attachment 103549
--->

6,3008$23.15
5,2009$5.55
4,80013$36.90
5,50014$6.65
2,10024$39.65
3,25025$14.90
Months9.9
Amount4,833,000
@StephenCrump Thank you this works! However, do you know if it is possible to divide the total purchase value by your sumproduct formula to get the desired payback months. I would like to have this automatically update if the purchase value in H1 changes. Thank you both for your help so far!
 
Upvote 0
It is just a excel formula. but sorry the ";" should be ",". This should work, but i'm not sure that it is what you wan't:

Excel Formula:
=LET(s, A2:A7 * C2:C7, m, B2:B7, ms, SEQUENCE(, MAX(m)), res, s * (ms <= m), VSTACK(ms, IF(res <> 0, res, "")))
 
Upvote 0
It is just a excel formula. but sorry the ";" should be ",". This should work, but i'm not sure that it is what you wan't:

Excel Formula:
=LET(s, A2:A7 * C2:C7, m, B2:B7, ms, SEQUENCE(, MAX(m)), res, s * (ms <= m), VSTACK(ms, IF(res <> 0, res, "")))
This is great too! This helps to autopopulate the table at the bottom which I had to create manually. This was actually my next question, so thanks for providing this. However, I am currently trying to determine the number of months achieve the total purchase price with the knowledge that some of the products have a limited number of months on hand. For example, you will only be able to recognize contribution margin dollars for the first 8 months. After those 8 months I would no longer like that product to be included in the calculation. So G1/(Sumproduct(A2:A7,C2:C7) BUT only for the max number of Months on hand
 
Upvote 0
I would like to have this automatically update if the purchase value in H1 changes. Thank you both for your help so far!
You could trap the value change in H1 with Worksheet_Change code, and run the Goal Seek from VBA.

Or continuing with @felixstraube's approach, and using the layout in Post #2, use a formula:

=XMATCH(C11,SCAN(0,BYCOL((B2:B7>=SEQUENCE(,MAX(B2:B7)))*(A2:A7*C2:C7),LAMBDA(c,SUM(c))),LAMBDA(a,b,a+b)),1)
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top