Thread: OR function
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default OR function


Hi Kevin,

=MATCH(A2:C2,F2:H2,0)

as I'm sure you know, gives an array of either numbers (when there is a
match) or #N/A (when there isn't) so something like

{#N/A,3,#N/A)

[if the only match is between B2 and H2]

=ISNA(MATCH(A2:C2,F2:H2,0))

would then convert this to

{TRUE,FALSE,TRUE)

and

=1-ISNA(MATCH(A2:C2,F2:H2,0))

gives you

{0,1,0}

SUMPRODUCT then adds these together so the SUMPRODUCT result is zero
only when there are no matches

an alternative formula

=IF(SUMPRODUCT(COUNTIF(A2:C2,F2:H2)),"match","no match")

which I believe is less efficient but possibly useful if one of your
ranges is not a single row or column, or even

=IF(ISNUMBER(LOOKUP(9.99999999999999E+307,MATCH(A2 :C2,F2:H2,0))),"match","no
match")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=512906