View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Compare two cells in two different files and return answer

If you are using Excel 2007
=IF(COUNTIFS('[My First File.xls]Sheet1'!$A:$A,A1,'[My First
File.xls]Sheet1'!$B:$B,B1),"y","n")
best wishes
--
Bernard Liengme
http://people.stfx.ca/bliengme
Microsoft Excel MVP

"Doug" wrote in message
...
I am attempting to compare two text cells and if they both exist, I want
to
bring in a "yes" answer. If they don't, bring in a "no" answer. Here's an
example of text.

File 1
Col A Col B
BRATTA ZPB_COMMON
AHERNC ZPB_COMMON
GENCABH ZPB_COMMON

File 2
Col A Col B
BRATTA ZPB_COMMON
AHERNC ZPB_COMMON
GENCABH

So, what I want to do is say in File 1 take cells A1 and B1 compare them
to
File 2 and search Col A and Col B and if there is an exact match
somewhere
in file 2 then return a "yes" in column C. If not, "no" in column C.

So, file 2 would look like this:
File 2
Col A Col B Col C
BRATTA ZPB_COMMON Yes
AHERNC ZPB_COMMON Yes
GENCABH No


Thanks in advance for any help.