#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default -- operator

Hi,

Quick question really... I wanted to 'countif ' with several criteria
and found the following on the mr excel boards:

=SUMPRODUCT(--(B1:B1000="Chris"),--(C1:C1000="working"),--
(D1:D1000="laptop"))

(it counts the rows which have Chris working with a laptop).

It worked really well, but I've been unable to find a description of
the -- operator? (neither the help nor google have been able to help
me so far...)

Could anyone enlighten me?

Thanks in advance,

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default -- operator

read sumproduct explained

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--


Gary


"christian_spaceman" wrote in message
ups.com...
Hi,

Quick question really... I wanted to 'countif ' with several criteria
and found the following on the mr excel boards:

=SUMPRODUCT(--(B1:B1000="Chris"),--(C1:C1000="working"),--
(D1:D1000="laptop"))

(it counts the rows which have Chris working with a laptop).

It worked really well, but I've been unable to find a description of
the -- operator? (neither the help nor google have been able to help
me so far...)

Could anyone enlighten me?

Thanks in advance,

Chris



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default -- operator

-- coerces the boolean values from the tests into 0's (False) and 1's (True).
An alternate way to write the expression would be
=SUMPRODUCT((B1:B1000="Chris")*(C1:C1000="working" )*(D1:D1000="laptop"))
I prefer this approach, because it more readily generalizes to more
complicated conditions. "*" corresponds exactly to a logical AND, "+"
corresponds (sort of) to a logical OR, and you can add parentheses
appropriately to control the order of evaluation.

I say that "+" only "sort of" corresponds to OR, because TRUE+TRUE = 2
instead of 1, so you may need to convert back to an array of 0|1 values (such
as wrapping the expression in the SIGN function).

Jerry

"christian_spaceman" wrote:

Hi,

Quick question really... I wanted to 'countif ' with several criteria
and found the following on the mr excel boards:

=SUMPRODUCT(--(B1:B1000="Chris"),--(C1:C1000="working"),--
(D1:D1000="laptop"))

(it counts the rows which have Chris working with a laptop).

It worked really well, but I've been unable to find a description of
the -- operator? (neither the help nor google have been able to help
me so far...)

Could anyone enlighten me?

Thanks in advance,

Chris


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default -- operator

Thanks guys - much appreciated.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default -- operator

Thanks guys - much appreciated.


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
IN operator Suzanne Excel Worksheet Functions 4 May 10th 06 06:28 PM
XOR Operator - How? Randy Brown Excel Discussion (Misc queries) 3 April 8th 06 09:47 PM
what does ~ operator mean? Todd Excel Discussion (Misc queries) 3 November 22nd 05 05:30 PM
Mod operator R Avery Excel Programming 7 September 2nd 04 03:03 AM
Need help with the Like Operator DennisE Excel Programming 3 April 27th 04 11:47 PM


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