Sum values only if consecutive numbers

rachelih

New Member
Joined
Nov 11, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Row 39 which varies by month (across columns) has some months with values and some without:

1605105692028.png


GOAL: I would like to have a formula in cell G41 that sums row 39 (highlighted) ONLY IF there are 6 consecutive months where values in row 39 are greater than 0. In other words, G41 should total to $544,560.
 
I can do a helper row.
Try this. Assumption is that F3 does not contain a 1.

rachelih.xlsm
FGHIJKLMNOPQR
1
25,8990029,455042,51293,41552,24268,938141,41692,67853,359
3000001111111
4
5544,560
Sheet1
Cell Formulas
RangeFormula
G3:R3G3=IF(G2>0,IF(F3=1,1,IF(AND(COLUMNS(G2:$R2)>5,COUNTIF(G2:L2,">0")>5),1,0)),0)
G5G5=SUMIF(G3:R3,1,G2:R2)
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You're welcome. Thanks for the follow-up. :)

If you are interested, a marginally shorter formula (1 less function call) for the helper row.

rachelih.xlsm
FGHIJKLMNOPQR
1
25,8990029,455042,51293,41552,24268,938141,41692,67853,359
3000001111111
4
5544,560
Sheet3
Cell Formulas
RangeFormula
G3:R3G3=--OR(AND(COLUMNS(G2:$R2)>5,COUNTIF(G2:L2,">0")>5),AND(G2>0,F3=1))
G5G5=SUMIF(G3:R3,1,G2:R2)
 
Upvote 0

Forum statistics

Threads
1,215,746
Messages
6,126,647
Members
449,325
Latest member
Hardey6ix

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