# Extract and average a number of unique values selected by rows matching set criteria

#### Gareth33

##### New Member
I have a file containing rainfall data for each day over many years and am trying to automate calculation of the average rainfall on any given day.

Data is structured like this:

 Row Col C Col D Col E Col F 1 Year Month Day Rainfall 1000 2015 12 4 0.4 1365 2016 12 4 1.3

<tbody>
</tbody>

and required result would be the average of all the values in Col.F for a given month and day. I'd like to tabulate results in a new sheet with a row for each date through the year, e.g.

Jan-1, 0.0
Jan-2, 0.5
Jan-3, 0.2 etc.

I've got rather lost due to the number of loops. If anyone could show me a way to do this it would be much appreciated.

### Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

#### tusharm

##### MrExcel MVP
Just use a PivotTable and let Excel do the hard work. Put the year, month, and date as row fields and the Rainfall as the data column. Change, if necessary, the type of statistic (default is likely to be COUNT or SUM) to Average.
I have a file containing rainfall data for each day over many years and am trying to automate calculation of the average rainfall on any given day.

Data is structured like this:

 Row Col C Col D Col E Col F 1 Year Month Day Rainfall 1000 2015 12 4 0.4 1365 2016 12 4 1.3

<tbody>
</tbody>

and required result would be the average of all the values in Col.F for a given month and day. I'd like to tabulate results in a new sheet with a row for each date through the year, e.g.

Jan-1, 0.0
Jan-2, 0.5
Jan-3, 0.2 etc.

I've got rather lost due to the number of loops. If anyone could show me a way to do this it would be much appreciated.

Replies
2
Views
2K
Replies
4
Views
434
Replies
10
Views
1K
Replies
3
Views
360
Replies
7
Views
3K

Threads
1,191,687
Messages
5,988,077
Members
440,125
Latest member
vincentchu2369

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

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