PC Review


Reply
Thread Tools Rate Thread

Compare two cells in two different files and return answer

 
 
Doug
Guest
Posts: n/a
 
      16th Nov 2009
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.


 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      16th Nov 2009
In C1 of Sheet2
=IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!$A$1:$A$20=A1),--('[My First
File.xls]Sheet1'!$B$1:$B$20=B1)),"Yes","No")
Replace the two '20' entries by however number of rows your need to compare
Copy down the column
Only in Excel 2007 can you use full column references as in
=IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!A:A=A1),--('[My First
File.xls]Sheet1'!B:B=B1)),"Yes","No")
best wishes
--
Bernard Liengme
http://people.stfx.ca/bliengme
Microsoft Excel MVP

"Doug" <(E-Mail Removed)> wrote in message
news:A7F2CF7B-930C-44DC-9B2F-(E-Mail Removed)...
> 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.
>
>

 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      16th Nov 2009
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" <(E-Mail Removed)> wrote in message
news:A7F2CF7B-930C-44DC-9B2F-(E-Mail Removed)...
> 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.
>
>

 
Reply With Quote
 
Doug
Guest
Posts: n/a
 
      16th Nov 2009
Thanks Bernard.

But, I'm still having an issue. I get a #value error for my return. Here is
the formula as a wrote it.

=IF(SUMPRODUCT(--($C$2:$I$259=C2),--('New Composites.xls'!$A$2:$B$4707='New
Composites.xls'!$A$2)),"Yes","no")

Any help is appreciated. Thanks again

"Bernard Liengme" wrote:

> In C1 of Sheet2
> =IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!$A$1:$A$20=A1),--('[My First
> File.xls]Sheet1'!$B$1:$B$20=B1)),"Yes","No")
> Replace the two '20' entries by however number of rows your need to compare
> Copy down the column
> Only in Excel 2007 can you use full column references as in
> =IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!A:A=A1),--('[My First
> File.xls]Sheet1'!B:B=B1)),"Yes","No")
> best wishes
> --
> Bernard Liengme
> http://people.stfx.ca/bliengme
> Microsoft Excel MVP
>
> "Doug" <(E-Mail Removed)> wrote in message
> news:A7F2CF7B-930C-44DC-9B2F-(E-Mail Removed)...
> > 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.
> >
> >

> .
>

 
Reply With Quote
 
Doug
Guest
Posts: n/a
 
      16th Nov 2009
I'm using the 2003 version?


"Bernard Liengme" wrote:

> 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" <(E-Mail Removed)> wrote in message
> news:A7F2CF7B-930C-44DC-9B2F-(E-Mail Removed)...
> > 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.
> >
> >

> .
>

 
Reply With Quote
 
David Biddulph
Guest
Posts: n/a
 
      16th Nov 2009
Your ranges need to be the same length.
259<>4707
--
David Biddulph

"Doug" <(E-Mail Removed)> wrote in message
news:BD24ECE4-3EF4-41DB-8412-(E-Mail Removed)...
> Thanks Bernard.
>
> But, I'm still having an issue. I get a #value error for my return. Here
> is
> the formula as a wrote it.
>
> =IF(SUMPRODUCT(--($C$2:$I$259=C2),--('New
> Composites.xls'!$A$2:$B$4707='New
> Composites.xls'!$A$2)),"Yes","no")
>
> Any help is appreciated. Thanks again
>
> "Bernard Liengme" wrote:
>
>> In C1 of Sheet2
>> =IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!$A$1:$A$20=A1),--('[My
>> First
>> File.xls]Sheet1'!$B$1:$B$20=B1)),"Yes","No")
>> Replace the two '20' entries by however number of rows your need to
>> compare
>> Copy down the column
>> Only in Excel 2007 can you use full column references as in
>> =IF(SUMPRODUCT(--('[My First File.xls]Sheet1'!A:A=A1),--('[My First
>> File.xls]Sheet1'!B:B=B1)),"Yes","No")
>> best wishes
>> --
>> Bernard Liengme
>> http://people.stfx.ca/bliengme
>> Microsoft Excel MVP
>>
>> "Doug" <(E-Mail Removed)> wrote in message
>> news:A7F2CF7B-930C-44DC-9B2F-(E-Mail Removed)...
>> > 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.
>> >
>> >

>> .
>>



 
Reply With Quote
 
Francis
Guest
Posts: n/a
 
      16th Nov 2009
Hi
Try this

=IF(SUMPRODUCT(--([Book1]Sheet1!$A$2:$A$4=A2),--([Book1]Sheet1!$B$2:$B$4=B2)),"Yes","No")

Bear in mind that your range need to be the same,eg the range A2 to A4 in
Sheet1 of Book1 must be the same in Sheet1 of Book2, ie A2 to A4, otherwise
you will get error message
--
Hope this help

Pls click the Yes button below if this post provide answer you have asked

Thank You

cheers, francis





"Doug" wrote:

> 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.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare Cells of Text and Return Highest Value based on a Customiz Rod Microsoft Excel Misc 1 1st Dec 2009 09:06 AM
RE: Compare two cells and return certain value in third cell =?Utf-8?B?VG9wcGVycw==?= Microsoft Excel Worksheet Functions 0 18th Jul 2006 03:01 PM
Re: Compare two cells and return certain value in third cell Special-K Microsoft Excel Worksheet Functions 0 18th Jul 2006 02:17 PM
Is there a way to compare two excel files for repetitious cells? =?Utf-8?B?RC4gVGhvbXBzb24=?= Microsoft Excel Worksheet Functions 1 28th Dec 2005 08:12 PM
Compare cells and return occurrences emm8080 Microsoft Excel Worksheet Functions 1 3rd Aug 2004 01:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:40 PM.