# Progressive summing basing on cell value of another column

#### masud8956

##### Board Regular
Hi,

I have a range of numbers at A2:A10. Column B shows the progressive sum (e.g. B2=A2, B3=B2+A3, B4=B3+A4 etc). Column C will either be blank or have a certain text "ABC".

I would like the progressive sum result at column D instead of B with some criteria. I need a formula at D2 which I can fill down so that the progressive sum accounts for the text at Column C. e.g. As C4="ABC", I do not want the progressive sum of B3 and A4 (13+9=22) to be displayed at D4. I need it to be at D3. The text "ABC" will appear randomly in Column C. Since both C6 and C7 both are "ABC", I need the sum of B5, A6 and A7 to be displayed at D5.

When I obtain Column D as per the table below, it would also be nice to have a formula at E2 which I can fill down so that I get the display without blanks like shown in the table.

 A B C D E 1 Number Progressive Number Criteria Progressive (what I need) Progressive 2 5 5 5 5 3 8 13 22 22 4 9 22 ABC 39 5 6 28 39 41 6 4 32 ABC 7 7 39 ABC 8 2 41 41 9 10

<tbody>
</tbody>

Thanks.

Last edited:

### 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).

#### DanteAmor

##### Well-known Member

<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

Capture the array formulas in D2 and E2 and copy down.

#### Eric W

##### MrExcel MVP
Here are a couple non-array formulas that also work:

#### Eric W

##### MrExcel MVP
One caveat I should have mentioned. The E2 formula assumes that the values in A are all positive. If not, you'll need to go with Dante's formula. My D2 formula works fine either way.

#### masud8956

##### Board Regular
Thanks to both of you gentlemen for such nice solutions!! It is always great to have multiple options.

Almost worked for me. 2 little issues here:

@DanteAmor, The table you have provided at #2 , at D5 I am expecting 39 but when I am using the formula in my sample I am getting 32. Probably that is because of the "HOLIDAY" repeating at consecutive rows and the C7 is somehow getting ignored.

Code:
``[COLOR=#333333]{=IF([/COLOR][COLOR=Blue]C2<>"","",IF([COLOR=Red]C3="",B2,INDEX([COLOR=Green]B3:\$B\$9,COUNTIF([COLOR=Purple]C3:INDIRECT([COLOR=Teal]"C"&SMALL([COLOR=#FF00FF]IF([COLOR=Navy]C3:\$C\$9="",ROW([COLOR=Blue]C3:\$C\$9[/COLOR])[/COLOR]),1[/COLOR])[/COLOR]),"ABC"[/COLOR])[/COLOR])[/COLOR])[/COLOR][COLOR=#333333])}[/COLOR]``
The formula for Column E works just fine.

@Eric W, Both of your formula worked for me. But unfortunately, the "AGGREGATE" function is giving errors to some of my users who are using older versions of excel (which it should). I do not have control on which version of excel is being used by my users.

Thanks again!

Last edited:

#### masud8956

##### Board Regular
@DanteAmor,

I am sorry. Your formula is fine. I messed it up a little.

No need for modification. Thanks!!

#### DanteAmor

##### Well-known Member
@DanteAmor,

I am sorry. Your formula is fine. I messed it up a little.

No need for modification. Thanks!!

#### Eric W

##### MrExcel MVP
Without AGGREGATE, you'll need to use Control+Shift+Enter, but here's how to adapt my D2 formula:

=IF(C2<>"","",IF(C3="",SUM(A\$2:A2),SUM(A\$2:INDEX(A:A,MIN(IF(C3:C\$10="",ROW(C3:C\$10)))-1))))

It still has the benefit of not being volatile.

#### masud8956

##### Board Regular
Thank you @Eric W!

Formula is working nicely.