View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar Elkar is offline
external usenet poster
 
Posts: 964
Default IF AND statement with cell range

See if this works for you:

=IF(SUMPRODUCT(--($A$1:$A$1000=C1),--($B$1:$B$1000=D1))0,"YES","NO")

Note that ranges used in the SUMPRODUCT function cannot be entire columns,
such as $A:$A. You could use $A$1:$A$65535.

HTH,
Elkar


"JN" wrote:

I am trying to compare 2 cells against a range to determine if there is a
match:

Col A Col B Col C Col D
MARY BROWN TED SMITH
TED SMITH
BOB JONES

I'm using =IF(AND(C3=$A:$A,D3=$B:$B),"YES","NO") but it's obviously wrong
because I'm getting "NO" when it should return "YES". What am I doing wrong?