Count the occurrences of rainfall over 2 inches within a two day period.

tdpalmer

New Member
Joined
Jul 18, 2016
Messages
16
I have a table with date in column A and amount of rainfall in column B. In column C I need to count if there is an occurrence of rainfall over 2 inches in a consecutive two day period. If the rainfall does exceed 2 inches it is counted and the calculation starts over for the subsequent days. [if on Monday it rained .5 inches, on Tuesday 1.65 inches then a count (1) is entered in column C for Tuesday. On Wednesday if it rained .60 inches the calculation recycles and does not use the rainfall on Tuesday because it was previously used in the previous two day total calculation. So Wednesday would not qualify as an occurrence of rainfall over a two day period.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try

=(SUM(B2:B3)>2)*(C2+1)

If you don't want the numbers to add up, replace the (C2+1) with 1

The formula expects that there are no gaps in dates. If you want to make sure there are no gaps in the dates you're going to have to add the date verification into the formula:

=(A3=A2+1)*(SUM(B2:B3)>2)*(C2+1)
 
Last edited:
Upvote 0
Are you looking for VBA or a simple formula you can drag down the column?

A simple formula would be

=IF(AND((B1+B2)>2,C1=""),1,"")

Assuming your data starts in B1, your formula would start in C2
 
Last edited:
Upvote 0
I got this to work.

Now once I identified the occurrence (Over 2 inches during a 2 day period) I need to reset the 2 day period when I go to the next day's rainfall. What is happening is the formula is adding the next day to the previous day (that was part of the 2 day period) and is identifying that day as an occurrence. I want the calculation to reset after it identifies an occurrence.
 
Upvote 0
This formula worked to eliminate the counting of another 2 day interval after a 2 day interval

=IF(C17=1,"0",(SUM(B17:B18))>1)*(1)

However need to modify to count an occurrence if the daily rainfall is over 2 inches for the day even if it is directly after a 2 day occurrence.
 
Upvote 0
Did you try the formula I posted?

=IF(AND((B1+B2)>2,C1=""),1,"") starting at C2.

The C1="" part meant that it would restart counting a new two day period, can always change C1<>1 if other data can also be in C. Or are you meaning each period is two days regardless and do not overlap consecutively so rainfall of

0.15
0.85
1.5
0.6


would read in column C as

empty
empty
empty
1

rather than

empty
empty
1
empty



1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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