Michelle, try
=COUNTIF(A2:A1728,"199801")
Regards,
Barrie
Barrie Davidson
Michelle,
It seems you concatenated year and month to build a criterion. If the range a2:a1278 contains true dates, I'd propose using
=SUMPRODUCT((YEAR(A2:A1278)=1998)*(MONTH(A2:A1278)=1)*(B2:B1728))
This will give you the number of orders in January of 1998.
Aladin
========
Since COUNTA() will count logical values it cannot
be used for your purposes. That's because
IF(A2:A1728="199801",B2:B1728)) will return FALSE
when A2:A1728 does not equal "199801" and COUNTA
will count 'em.
COUNT() will only work if B2:B1728 contains
numeric values. Is that the case? I trust that
you entering these formulas using the
Control+Shift+Enter key combination. Is that
the case? What results are you getting that
leads you to believe that your "logic is
wrong"?
Note - this solution is not an array formula (nt)
If your order numbers are text (e.g., an invoice
number such as "A12034") and blank cells represent
the absence of an order then I'd recommmend that
you employ the following array formula...
{=SUM((A2:A1728="199801")*ISTEXT(B2:B1728))}
Note: This is an array formula which must be
entered using the Control+Shift+Enter key
combination. The outermost braces, {}, are not
entered by you -- they're supplied by Excel in
recognition of a properly entered array formula.