Averageifs based on row range(multiple dates) and matching column range.

fusion5151

New Member
Joined
Jan 19, 2016
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm looking to build a formula to average a specific date range(row 2) based on a specific matching criteria in the row column A.

In this case once there is an average, i'd like to create a sum so for apples this would be a total of 14.

Also note my date ranges will consciously change so i'd like to adjust based on this criteria.

See below for table.

Start Date
3-Jan​
1-Jan​
2-Jan​
3-Jan​
4-Jan​
5-Jan​
6-Jan​
7-Jan​
8-Jan​
9-Jan​
10-Jan​
AverageEnd Date
7-Jan​
Apples
5​
10​
5​
8​
5​
2​
3​
7​
8​
7​
5​
Apples
Apples
9​
4​
7​
7​
2​
5​
2​
8​
2​
7​
5​
Orange
Oranges
5​
9​
7​
5​
1​
9​
5​
6​
9​
4​
5​
Tomato
Oranges
5​
3​
1​
2​
5​
1​
2​
3​
4​
4​
2​
Apples
5​
6​
6​
1​
1​
9​
4​
3​
8​
3​
4​
Tomato
3​
1​
7​
6​
4​
10​
4​
8​
5​
4​
6​
Tomato
8​
5​
7​
6​
1​
7​
2​
1​
1​
8​
5​

Thanks for all your help.

Steven
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi,

I'm looking to build a formula to average a specific date range(row 2) based on a specific matching criteria in the row column A.

In this case once there is an average, i'd like to create a sum so for apples this would be a total of 14.

Also note my date ranges will consciously change so i'd like to adjust based on this criteria.

See below for table.

Start Date
3-Jan​
1-Jan​
2-Jan​
3-Jan​
4-Jan​
5-Jan​
6-Jan​
7-Jan​
8-Jan​
9-Jan​
10-Jan​
AverageEnd Date
7-Jan​
Apples
5​
10​
5​
8​
5​
2​
3​
7​
8​
7​
5​
Apples
Apples
9​
4​
7​
7​
2​
5​
2​
8​
2​
7​
5​
Orange
Oranges
5​
9​
7​
5​
1​
9​
5​
6​
9​
4​
5​
Tomato
Oranges
5​
3​
1​
2​
5​
1​
2​
3​
4​
4​
2​
Apples
5​
6​
6​
1​
1​
9​
4​
3​
8​
3​
4​
Tomato
3​
1​
7​
6​
4​
10​
4​
8​
5​
4​
6​
Tomato
8​
5​
7​
6​
1​
7​
2​
1​
1​
8​
5​

Thanks for all your help.

Steven
just wanted to also add i've been trying to adjust this formula but to no luck.

=AVERAGEIFS($B$2:$K$8,$A$2:$A$8,O3,$B$1:$K$1,">="&DATE(2023,1,3),$B$1:$K$1,"<="&DATE(2023,1,7))

If anyone has information on this please let me know.

Thanks
Steven
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Hi Fluff,

Thanks and noted. i updated my profile. i'm currently using Microsoft 365 MSO on windows platform 64 bit.
 
Last edited:
Upvote 0
Thanks for that (y)
How about
Fluff.xlsm
ABCDEFGHIJKLMNOP
1Start Date03/01/2023
201/01/202302/01/202303/01/202304/01/202305/01/202306/01/202307/01/202308/01/202309/01/202310/01/2023AverageEnd Date07/01/2023
3Apples510585237875Apples4.47
4Apples94772528275Oranges3.80
5Oranges59751956945Tomato5.40
6Oranges53125123442
7Apples56611943834
8Tomato317641048546
9Tomato85761721185
Home
Cell Formulas
RangeFormula
P3:P5P3=AVERAGE(FILTER(DROP(TAKE($B$3:$K$9,,XMATCH($P$2,$B$2:$K$2)),,XMATCH($P$1,$B$2:$K$2)-1),$A$3:$A$9=O3))
 
Upvote 0
Thanks for that (y)
How about
Fluff.xlsm
ABCDEFGHIJKLMNOP
1Start Date03/01/2023
201/01/202302/01/202303/01/202304/01/202305/01/202306/01/202307/01/202308/01/202309/01/202310/01/2023AverageEnd Date07/01/2023
3Apples510585237875Apples4.47
4Apples94772528275Oranges3.80
5Oranges59751956945Tomato5.40
6Oranges53125123442
7Apples56611943834
8Tomato317641048546
9Tomato85761721185
Home
Cell Formulas
RangeFormula
P3:P5P3=AVERAGE(FILTER(DROP(TAKE($B$3:$K$9,,XMATCH($P$2,$B$2:$K$2)),,XMATCH($P$1,$B$2:$K$2)-1),$A$3:$A$9=O3))
thank you fluff! this is perfect. to take this a step further would i could be able to adjust the formula to sum up all the averages?

For example, for the apples i'd like it to return 14 ttl units.
 
Upvote 0
Do you want the averages the formula gives, or do you just want to sum col M for each fruit?
 
Upvote 0
Do you want the averages the formula gives, or do you just want to sum col M for each fruit?
Apologies for the confusion. I'm looking to average that specific time period so the formula above works as such, but after the average. would i be able to sum up all of the categories?

So in this case i'd like to add the apples in row 3/4/7 to ttl 14(column M) units during this time period.

I'm trying to create a dynamic formula as i will need to report multiple dates. looking to create a formula just based on the start/end date and looking at the category for the avg.
From there if possible getting the sum for all of the averages by category.

Not sure if its possible but thanks for your help thus far, this has been super helpful!

Steven
 
Last edited:
Upvote 0
You can use sumifs for for that.
 
Upvote 0
You can use sumifs for for that.
ok, this will be broken down by line for average and adding another formula for sumifs for the sum by category?

I was trying to see if possible if it could just be 1 formula to create this calculation and then sum for the entire category.
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,351
Members
449,155
Latest member
ravioli44

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