Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I count only if either/ or exist

I am attempting to count how many times there is a number greater than zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1 and
B=1, count only once.

Thank you for any help
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 905
Default How do I count only if either/ or exist

"wildbillyd" wrote:
My goal is if A=0 and B=0, do not count.
If A=0 and B=1, count. If A=1 and B=1,
count only once.


One way:

=sumproduct(--((A1:A100)+(B1:B100)0))

The "+" functions as "OR" in this context. The OR function cannot be used
in this context; it will not be interpreted as intended. The "--" (double
negation) is used to convert the truth values (TRUE and FALSE) to numeric
values (1 and 0), which SUMPRODUCT looks for. Any arithmetic operation with
truth values will accomplish the same thing.


----- original message -----

"wildbillyd" wrote:
I am attempting to count how many times there is a number greater than zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1 and
B=1, count only once.

Thank you for any help

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default How do I count only if either/ or exist

What about something like this...

=COUNTIF(A1:A99,"0")+COUNTIF(B1:B99,"0")

--
Rick (MVP - Excel)


"wildbillyd" wrote in message
...
I am attempting to count how many times there is a number greater than zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1
and
B=1, count only once.

Thank you for any help


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 905
Default How do I count only if either/ or exist

"Rick Rothstein" wrote in message
...
What about something like this...
=COUNTIF(A1:A99,"0")+COUNTIF(B1:B99,"0")


Rick, does that meet that OP's condition that "[if] A=1 and B=1, count only
once"?


----- original message -----

"Rick Rothstein" wrote in message
...
What about something like this...

=COUNTIF(A1:A99,"0")+COUNTIF(B1:B99,"0")

--
Rick (MVP - Excel)


"wildbillyd" wrote in message
...
I am attempting to count how many times there is a number greater than
zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1
and
B=1, count only once.

Thank you for any help



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How do I count only if either/ or exist

Here's another one...

=SUMPRODUCT(SIGN((A1:A1000)+(B1:B1000)))

This version is slightly more efficient on larger ranges.

--
Biff
Microsoft Excel MVP


"wildbillyd" wrote in message
...
I am attempting to count how many times there is a number greater than zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1
and
B=1, count only once.

Thank you for any help





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default How do I count only if either/ or exist

No, it doesn't... I skimmed the OP's question too fast and completely missed
that requirement. Thanks for pointing it out.

--
Rick (MVP - Excel)


"Joe User" <joeu2004 wrote in message
...
"Rick Rothstein" wrote in message
...
What about something like this...
=COUNTIF(A1:A99,"0")+COUNTIF(B1:B99,"0")


Rick, does that meet that OP's condition that "[if] A=1 and B=1, count
only once"?


----- original message -----

"Rick Rothstein" wrote in message
...
What about something like this...

=COUNTIF(A1:A99,"0")+COUNTIF(B1:B99,"0")

--
Rick (MVP - Excel)


"wildbillyd" wrote in message
...
I am attempting to count how many times there is a number greater than
zero
in either column A or column B.

My goal is if A=0 and B=0, do not count. If A=0 and B=1, count. If A=1
and
B=1, count only once.

Thank you for any help




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 return a unique count where conditions exist? Cher Excel Worksheet Functions 4 June 20th 08 06:00 PM
Count if multiple variable exist Stan Excel Discussion (Misc queries) 1 March 16th 07 03:30 PM
Exist or Not. ldiaz Excel Discussion (Misc queries) 3 September 6th 06 09:31 PM
Count if 3 different conditions exist AnnaV Excel Discussion (Misc queries) 4 December 30th 05 06:57 PM
count how often a name exist hans Excel Worksheet Functions 4 January 27th 05 02:44 PM


All times are GMT +1. The time now is 11:58 AM.

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"