I'm currently using the =COUNTIFS()
function to count the number of values that satisfy two conditions.
=COUNTIFS('2014'!$F:$F, B3, '2014'!$H:$H, A13)
However I no want to also include specific months as a condition, but the range of dates is in the format, 3/11/2014. I have looked up a few different ways that can count specific months from a list of dates using a combination of the =SUMPRODUCT()
and MONTH
formulas, but unable to find one that works in a COUNTIFS
function to satisfy the original conditions also.
I even tried to think outside of the box by using wild cards,
=COUNTIFS('2014'!$F:$F, B3, '2014'!$H:$H, A13, '2014'!$A:$A, "*/11/2014")
Alas to no avail.
Does anyone know if there is a way in which to include counting specific months to a =COUNTIFS()
function?
EDIT*
I have a temporary fix, thats not a sure fire solution, but I have created a helper column containing
=TEXT(A1, "DD/MM/YYYY")
And tied this in with my original wild card solution
=COUNTIFS('2014'!$F:$F, B3, '2014'!$H:$H, A13, '2014'!$I:$I, "*/11/2014")
however still after something a little less bodgy!
If the month you are testing against is numerical format (January is 1, Feb is 2, etc) you could use the following:
That will look for May values, for instance.
How this works:
SUMPRODUCT
works by testing conditions across a range of cells. For each row, in our case, we test ifF
holds B13's value,H
holds A13's data, and the Month ofA
is5
. Each one of those tests will return aTRUE
or aFALSE
. ATRUE
is also a1
and aFalse
is also a0
, so testing a rows will look like:Each condition is in it's own paranthetical statement and is multiplied by the other conditions so that it will result in a 1 or 0, which SUMPRODUCT will add up when it's done testing every row in your range.
For example for January you might incorporate something like:
assuming your dates are numeric rather than strings.
Since it seems that all your dates for excel are set to the format of
dd/mm/yyyy
this formula should work:This basically checks the column against the span of the entire month. All dates greater or equal to the start of the desired month, and all dates less than the start of the next month.
To change the month: