#1   Report Post  
Airfive
 
Posts: n/a
Default

Thank you all for your replies and help. This forum is a goldmine of
information.

" wrote:

Airfive wrote...
What am I missing.....The following array should return "5" if

cell A1
contains "ABC" and cell B1 contains "DEF" and cell C1 contains

"5". It is
returning "0". Any help would be greatly appreciated. Thanks.

{=SUM(IF(AND($A$1:$A$20="ABC", $B$1:$B$20="DEF"),$C$1:$C$20,0))}


AND (and OR for that matter) don't provide pairwise boolean operations.
They *only* return *single* values.

The reason the formula above returns 0 is no doubt due to A1:A20 not
*ALL* being equal to "ABC" and B1:B20 not *ALL* being equal to "DEF".
That is, if A1:B4 contained
{"ABC","DEF";"ABC","bar";"foo","DEF";"foo","bar "},

AND(A1:A4="ABC",B1:B4="DEF")

would evaluate as

== AND({"ABC";"ABC";"foo";"foo"}="ABC",{"DEF";"bar";" DEF";"bar"}="DEF")
== AND({TRUE;TRUE;FALSE;FALSE},{TRUE;FALSE;TRUE;FALSE })
== AND(TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,FALSE)
== FALSE

What you want is
=SUMPRODUCT(--($A$1:$A$20="ABC"),--($B$1:$B$20="DEF"),$C$1:$C$20)


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
Where is the bug in my array? Gail Gurman Excel Discussion (Misc queries) 1 January 25th 05 12:36 AM
Working with array equations OkieViking Excel Discussion (Misc queries) 2 January 23rd 05 07:43 AM
Transpose into a _working_ transposed array Fred Holmes Excel Discussion (Misc queries) 1 January 13th 05 11:31 PM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
VBA Import of text file & Array parsing of that data Dennis Excel Discussion (Misc queries) 4 November 28th 04 10:20 PM


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