Forum Discussion
Countif problem
First, I would correct the inconsistent range in your formula, since COUNTIFS requires all ranges to have exactly the same size. In your example, $F$3:$F$18 does not match $B$3:$B$81, which can lead to incorrect results or even return zero. The corrected formula should be:
=COUNTIFS($B$3:$B$81,[@Column1],$F$3:$F$81,"Apples")
If that still doesn’t produce the expected result, the next step is to consider how the values in column B are stored. Even though they are displayed as mmm-yy, they may actually contain full date values (including the day). In this situation, using an exact match with [@Column1] can fail, because the underlying dates are not identical.
To make the calculation more reliable, I would switch to a month-based comparison, counting all rows where the date falls within the same month and year. That can be done using a date range:
=COUNTIFS($F$3:$F$81,"Apples",$B$3:$B$81,">="&EOMONTH([@Column1],-1)+1,$B$3:$B$81,"<"&EOMONTH([@Column1],0)+1)
This approach ensures that all entries within the same month are counted correctly, regardless of the specific day stored in the cells.