How to count number of consecutive wet days in the a rainfall table?

yabi100

Board Regular
Joined
Aug 10, 2013
Messages
81
Office Version
  1. 2016
Platform
  1. Windows
I have a rainfall table and the google sheet link is provided below. For each year, I want to count number of days, fulfilling following both two conditions:

1) Number of days where rainfall is more than or equal to 1 mm.

2) Count only those days which are not single.
In other words, I want to count those days where at least two consecutive days are more than 1 mm.
This is called consecutive wet days in hydrology and I have to find a way in Excel to calculate them.
For example, in following part of the table as attached images:
Row 38 and 40 should not be counted because they are single, but rows 42 to 46 (5 days) should be counted, as they are consecutive and more than 1.
I have pasted the table into following link
I have to do it for each year separately. Separating years will be easy by putting a countif on year. But don't know how to perform consecutive days count.

Is there any way in Excel to perform this calculation?
 

Attachments

  • image1MrExcel.JPG
    image1MrExcel.JPG
    14.9 KB · Views: 12
  • image2MrExcel- WholeTable.JPG
    image2MrExcel- WholeTable.JPG
    46.1 KB · Views: 11

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I would like to help, For many years I processed all kinds of environmental data including rainfall.

I would create a helper column. Does this get us started?

Book3
ABCD
1DateRainfall (mm)YearWet Days
21/1/202072020FALSE
31/2/202002020FALSE
41/3/2020312020TRUE
51/4/202082020TRUE
61/5/2020382020TRUE
71/6/2020312020TRUE
81/7/2020272020TRUE
91/8/202012020TRUE
101/9/2020362020TRUE
111/10/2020252020TRUE
121/11/202042020TRUE
131/12/2020112020TRUE
141/13/2020272020TRUE
151/14/202092020TRUE
161/15/2020192020TRUE
171/16/202032020FALSE
181/17/202002020FALSE
191/18/202032020TRUE
Sheet1
Cell Formulas
RangeFormula
C2:C19C2=YEAR(A2)
D2:D19D2=AND(B2>=1,SUMIFS(B:B,A:A,A2+1,B:B,">="&1))
 
Upvote 1
Is this for Excel or for Google Sheets?
Also the link you supplied is asking people to sign in. You need to share the workbook & then post the link you are given.
 
Upvote 0
I should add following note as well, to complete the question.
I want the number for longest wet period. Suppose in one year, there are:
6 wet period of 5 days length,
1 wet period of 6 days length and
4 wet period of 10 days length. (all these wet periods are consecutive)
Longest wet period is 10 days.
So the answer for this year will be 10 days.
 
Upvote 0
Is this for Excel or for Google Sheets?
Also the link you supplied is asking people to sign in. You need to share the workbook & then post the link you are given.
Thanks for your reply. Let me download and install XL2BB and upload the file.
 
Upvote 0
DearJefrrey
Thanks for your help. I highly appreciate your help.
Let me add your two helper column and reach you soon.
 
Upvote 0
I did as you showed in above post and got same result. Although I don't understand the formula you input into D3, but results are true and false. How shall I proceed?
 

Attachments

  • True-false.JPG
    True-false.JPG
    50.2 KB · Views: 5
Upvote 0
Here is some more

Yabi100.xlsm
ABCDEFGH
1DateRainfall (mm)YearWet DaysCountPercentileWet Days
21/1/202072020FALSE01260
31/2/202002020FALSE00.9102
41/3/2020312020TRUE130.857
51/4/202082020TRUE120.742
61/5/2020382020TRUE110.632
71/6/2020312020TRUE100.524
81/7/2020272020TRUE90.417
91/8/202012020TRUE80.311
101/9/2020362020TRUE70.26
111/10/2020252020TRUE60.12
121/11/202042020TRUE500
131/12/2020112020TRUE4
141/13/2020272020TRUE3
151/14/202092020TRUE2
161/15/2020192020TRUE1
171/16/202032020FALSE0
181/17/202002020FALSE0
191/18/202032020TRUE10
201/19/2020382020TRUE9
Sheet1
Cell Formulas
RangeFormula
C2:C20C2=YEAR(A2)
D2:D20D2=AND(B2>=1,SUMIFS(B:B,A:A,A2+1,B:B,">="&1))
E2:E20E2=IF(D2=TRUE,COUNTA(OFFSET($D2,0,0,MATCH(FALSE,$D2:$D$1000000,0)-1,1)),0)
H2:H12H2=PERCENTILE($E$2:$E$1644,G2)
 
Upvote 1
Thanks a lot. You knowledge really helped me.
My assignment in the Hydrology course asks me to do the following steps as I wrote in a separate post above.
I write it here again:
I want the number for longest wet period.
Suppose in one year, there are:
6 wet period of 5 days length,
1 wet period of 6 days length and
4 wet period of 10 days length. (all these wet periods are consecutive)
Longest wet period is 10 days.
So the answer for this year will be 10 days.
Is it possible to calculate this number?

I find out that you calculated wet days as a percentile which is a logical and necessary but my assignment hasn't asked me for it, which is a bit strange.
Will be very happy if you clarify this point, namely following questions:
1- Is your data are limited to one year and there is no need to perform it over several years, or is it acceptable to perform percentile calculation over several years?
2- If I want to find the longest wet period for each year, how can I pursue?
3- I copied your formula to my file but results are strange. Please have a look at it:
Only 100% and 90% are non-zero
 

Attachments

  • percentile.JPG
    percentile.JPG
    19.8 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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