#1   Report Post  
johnT
 
Posts: n/a
Default countif criteria

can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")

thanks......
  #2   Report Post  
KL
 
Posts: n/a
Default

Hi John,

For your example (although I think you meant OR not AND) you may do
something like this:

=COUNTIF(A1:A8,"=a")+COUNTIF(A1:A8,"="b")

or

=SUMPRODUCT(--(A1:A8={"a","b"}))

For more complex multiple conditions use SUMPRODUCT(), e.g.

=SUMPRODUCT((A1:A80)*(A1:A8<6)*(A1:A8<100))

Regards,
KL


"johnT" wrote in message
...
can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")

thanks......



  #3   Report Post  
KL
 
Posts: n/a
Default

sorry - misprint. the first formula should read:

=COUNTIF(A1:A8,"a")+COUNTIF(A1:A8,"b")

KL


"KL" wrote in message
...
Hi John,

For your example (although I think you meant OR not AND) you may do
something like this:

=COUNTIF(A1:A8,"=a")+COUNTIF(A1:A8,"="b")

or

=SUMPRODUCT(--(A1:A8={"a","b"}))

For more complex multiple conditions use SUMPRODUCT(), e.g.

=SUMPRODUCT((A1:A80)*(A1:A8<6)*(A1:A8<100))

Regards,
KL


"johnT" wrote in message
...
can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")

thanks......





  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Won't work with your other question :-)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KL" wrote in message
...
sorry - misprint. the first formula should read:

=COUNTIF(A1:A8,"a")+COUNTIF(A1:A8,"b")

KL


"KL" wrote in message
...
Hi John,

For your example (although I think you meant OR not AND) you may do
something like this:

=COUNTIF(A1:A8,"=a")+COUNTIF(A1:A8,"="b")

or

=SUMPRODUCT(--(A1:A8={"a","b"}))

For more complex multiple conditions use SUMPRODUCT(), e.g.

=SUMPRODUCT((A1:A80)*(A1:A8<6)*(A1:A8<100))

Regards,
KL


"johnT" wrote in message
...
can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")

thanks......







  #5   Report Post  
Ragdyer
 
Posts: n/a
Default

How about summing your "Countif" examples, which probably answers the
original OP question:

=SUM(COUNTIF(A1:A8,{"a","b"}))

--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"KL" wrote in message
...
sorry - misprint. the first formula should read:

=COUNTIF(A1:A8,"a")+COUNTIF(A1:A8,"b")

KL


"KL" wrote in message
...
Hi John,

For your example (although I think you meant OR not AND) you may do
something like this:

=COUNTIF(A1:A8,"=a")+COUNTIF(A1:A8,"="b")

or

=SUMPRODUCT(--(A1:A8={"a","b"}))

For more complex multiple conditions use SUMPRODUCT(), e.g.

=SUMPRODUCT((A1:A80)*(A1:A8<6)*(A1:A8<100))

Regards,
KL


"johnT" wrote in message
...
can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")

thanks......








  #6   Report Post  
Harlan Grove
 
Posts: n/a
Default

"johnT" wrote...
can countif criteria be based on 2 or more sets of data??
such as: =COUNTIF(A1:A8,"=AND(a,b)")


No. If you really mean *AND*, and the 'a' and 'b' would be things the cells
in A1:A8 could equal, then if a < b, this COUNTIF would always necessarily
equal zero. If a = b, then no point to including b.

On the other hand, if 'a' and 'b' are just tokens for different conditions,
e.g., 'a' = greater than 10, and 'b' = odd integer, then you'd need to use
SUMPRODUCT, as in

=SUMPRODUCT(--(A1:A810),--(MOD(A1:A8,2)=1))


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting cells (COUNTIF) based on two or more criteria Tricia S. Excel Worksheet Functions 10 March 17th 05 02:17 PM
Using COUNTIF with 2 criteria - SUMPRODUCT? Mike R. Excel Worksheet Functions 2 February 24th 05 05:57 AM
Countif with dynamic criteria FinChase Excel Worksheet Functions 5 January 6th 05 07:19 PM
use a date range as criteria in a countif formula mbparks Excel Worksheet Functions 3 January 2nd 05 11:06 PM
How do I get the COUNTIF criteria to recognize only month and yea. Omega Excel Worksheet Functions 4 November 6th 04 07:22 AM


All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"