when more than 1 member helps, i think it's good to try/acknowledge the member's effort too.
AND doesn't work really well with arrays here. in your formula
YEAR(C2:C176)=2013, you can select that & press F9 to calculate. you notice you'll get many TRUEs & FALSEs. but if you select
AND(YEAR(C2:C176)=2013,MONTH(C2:C176)=7) & press F9, it returns you just 1 single result. most likely, that will be FALSE. that is because ALL C2:C176 needs to be Year 2013 & Month 7 to return TRUE. so if it's TRUE, you want C2:C176. if it's FALSE, you want a 0. so it returns a 0. COUNT will count numbers in the specified range. 0 is a number. hence it returns 1.
again, when you do logical tests like what you did:
YEAR(C2:C176)=2013
MONTH(C2:C176)=7
they return a bunch of TRUEs & FALSEs. Excel recognizes TRUE as 1 & FALSE as 0. so
TRUE x TRUE = 1
TRUE x FALSE = 0
FALSE x FALSE = 0
so only when the 2 conditions are met (2013 & 7), then you will get a 1. SUMPRODUCT merely helps you multiply all the TRUEs & FALSEs, and then sum them up. a small eg.
Data Range
|
C |
2 |
Jul-13 |
3 |
Jul-14 |
4 |
Jul-14 |
5 |
Jul-13 |
6 |
Jul-13 |
the above would be:
{TRUE;FALSE;FALSE;TRUE;TRUE}*{TRUE;TRUE;TRUE;TRUE;TRUE}
so that's:
{1;0;0;1;1}
add them up & you get 3.
do mark this thread as Solved
Bookmarks