Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ed Gregory
 
Posts: n/a
Default Count Occurances if two conditions true

I have a range a1:a150 that can contain"rx". I have a second range b1:b150
that can contain "oem"

I want to count the occurrences when a1:a150 contains "rx" AND b1:b150
contains "oem". The key is AND.

Right now I use countif to return number of number occurrences for each
range, but I need a third count and that is when both are true return a
count.

Thanks.



  #2   Report Post  
Paul Sheppard
 
Posts: n/a
Default


Ed Gregory Wrote:
I have a range a1:a150 that can contain"rx". I have a second range
b1:b150
that can contain "oem"

I want to count the occurrences when a1:a150 contains "rx" AND b1:b150
contains "oem". The key is AND.

Right now I use countif to return number of number occurrences for
each
range, but I need a third count and that is when both are true return
a
count.

Thanks.


Hi Ed

Try =SUM((A1:A15o="rx")*(B1:B150="oem")), enterred as an array, type
the formula in and then CTRL/SHIFT/ENTER


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=465736

  #3   Report Post  
Gary''s Student
 
Posts: n/a
Default

Ed, you are in luck! you don't need any COUNTIF()'s or any other functions.

Use a helper column, say column Z, and enter in Z1:

=(A1="rx")*(B1="oem")
and copy down the column.
Finally, addup the ones in column Z

( the expressions in parens are boolean and the multiply represents the AND
--
Gary''s Student


"Ed Gregory" wrote:

I have a range a1:a150 that can contain"rx". I have a second range b1:b150
that can contain "oem"

I want to count the occurrences when a1:a150 contains "rx" AND b1:b150
contains "oem". The key is AND.

Right now I use countif to return number of number occurrences for each
range, but I need a third count and that is when both are true return a
count.

Thanks.




  #4   Report Post  
Ashish Mathur
 
Posts: n/a
Default

Hi,

You can use an array formula (Ctrl+Shift+Enter) to solve your problem.

=sum(if((a1:a150="rx")*(b1:b150="oem"),1,0))

Regards,

Ashish Mathur

"Ed Gregory" wrote:

I have a range a1:a150 that can contain"rx". I have a second range b1:b150
that can contain "oem"

I want to count the occurrences when a1:a150 contains "rx" AND b1:b150
contains "oem". The key is AND.

Right now I use countif to return number of number occurrences for each
range, but I need a third count and that is when both are true return a
count.

Thanks.




  #5   Report Post  
0-0 Wai Wai ^-^
 
Posts: n/a
Default



Try =SUM((A1:A15o="rx")*(B1:B150="oem")), enterred as an array, type
the formula in and then CTRL/SHIFT/ENTER


There's a typo (A15o) in the formula.
Use this instead:
=SUM((A1:A150="rx")*(B1:B150="oem"))
Remember: Finish it by pressing Ctrl+Shift+Enter all together

As a reminder, we need to type Ctrl+Shift+Enter every time you change/edit the
formula or you double click the cell, or you may mistekenly change it back as a
simple function (NOT an array).
Also we can't set it as an array simply by enclosing the formula with { }, ie
{=SUM((A1:A15o="rx")*(B1:B150="oem")) }. We CANNOT do it in that way.




  #6   Report Post  
Ed Gregory
 
Posts: n/a
Default

Thanks everyone for responses.


"Ashish Mathur" wrote in message
...
Hi,

You can use an array formula (Ctrl+Shift+Enter) to solve your problem.

=sum(if((a1:a150="rx")*(b1:b150="oem"),1,0))

Regards,

Ashish Mathur

"Ed Gregory" wrote:

I have a range a1:a150 that can contain"rx". I have a second range
b1:b150
that can contain "oem"

I want to count the occurrences when a1:a150 contains "rx" AND b1:b150
contains "oem". The key is AND.

Right now I use countif to return number of number occurrences for each
range, but I need a third count and that is when both are true return a
count.

Thanks.






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
How do I count something that has two fields that must be true Charles Excel Discussion (Misc queries) 1 August 25th 05 05:45 PM
Count if 2 conditions are true Thrava Excel Worksheet Functions 2 July 21st 05 01:56 AM
returning a count if two conditions are met davmason Excel Worksheet Functions 5 July 17th 05 04:25 AM
count unique with conditions \ditzman via OfficeKB.com\ Excel Worksheet Functions 8 July 8th 05 12:41 PM
How do I count number of cels the matches 2 conditions ? Abra Excel Worksheet Functions 2 February 27th 05 08:56 PM


All times are GMT +1. The time now is 07:24 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"