• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Complex Excel Formula Required

vishal1979

New Member
I need an Excel formula that sums quantities from column N, starting from the date specified in cell D4 and continuing until reaching the quantity specified in cell H4. When the target quantity is reached, return the corresponding date from column M in cell I4. Sample excel file attached.
 

Attachments

  • Calulation.xlsx
    48.7 KB · Views: 3

vishal1979

Just confirm that You noticed
Post an Excel related Challenge for others to Solve (You must have a solution) Don't post questions here!
and still You need something?
Do You have a solution?
 
One way:
Code:
=LET(a,FILTER(M4:N753,M4:M753>=D4),b,SCAN(0,TAKE(a,,-1),LAMBDA(c,d,c+d)),e,XLOOKUP(H4,b,TAKE(a,,1),,1),e)
See cell I7 with that formula.
Cell I4 has the named lambda equivalent with hints as to what belongs in the arguments:

1713379239198.png
 

Attachments

  • Chandoo56720Calulation.xlsx
    25.2 KB · Views: 9
Last edited:

vishal1979

Are You still looking for Your own solution for this challenge?
You asked something complex ...
instead that, could You use something like below?
=INDEX(M:M,MATCH(D4,M:M,0)+ROUND((H4-E4)/N4,0))
 
One way:
Code:
=LET(a,FILTER(M4:N753,M4:M753>=D4),b,SCAN(0,TAKE(a,,-1),LAMBDA(c,d,c+d)),e,XLOOKUP(H4,b,TAKE(a,,1),,1),e)
See cell I7 with that formula.
Cell I4 has the named lambda equivalent with hints as to what belongs in the arguments:

View attachment 87035
Hi Pascal
It appears that I have simply matched you step by step
Code:
= LET(
    filtered,     FILTER(data, timeline>=startDate),
    accumulated,  SCAN(0, TAKE(filtered,,-1), SUM),
    filteredDate, TAKE(filtered,,1),
    XLOOKUP(target, accumulated, filteredDate,,1)
  )
There is a slight difference because I had an eta reduced lambda available for use. I also fell short of your standards in that I failed to wrap the formula within a final Lambda function to get
Code:
= ChangeOutDateλ(data, startDate, target)
 
Hi Pascal
It appears that I have simply matched you step by step
Code:
= LET(
    filtered,     FILTER(data, timeline>=startDate),
    accumulated,  SCAN(0, TAKE(filtered,,-1), SUM),
    filteredDate, TAKE(filtered,,1),
    XLOOKUP(target, accumulated, filteredDate,,1)
  )
There is a slight difference because I had an eta reduced lambda available for use. I also fell short of your standards in that I failed to wrap the formula within a final Lambda function to get
Code:
= ChangeOutDateλ(data, startDate, target)
 
Back
Top