Average days by type and year

PaulDaunno

New Member
Joined
Nov 8, 2019
Messages
2
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Type[/TD]
[TD]Days[/TD]
[TD]Year[/TD]
[/TR]
[TR]
[TD]34[/TD]
[TD]12[/TD]
[TD]2017[/TD]
[/TR]
[TR]
[TD]34[/TD]
[TD]24[/TD]
[TD]2017[/TD]
[/TR]
[TR]
[TD]65[/TD]
[TD]11[/TD]
[TD]2017[/TD]
[/TR]
[TR]
[TD]66[/TD]
[TD]44[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]34[/TD]
[TD]23[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]66[/TD]
[TD]13[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]34[/TD]
[TD]44[/TD]
[TD]2019[/TD]
[/TR]
[TR]
[TD]65[/TD]
[TD]8[/TD]
[TD]2019[/TD]
[/TR]
[TR]
[TD]66[/TD]
[TD]31[/TD]
[TD]2019[/TD]
[/TR]
</tbody>[/TABLE]


I want the average days by type, by year. So for example, in 2017, the average days for type 34 is 18. The average days for type 65 is 11.

I also want the average days by year for more than 1 type. So for example, in 2018, the average for type 34 and type 66 is 26.66.

What formulas would I use to accomplish this?

Thanks,
-Paul
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Re: Help Needed - Average days by type and year

Are you able to use Power Query aka Get&Transform?

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Type[/td][td=bgcolor:#5B9BD5]Days[/td][td=bgcolor:#5B9BD5]Year[/td][td][/td][td=bgcolor:#70AD47]Type[/td][td=bgcolor:#70AD47]Year[/td][td=bgcolor:#70AD47]DaysAvg[/td][td][/td][td=bgcolor:#70AD47]Year[/td][td=bgcolor:#70AD47]DaysAvg[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
34​
[/td][td=bgcolor:#DDEBF7]
12​
[/td][td=bgcolor:#DDEBF7]
2017​
[/td][td][/td][td=bgcolor:#E2EFDA]
34​
[/td][td=bgcolor:#E2EFDA]
2017​
[/td][td=bgcolor:#E2EFDA]
18​
[/td][td][/td][td=bgcolor:#E2EFDA]
2018​
[/td][td=bgcolor:#E2EFDA]
26.66666667​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
34​
[/td][td]
24​
[/td][td]
2017​
[/td][td][/td][td]
65​
[/td][td]
2017​
[/td][td]
11​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
65​
[/td][td=bgcolor:#DDEBF7]
11​
[/td][td=bgcolor:#DDEBF7]
2017​
[/td][td][/td][td=bgcolor:#E2EFDA]
66​
[/td][td=bgcolor:#E2EFDA]
2018​
[/td][td=bgcolor:#E2EFDA]
28.5​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
66​
[/td][td]
44​
[/td][td]
2018​
[/td][td][/td][td]
34​
[/td][td]
2018​
[/td][td]
23​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
34​
[/td][td=bgcolor:#DDEBF7]
23​
[/td][td=bgcolor:#DDEBF7]
2018​
[/td][td][/td][td=bgcolor:#E2EFDA]
34​
[/td][td=bgcolor:#E2EFDA]
2019​
[/td][td=bgcolor:#E2EFDA]
44​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
66​
[/td][td]
13​
[/td][td]
2018​
[/td][td][/td][td]
65​
[/td][td]
2019​
[/td][td]
8​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
34​
[/td][td=bgcolor:#DDEBF7]
44​
[/td][td=bgcolor:#DDEBF7]
2019​
[/td][td][/td][td=bgcolor:#E2EFDA]
66​
[/td][td=bgcolor:#E2EFDA]
2019​
[/td][td=bgcolor:#E2EFDA]
31​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
65​
[/td][td]
8​
[/td][td]
2019​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
66​
[/td][td=bgcolor:#DDEBF7]
31​
[/td][td=bgcolor:#DDEBF7]
2019​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
Re: Help Needed - Average days by type and year

Try this


Book1
ABCDEF
1TypeDaysYearYear
234122017201826.667
334242017
465112017
566442018
634232018
766132018
834442019
96582019
1066312019
Sheet1
Cell Formulas
RangeFormula
F2=SUMPRODUCT((C2:C10=E2)*((A2:A10=34)+(A2:A10=66))*(B2:B10))/SUMPRODUCT((C2:C10=E2)*((A2:A10=34)+(A2:A10=66)))
 
Upvote 0
Re: Help Needed - Average days by type and year

Welcome to the forum!

You can also create a pivot table

2c3bce9cdc6b1ba689e6238a6d2ded6c.jpg
 
Upvote 0
Re: Help Needed - Average days by type and year

Im glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,734
Members
453,369
Latest member
juliewar

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