How do a add a group of numbers in reverse until a condition is met?

Water Billing

New Member
Joined
Apr 2, 2019
Messages
1
I am trying to add a group of numbers together until I reach a 0 in a cell; however, I am starting with the last number in a column and going in reverse.

[TABLE="width: 10"]
<tbody>[TR]
[TD]100[/TD]
[/TR]
[TR]
[TD]200[/TD]
[/TR]
[TR]
[TD]300[/TD]
[/TR]
[TR]
[TD]0[/TD]
[/TR]
[TR]
[TD]450[/TD]
[/TR]
[TR]
[TD]200[/TD]
[/TR]
[TR]
[TD]600[/TD]
[/TR]
</tbody>[/TABLE]

i.e. I would like to start with the last number (600) and add until I reach a zero (600+200+450). Can someone help me? Thank you.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Welcome to Mr Excel forum

Try


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Numbers​
[/td][td][/td][td]
Formula​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
100​
[/td][td][/td][td]
1250​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
200​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
300​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
0​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
450​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
200​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
600​
[/td][td][/td][td][/td][/tr]
[/table]


Formula in C2
=SUM(INDEX(A2:A8,LOOKUP(2,1/(A2:A8=0),ROW(A2:A8)-ROW(A2)+1)):A8)

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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