SUM Until Another Cell is 0

WeeRab

New Member
Joined
Feb 28, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I'm trying to add cells between a range but I not sure how I can do this? Attached is a screenshot of the table I am working on.

1646050624581.png


I need to create a formula that will add values from row 6 until there is a value in row 8. For example, the orange cell is equal to the red cell, minus the sum of the grey cells, and the same with the green, purple and blue cells. But to do this I had to manually adjust the equation. I need to find a dynamic equation that changes depending on the values that populate the table.

I'm relatively new to using excel in this way, so any help would be appreciated :)
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Put this formula in C10 and fill to the right:

Excel Formula:
=IF(C8=0,0,C8-SUM(OFFSET(C6,0,0,1,MATCH(TRUE,INDEX(D8:$I8<>0,),0))))

$scratch.xlsm
ABCDEFGHI
1
2
3
4
5
6302058020
7
85505000050
9
10503500050
Sheet5
Cell Formulas
RangeFormula
C10:H10C10=IF(C8=0,0,C8-SUM(OFFSET(C6,0,0,1,MATCH(TRUE,INDEX(D8:$I8<>0,),0))))
I10I10=IF(I8=0,0,I8-SUM(OFFSET(I6,0,0,1,MATCH(TRUE,INDEX($I8:J8<>0,),0))))
 
Upvote 0
Solution
Put this formula in C10 and fill to the right:

Excel Formula:
=IF(C8=0,0,C8-SUM(OFFSET(C6,0,0,1,MATCH(TRUE,INDEX(D8:$I8<>0,),0))))

$scratch.xlsm
ABCDEFGHI
1
2
3
4
5
6302058020
7
85505000050
9
10503500050
Sheet5
Cell Formulas
RangeFormula
C10:H10C10=IF(C8=0,0,C8-SUM(OFFSET(C6,0,0,1,MATCH(TRUE,INDEX(D8:$I8<>0,),0))))
I10I10=IF(I8=0,0,I8-SUM(OFFSET(I6,0,0,1,MATCH(TRUE,INDEX($I8:J8<>0,),0))))

Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,810
Members
449,339
Latest member
Cap N

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