0

I'm trying to create an Excel formula that will create a sum whose range is based on the contents of a different cell. So for example I have the following data:

Example data

The "Yes's" are based on criteria from another part of the Excel sheet, and will not always be in the same places. I want to be able to sum the values "between" the "Yes's", so in this case C9=SUM(B1:B9) and C21=SUM(B10:B21). Any ideas?

7
  • Why does one include the "Yes" row and the other not? Commented Sep 12, 2016 at 15:35
  • "Yes" is telling me that there is a corresponding value in another sheet, and it's between these values that I need to count instances another element. Commented Sep 12, 2016 at 15:48
  • Yes, but you are not including row(10) in the first but including row(21) in the second as the last row. I assumed in my answer that the "Yes" should actually be in the row under the last value to be summed. Commented Sep 12, 2016 at 15:49
  • Yeah, row 21 should not be included in the second summation. This is just an example, the values could continue on Commented Sep 12, 2016 at 16:03
  • Then my formula will work for you. Commented Sep 12, 2016 at 16:07

1 Answer 1

2

Put this formula in C1:

=IF(A2="Yes",SUM($B$1:INDEX(B:B,ROW()))-SUM($C$1:INDEX(C:C,ROW()-1)),"")

Then copy down.

![enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.