Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default difference between logical AND and multiplication?

Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default difference between logical AND and multiplication?

For reason known only by the Excel developers, the Boolean operators cannot
be used in array formulas.

ASIDE: Please note "array formulas" not "matrix formulas" in English
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email


"ergo" wrote in message
ps.com...
Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default difference between logical AND and multiplication?

If you highlight the relevant parts of the formulas and then press f9 you
will see what thatpart of the formula resolves to.

The AND() will only be TRUE if all four cells are TRUE whereas the
multiplications are done individually.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"ergo" wrote in message
ps.com...
Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default difference between logical AND and multiplication?

the logical statements are not identical
the first is the same as
(A1="a")*(B1="d")*C1 +(A2="a")*(B2="d")*C2
(1)(0)(1)+(1)(1)(2)=2

the second
(A1="a")*(B1="d*(A2="a")*(B2="d")*C1+(A1="a")*(B1= "d*(A2="a")*(B2="d")*C2
(1)(0)(1)(1)(1)+(1)(0)(1)(1)(2)=0



"ergo" wrote:

Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default difference between logical AND and multiplication?

Olaf

Evaluating the second formula a piece at a time (by highlighting the
innermost parts of the formula and evaluating with F9) you can see
that a1:a2="a" evaluates to True, True; then B1:B2="d" evaluates to
False, True and therefore AND evaluates to False; hence the IF formula
evaluates to 0 and then the SUM is zero. In the first formula the
True, True and the False, True are multiplied, giving you a 0,1, which
is further multiplied by the 1,2 in C1:C2 leading to SUM evaluating to
2.

Ken



On Jun 25, 8:55 am, ergo wrote:
Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 301
Default difference between logical AND and multiplication?

Also known by me, Bernard! -- if ANY of the items in the AND yield FALSE,
the whole result is FALSE, rendering the usefulness of AND(...) useless in
this kind of formula!
Actually, I know you know that too!
Bob Umlas


"Bernard Liengme" wrote in message
...
For reason known only by the Excel developers, the Boolean operators
cannot be used in array formulas.

ASIDE: Please note "array formulas" not "matrix formulas" in English
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email


"ergo" wrote in message
ps.com...
Hi,

please consider the following example:

a c 1
a d 2

Why is (as matrix formula)

=SUM(IF((A1:A2="a")*(B1:B2="d");C1:C2;0))

(which is 2) different from (as matrix formula)

=SUM(IF(AND(A1:A2="a";B1:B2="d");C1:C2;0))

(which is 0)? I would expect 2 in both cases.

Rregerds Olaf





  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default difference between logical AND and multiplication?

"Bernard Liengme" wrote...
For reason known only by the Excel developers, the Boolean operators cannot
be used in array formulas.

....

They're *NOT* operators, they're functions. And there lies yet another
really bad Excel design decision. It's a function that HAS TO return a
SINGLE value. And that's what makes it effectively useless in array
formulas.


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
Multiplication Danny Mac Excel Worksheet Functions 8 December 7th 06 10:28 PM
multiplication fitpeach3 Excel Worksheet Functions 2 September 19th 06 11:07 PM
Matrix Multiplication Matrix Bill Excel Worksheet Functions 1 October 6th 05 06:53 PM
charting a difference of 2 columns' w/o adding a difference column Wab Charts and Charting in Excel 4 July 27th 05 02:37 AM
if logical test true, then hlookup, if false then difference betwe VictoriaG Excel Worksheet Functions 0 June 7th 05 08:53 PM


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