Need to average values of cells between two dates, and based on text field

dallas1593

New Member
Joined
Mar 3, 2017
Messages
3
Good afternoon! I am trying desperately (via averageif/averageifs, and combos of others) to average the cells in a column with two criteria: must be between two dates (a week apart), and must only average cells based on a text value (in this example I gave "X").

So below, I have two tables, one for item "X" and the other item "Y". In the column "Avg. Days to Build" for both, I want to average the cells in a seperate tab (in column A), based on the dates in the "Date" column below, and based on the table header (X or Y).

So for January 8th, I'd like to average all cells between 1/1/17 and 1/1/17 that are item X, and in the next table do the same but for item Y.

Is this possible? I also would like this formula dynamic, because I have a macro that auto-adds a new row for the upcoming week (so every friday, I'll hit it, and it adds the most recent weeks' data).

I am completely stumped!

X
DateUnits NeededUnits BuiltPercentage BuiltAvg. Days to Build
1/1/2017121083%
1/8/201710770%
1/15/201714964%
1/22/2017131185%
1/29/201710990%

<tbody>
</tbody><colgroup><col><col span="2"><col><col></colgroup>

Y
DateUnits NeededUnits BuiltPercentage BuiltAvg. Days to Build
1/1/201710990%
1/8/201713754%
1/15/201714964%
1/22/20171011110%
1/29/201712975%

<tbody>
</tbody><colgroup><col><col span="2"><col><col></colgroup>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You would split up the date logic between the two dates it's validating against. I don't know what your data sheet looks like so I can't write the formula for you, but you'll end up with 3 criteria ranges and 3 criteria: >=start date, < end date, and X or Y. Example of formula in cell E3:
Code:
=AVERAGEIFS([averagethisrange],[COLOR=#008000][criteriarange1],">="&A3[/COLOR],[COLOR=#0000ff][criteriarange2],"<"&A4[/COLOR],[COLOR=#b22222][criteriarange3],$A$1[/COLOR])
Then you just use the fill handle to copy the formula down to the rest of the X table rows.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

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