Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 788
Default Countif, Multiple criteria

Hello,

Can I use the countif or sumif functions with multiple criteria? For
Example if I wanted to count every person in a selected range above the age
of 16 and/or below the age of 4?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Countif, Multiple criteria

One way is to count all the people older than 4 and subtract the people older
than 16.

=countif(a1:a999,""&4) - countif(a1:a999,""&16)

You may want = in either/both of those comparisons.

Another option would be to use:

=sumproduct(--(a1:a9994),--(a1:a999<16))

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html



Chris wrote:

Hello,

Can I use the countif or sumif functions with multiple criteria? For
Example if I wanted to count every person in a selected range above the age
of 16 and/or below the age of 4?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 477
Default Countif, Multiple criteria

=COUNTIF($H$11:$H$22,""&16)+COUNTIF($H$11:$H$22," <"&4)
Reset Range to your range

"Chris" wrote:

Hello,

Can I use the countif or sumif functions with multiple criteria? For
Example if I wanted to count every person in a selected range above the age
of 16 and/or below the age of 4?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default Countif, Multiple criteria

COUNTIF(Range,"4") - COUNTIF(Range,"16") is not the same as
SUMPRODUCT(--(Range4),--(Range<16))
Besides, they count the wrong set.
Valid formulas are
=COUNTIF(Range,"<4")+COUNTIF(Range,"16")
=COUNTA(Range)-SUMPRODUCT((Range=4)*(Range<=16))
=COUNTA(Range)-SUMPRODUCT(NOT(Range<4)*NOT(Range16))
=SUMPRODUCT((Range<4)*(Range<16))+SUMPRODUCT((Rang e4)*(Range16))

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Countif, Multiple criteria

You're right. I read the question incorrectly.

And I tried to make the point about what happens at the borders with my note
about =. But I guess that I didn't make it well enough.

Herbert Seidenberg wrote:

COUNTIF(Range,"4") - COUNTIF(Range,"16") is not the same as
SUMPRODUCT(--(Range4),--(Range<16))
Besides, they count the wrong set.
Valid formulas are
=COUNTIF(Range,"<4")+COUNTIF(Range,"16")
=COUNTA(Range)-SUMPRODUCT((Range=4)*(Range<=16))
=COUNTA(Range)-SUMPRODUCT(NOT(Range<4)*NOT(Range16))
=SUMPRODUCT((Range<4)*(Range<16))+SUMPRODUCT((Rang e4)*(Range16))


--

Dave Peterson
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
Use multiple criteria with COUNTIF: between dates and not blank l.shields Excel Worksheet Functions 13 July 27th 09 06:53 PM
Countif using criteria in multiple columns ImaGina Excel Worksheet Functions 1 September 14th 06 07:31 PM
Multiple Criteria using countif calmo Excel Worksheet Functions 6 October 25th 05 08:33 PM
multiple criteria in one field 4a,4b etc of countif? Anne-Marie Excel Discussion (Misc queries) 1 October 20th 05 02:23 PM
Multiple CountIf Criteria JerryS Excel Worksheet Functions 1 October 14th 05 07:14 PM


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

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

About Us

"It's about Microsoft Excel"