Average multiple criteria and ranges

angel87

New Member
Joined
Oct 24, 2017
Messages
3
Hello, Im trying to write a formula that calculates an average for a location under a specific period.
I have to specify the start and end dates and also the location and then get the average.
With one location I was able to calculate the average using averageifs, but if there are multiple locations I don't know how to make it go calculate the average on the correct column. The data set is a few hundred columns long, so when I specify the location I need the formula to use it to refer to the correct column in the spreadsheet.
For example, the formula should return the following 2 results for the dataset at the below.
[TABLE="width: 286"]
<tbody>[TR]
[TD]Start
[/TD]
[TD][/TD]
[TD]End
[/TD]
[TD][/TD]
[TD]Location
[/TD]
[TD="align: right"]Average
[/TD]
[/TR]
[TR]
[TD]2/1/2018
[/TD]
[TD][/TD]
[TD]5/31/2018
[/TD]
[TD][/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]4.25
[/TD]
[/TR]
[TR]
[TD]8/1/2018
[/TD]
[TD][/TD]
[TD]11/30/2018
[/TD]
[TD][/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]6
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 388"]
<tbody>[TR]
[TD] Date
[/TD]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[/TR]
[TR]
[TD]1/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]2.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]2/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]1.00
[/TD]
[TD]5.00
[/TD]
[/TR]
[TR]
[TD]3/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]9.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]4/1/2017
[/TD]
[TD][/TD]
[TD]0.00
[/TD]
[TD]1.00
[/TD]
[TD]1.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]5/1/2017
[/TD]
[TD][/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]6/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]7/1/2017
[/TD]
[TD][/TD]
[TD]1.00
[/TD]
[TD]7.00
[/TD]
[TD]1.00
[/TD]
[TD]0.00
[/TD]
[TD]7.00
[/TD]
[/TR]
[TR]
[TD]8/1/2017
[/TD]
[TD][/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
[TD]8.00
[/TD]
[TD]3.00
[/TD]
[/TR]
[TR]
[TD]9/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]3.00
[/TD]
[TD]6.00
[/TD]
[TD]4.00
[/TD]
[TD]0.00
[/TD]
[/TR]
[TR]
[TD]10/1/2017
[/TD]
[TD][/TD]
[TD]4.00
[/TD]
[TD]0.00
[/TD]
[TD]2.00
[/TD]
[TD]4.00
[/TD]
[TD]2.00
[/TD]
[/TR]
[TR]
[TD]11/1/2017
[/TD]
[TD][/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[TD]3.00
[/TD]
[TD]8.00
[/TD]
[TD]9.00
[/TD]
[/TR]
[TR]
[TD]12/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]8.00
[/TD]
[TD]0.00
[/TD]
[TD]9.00
[/TD]
[TD]6.00
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Sorry, just realized I have an issue with the years is used the example. The dates in the two examples should be in 2017.
Idk how to edit original post :(
 
Upvote 0
@angel87, if you could provide some actual ranges for us to work with, someone will definitely be able to help you. For instance, which range would the headers of your criteria (i.e., Start, End, Location, Average) be occupying (e.g., H1:K1, etc.)? Which range would the main headers (i.e., data, A, B, C, D, E) be in (e.g., A1:F1, etc.)?
 
Upvote 0
See if this works for you.
Excel Workbook
ABCDEFG
1StartEndLocationAverage
22/1/20175/31/2017C4.25
38/1/201711/30/2017D6
4
5DateABCDE
61/1/201752666
72/1/201787415
83/1/201759896
94/1/201701144
105/1/201798444
116/1/201787466
127/1/201717107
138/1/201774683
149/1/201753640
1510/1/201740242
1611/1/201766389
1712/1/201788096
Sheet
 
Upvote 0
THANKS AhoyNY!!!!! this is perfect
I always have problems with Index-Match combo, it is so useful...

Thanks again!
 
Upvote 0
You're welcome. Thanks for the feedback and welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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