Formula with Date Span Condition

Aimee S.

Board Regular
Joined
Sep 28, 2010
Messages
236
Office Version
  1. 365
Platform
  1. Windows
:confused:

How would I write:

If value in Column D = "Base"
And if date value in Column G is greater than or equal to 2/1/10 and less than or equal to 1/31/11

Average all values in Column C

_____________________________

Conversely, how would one write the same with one difference:

If value in Column D = "Base"
And if date value in Column G is greater than or equal to 2/1/10 and less than or equal to 1/31/11

What is the quotient of:

The count of all values that = "Under" in Column B

divided by

The count of any and ALL values in Column B
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
For the first......

Which version of Excel are you using?

With the two dates in H1 and H2 respectively you can use AVERAGEIFS function in Excel 2007 and later, i.e.

=AVERAGEIFS(C:C,D:D,"Base",G:G,">="&H1,G:G,"<="&H2)

or in Excel 2003 try this "array formula"

=AVERAGE(IF(D2:D100="Base",IF(G2:G100>=H1,IF(G2:G100<=H2,C2:C100))))

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
OK, then I think you can use AVERAGEIFS as suggested. For the second I'd use an array formula, i.e.

=AVERAGE(IF(D2:D100="Base",IF(G2:G100>=H1,IF(G2:G100<=H2,IF(B2:B100="Under",1,0)))))

confirmed with CTRL+SHIFT+ENTER

adjust ranges as required but you can't use the whole column.....
 
Upvote 0
Genius!!!!

I added IFERROR for good measure.

=IFERROR(AVERAGEIFS(C:C,D:D,"Base",G:G,">="&$AL$2,G:G,"<="&$AW$2),"n/a")
=IFERROR(AVERAGE(IF($D$2:$D$50000="Base",IF($G$2:$G$50000>=$AL$2,IF($G$2:$G$50000<=$AW$2,IF($B$2:$B$50000="Under",1,0))))),"n/a")

One-Thousand-and-Sixty-Two-Point-Three-Repeating Thank Yous! :laugh:
 
Upvote 0

Forum statistics

Threads
1,224,509
Messages
6,179,192
Members
452,893
Latest member
denay

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