Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to sum until obtain one given value considering conditions on other columns using excel?

I have this table:

enter image description here

    measure Retrofit cost   Savings PER MONTH
1   1000    400
2   1300    207
3   1500    232
4   1100    215
5   1000    241
6   1500    277
7   1000    354
8   900 364
9   1500    427
10  1000    440
11  1300    201
12  2000    460
13  1000    373
14  1300    272
15  1500    250
16  3000    314
17  1300    390
18  1000    490

how to sum "Retrofit Cost" values until reach a given value – let’s say 6000 – considering the highest "savings per month" values. So this would be:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

measure 18+measure12+measure10+measure9=5500.

if we sum the next higher savings value would go over 6000.

>Solution :

=TAKE(SCAN(0,TAKE(SORT(B1:C18,2,-1),,1),LAMBDA(a,b,IF((a+b)<=6000,a+b,a))),-1,1)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading