Averages and Max values if certain criteria are selected

mniedert

Board Regular
Joined
Apr 13, 2005
Messages
72
I need some help with a series of related formulas. I'm keeping track of some survey feedback forms and need some way to quickly look at averages and max scores over time. The problem is I get lost when there are multiple variables that I need to consider. I know that there are some very smart people out there that can solve this in no time. I appreciate your willingness to help me. Here is a sample of what I'm trying to do (re: Report tab) along with a sample of the data.

Here's the data sheet:


Excel 2012
ABCDEFGH
1CategorySupplierDate of ReviewSalesProductServiceCostOverall
2MeatsDeli Meat Express6/18/20152.752.722.883.132.87
3MeatsRoscoe Pig Farm5/23/20152.241.971.893.522.41
4Landscaping SuppliersLenny Farms9/11/20142.742.752.712.882.77
5Landscaping SuppliersSilver Star Trees8/28/20142.853.043.102.632.91
6MeatsDeli Meat Express8/21/20142.713.113.102.352.82
7LogisitcsSam Trade Inc8/21/20132.713.113.102.352.82
8ConstructionDLRC, Inc.8/15/20132.823.133.303.003.06
9Gift SuppliersNotion's Potions8/7/20132.252.222.832.502.45
10Gift SuppliersDeli Meat Express3/5/20132.372.172.832.502.47
11LogisitcsHugh Packing Co3/5/20132.252.242.172.332.25
12MeatsRoscoe Pig Farm8/23/20122.241.971.892.002.03
13LogisitcsDLRC, Inc.8/15/20122.722.752.832.422.68
14MeatsDeli Meat Express8/7/20122.252.222.832.502.45
15
16*suppliers can be associated with multiple categories
Data


and here is the sheet that I need the formulas for (specifically those cells that are highlighed):


Excel 2012
ABCDEFGHIJKLMNO
1Select Supplier:Deli Meat Express<- this is a validation list that I've already created
2Select Category:Meats<- this should be a validation list that only shows the categories that the vendor is associated with on the Data sheet
3Look Back (months):24<- I want the scores below to be limited to the scores within the last x number of months
4
5
6SalesProductServiceCostOverall
7Deli Meat Express - average over 24 months2.732.922.992.742.84<-should look at Supplier and Look Back to calaculate
8Deli Meat Express - Best Score over 24 months2.753.113.103.132.87<-should look at Supplier and Look Back to calaculate
9Best score in the last 24 months in the Meats category2.753.113.103.522.87<- should look at the category and months Look Back to calculate
10Best score in the last 24 months across all categories2.853.133.303.523.06<- should look at the months Look Back to calculate
11
12*The numbers above are a representation of the results I'm looking for. They'd obviously change as I changed the criteria in the top left (B1, B2, and B3)
13
Reports


In B2 I need a formula that would show only the categories that the supplier selected in B1 has been associated with on the Data tab. The text in blue italics is for your reference only. So what formulas do I need?

Thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
B2 will need to be Data Validation. This link should help: Excel Dependent Drop-down Lists - Easy Excel Tutorial

C7: =AVERAGEIFS(Data!$D$2:$D$14,Data!$A$2:$A$14,$B$2,Data!$B$2:$B$14,$B$1,Data!$C$2:$C$14,">"&EDATE(TODAY(),-24))

C8: ={MAX((Data!$B$2:$B$14=$B$1)*(Data!$C$2:$C$14>EDATE(TODAY(),-24)),Data!$D$2:$D$14)}

C9: ={MAX((Data!$A$2:$A$14=$B$2)*(Data!$C$2:$C$14>EDATE(TODAY(),-24)),Data!$D$2:$D$14)}

C10: ={MAX((Data!$C$2:$C$14>EDATE(TODAY(),-24)),Data!$D$2:$D$14)}

All formulas can be dragged across the columns to get Product, Service, etc. Not sure if your data will be adding rows but if it will the formulas should be altered to become dynamic. Here's what it would look like:

C7: =AVERAGEIFS(INDIRECT("Data!$D$2:$D$"&COUNTA(Data!$A:$A)),INDIRECT("Data!$A$2:$A$"&COUNTA(Data!$A:$A)),$B$2,INDIRECT("Data!$B$2:$B$"&COUNTA(Data!$A:$A)),$B$1,INDIRECT("Data!$C$2:$C$"&COUNTA(Data!$A:$A)),">"&EDATE(TODAY(),-24))

C8: ={MAX((INDIRECT("Data!$B$2:$B$"&COUNTA(Data!$A:$A))=$B$1)*(INDIRECT("Data!$C$2:$C$"&COUNTA(Data!$A:$A))>EDATE(TODAY(),-24)),INDIRECT("Data!$D$2:$D$"&COUNTA(Data!$A:$A)))}

C9: ={MAX((INDIRECT("Data!$A$2:$A$"&COUNTA(Data!$A:$A))=$B$2)*(INDIRECT("Data!$C$2:$C$"&COUNTA(Data!$A:$A))>EDATE(TODAY(),-24)),INDIRECT("Data!$D$2:$D$"&COUNTA(Data!$A:$A)))}

C10: ={MAX((INDIRECT("Data!$C$2:$C$"&COUNTA(Data!$A:$A))>EDATE(TODAY(),-24)),INDIRECT("Data!$D$2:$D$"&COUNTA(Data!$A:$A)))}

I haven't tested these in Excel but I believe they will work. The curly brackets mean you must enter the formula use Ctrl+Shift+Enter rather than just hitting 'Enter'. Good luck!
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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