Sum of value * qty based on a determined figure

AkelaWolf76

New Member
Joined
Aug 15, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
'=sum of qty*value but only up to X qty

I have a qty column and a value column and an trying to find the total value of a section of this based on a given requested qty
 

Attachments

  • Screenshot 2025-03-17 134423.png
    Screenshot 2025-03-17 134423.png
    27.2 KB · Views: 12
Hello, what is supposed to happen when there is remainder - e.g. the target quantity is 13 but the running totals are 12 - 15?
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Sum of value * qty based on a determined figure
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Hello, what is supposed to happen when there is remainder - e.g. the target quantity is 13 but the running totals are 12 - 15?
if I am looking to return on qty "13" the values of 12-15 would need to based on the value of where 13 lands
eg if I require 5 then the return should be £500 but if I require 11, it should return £1400, 15 should be £2500 etc
 
Upvote 0
Hello again, many thanks for the clarification. Please test the following:

Excel Formula:
=LET(
n,A3,
q,A5:A17,
v,B5:B17,
a,MAKEARRAY(ROWS(q),MAX(q),LAMBDA(r,c,IF(c<=CHOOSEROWS(q,r),CHOOSEROWS(v,r),NA()))),
SUM(TAKE(TOCOL(a,2),n)))
 
Upvote 0
Hello again, many thanks for the clarification. Please test the following:

Excel Formula:
=LET(
n,A3,
q,A5:A17,
v,B5:B17,
a,MAKEARRAY(ROWS(q),MAX(q),LAMBDA(r,c,IF(c<=CHOOSEROWS(q,r),CHOOSEROWS(v,r),NA()))),
SUM(TAKE(TOCOL(a,2),n)))
That has worked perfectly. Many thanks
 
Upvote 0

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