Sum Cumulative that restarts with if there a 0.

eatv1000

New Member
Joined
Apr 3, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Good day,

I am trying to get the sum cumulative of a row but restarts if cell value is 0. What's the formula to get the Sum cumulative of product A? Column A is the name of the product and column b is the value. I don't know how to explain it but here's the example.


Product A 1
Product B 1
Product B 1
Product A 0
Product A 1
Product A 1

Sum Cumulative = 2
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,
You can test in cell B8 following formula
Excel Formula:
=SUM(INDIRECT("B"&LOOKUP(2,1/(B1:B6=0),ROW(A1:A6))+1):B6)
 
Upvote 1
Hi & welcome to MrExcel.
What is the expected result if the data was like this
Product A 1
Product B 1
Product B 1
Product B 0
Product A 1
Product A 1
 
Upvote 0
Hi & welcome to MrExcel.
What is the expected result if the data was like this
Product A 1
Product B 1
Product B 1
Product B 0
Product A 1
Product A 1
3 should be the result.
 
Upvote 0
Hi,
You can test in cell B8 following formula
Excel Formula:
=SUM(INDIRECT("B"&LOOKUP(2,1/(B1:B6=0),ROW(A1:A6))+1):B6)
A 0
B 1
B 1
A 1
A 1
A 1

Thank you for you response. I tried the formula above and the result is 5 when it should be 3 since I am only summing the Product A.
 
Upvote 0
How about
Fluff.xlsm
ABCD
1
2A13
3B1
4B1
5B0
6A1
7A1
8
Lists
Cell Formulas
RangeFormula
D2D2=MAX(SCAN(0,FILTER(B2:B100,A2:A100="A"),LAMBDA(a,b,IF(b=0,0,a+b))))


Fluff.xlsm
ABCD
1
2A12
3B1
4B1
5A0
6A1
7A1
8
Lists
Cell Formulas
RangeFormula
D2D2=MAX(SCAN(0,FILTER(B2:B100,A2:A100="A"),LAMBDA(a,b,IF(b=0,0,a+b))))
 
Upvote 0
How about
Fluff.xlsm
ABCD
1
2A13
3B1
4B1
5B0
6A1
7A1
8
Lists
Cell Formulas
RangeFormula
D2D2=MAX(SCAN(0,FILTER(B2:B100,A2:A100="A"),LAMBDA(a,b,IF(b=0,0,a+b))))


Fluff.xlsm
ABCD
1
2A12
3B1
4B1
5A0
6A1
7A1
8
Lists
Cell Formulas
RangeFormula
D2D2=MAX(SCAN(0,FILTER(B2:B100,A2:A100="A"),LAMBDA(a,b,IF(b=0,0,a+b))))
Thank you so much. ☺️
What if the data is like this?

A 1
B 1
A 0
B 1
B 1
A 0
A 1
A 0
 
Upvote 0
How about
Excel Formula:
=TAKE(SCAN(0,FILTER(B2:B100,A2:A100="A"),LAMBDA(a,b,IF(b=0,0,a+b))),-1)
 
Upvote 0
A 0
B 1
B 1
A 1
A 1
A 1

Thank you for you response. I tried the formula above and the result is 5 when it should be 3 since I am only summing the Product A.
Shame you did not mention " Only for A " in your first message ...
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,301
Members
449,095
Latest member
Chestertim

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