Complex Counting formula

dharmalife87

New Member
Joined
Jan 22, 2014
Messages
26
I need to count the average of all dates, in a given month, that return a value.
I have 10 years of data, each has a different spreadsheet, each has 2 columns that I need to deal with. 1st column is dates from Jan 1st to Dec 31st, the second column is inches of rain.

I need to get an average of the number of days it rains within a given month across a 10 year span.
 

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.
IMO the best way to do it is to create a table for each year so you can have all data separate and then sum them together later if you wish. Here's what I came up with:

MonthStartEndAverage
April4/1/20144/30/2014See Formula Below
May5/1/20145/31/2014See Formula Below
June6/1/20146/30/2014See Formula Below

<tbody>
</tbody>

=AVERAGEIFS($B$2:$B$18,$A$2:$A$18,">="&E4,$A$2:$A$18,"<="&F4)

This assumes you'll be keeping the inches in column B and the dates in column A. I've only gone to A18 & B18 with the date and inches data but you can change the '18' to '18,000' in the formula (or a column reference of A:A & B:B but those are slower to calculate) and it will still work. The table I've created shown above is in the D1:G13 range so I've just entered the formula into G2 and copied down to average each month. Does this answer your question?
 
Last edited:
Upvote 0
I have the dates written in ##/##/#### format
I will need the formula to identify the month in number form on each table for each year.
All tables are 2 columns (inches in B and dates in A)
 
Upvote 0
i have the dates written in ##/##/#### format
i will need the formula to identify the month in number form on each table for each year.
All tables are 2 columns (inches in b and dates in a)

=month(datevalue(d2&" 1")) if you're referring to the 'April', 'May', 'June' set of data or =month(e2) if you're referring to the mm/dd/yyyy format portion. This assumes the cells refer to the table I made above, in terms of references.

i also just need to count the average times the value is over 0. I already have the average of inches per month

=averageif($b$2:$b$18,">0")
 
Last edited:
Upvote 0
I'm sorry if I am not being clear on this
I do not need the average inches; I need the average number of days it rains per month over a 10 year span

Ex: August of 03 it rained 4 days
August of 04 it rained 6 days
August of 05 it rained 1 day
august of 06 it rained 3 days
Etc.

I need the answer to say 3.5 days
 
Upvote 0
For one year, one formula for the number of rainy days in January is:

=SUMPRODUCT(--(MONTH('2003.xlsx'!$A$1:$A$365)=1),--('2003.xlsx'!$B$1:$B$365>0))

For February, it changes to:

=SUMPRODUCT(--(MONTH('2003.xlsx'!$A$1:$A$365)=2),--('2003.xlsx'!$B$1:$B$365>0))

To get the ten year average number of rainy days in January:

=AVERAGE(SUMPRODUCT(--(MONTH('2003.xlsx'!$A$1:$A$365)=1),--('2003.xlsx'!$B$1:$B$365>0)),
SUMPRODUCT(--(MONTH('2004.xlsx'!$A$1:$A$366)=1),--('2004.xlsx'!$B$1:$B$366>0)),
​ ​ <​--- similar lines deleted for brevity ---​>
SUMPRODUCT(--(MONTH('2011.xlsx'!$A$1:$A$365)=1),--('2011.xlsx'!$B$1:$B$365>0)),
SUMPRODUCT(--(MONTH('2012.xlsx'!$A$1:$A$366)=1),--('2012.xlsx'!$B$1:$B$366>0)))

Similar formulas will work for the other months.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,580
Members
449,174
Latest member
chandan4057

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