• 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.

Sum column cells until specified value is reached

NicoleO

New Member
Hi Guys,

I need some help with the below formula.

I was develop to sum horizontally and I cat seem to change it to work vertically.

Please assist.

=LOOKUP(H2,SUBTOTAL(9,OFFSET(A2,,,,COLUMN($A$1:$G$1))))

Lookup value should be based n b12
 

Attachments

Peter Bartholomew

Well-Known Member
Wow. The original formula is full of functions that I rarely use [LOOKUP, SUBTOTAL, OFFSET, ROW] and don't really understand why it should work.
I did get to
Code:
=LOOKUP(B$12,SUBTOTAL(9,OFFSET(B$5,,,ROW($A$5:$A$11)-4,)))
@bosco_yip Can you explain why an array of overlapping ranges does not throw an error?

If I were writing the formula for myself I would go with
Code:
= LOOKUP(limit,
    SCAN(0,values,
      LAMBDA(acc,val,acc+val)
    )
  )
LOOKUP earned its keep in place of XLOOKUP!
 
Top