Compare Columns / Generate List

crowncontent

New Member
Joined
Feb 23, 2011
Messages
7
Hi,

Can anyone help me with this --

I've got 2 worksheets. The first worksheet has the following 3 columns -- Subscriber #, Subscriber Name, Book A.

The second worksheet has the following 3 columns -- Subscriber #, Subscriber Name, Book B.

I want to create a formula in a third worksheet that will generate a list of who has bought both Book A AND Book B. If possible, also create a formula that will do the reverse, which is tell me who has bought Book A but has not bought Book B.

The Subscriber # can be used as a unique identifier.

Been struggling with this for the last few days. BIG THANKS TO WHOEVER CAN HELP ME OUT WITH THIS!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi & Welcome,

One way of doing it, there are many other ways:

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; FONT-FAMILY: Arial,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD></TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD><TD>I</TD><TD>J</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">SUBSCRIBER #</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">Subscriber Name</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">BOOK A</TD><TD> </TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">SUBSCRIBER #</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">Subscriber Name</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">BOOK B</TD><TD> </TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #c0c0c0">SUBSCRIBER #</TD><TD style="FONT-WEIGHT: bold; BACKGROUND-COLOR: #ccffcc">PURCAHSED A & B</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">1</TD><TD>Person 1</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">1</TD><TD>Person 1</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">1</TD><TD>YES</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">2</TD><TD>Person 2</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">2</TD><TD>Person 2</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">2</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">3</TD><TD>Person 3</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">3</TD><TD>Person 3</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">3</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD style="TEXT-ALIGN: right">4</TD><TD>Person 4</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">4</TD><TD>Person 4</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">4</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD style="TEXT-ALIGN: right">5</TD><TD>Person 5</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">5</TD><TD>Person 5</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">5</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</TD><TD style="TEXT-ALIGN: right">6</TD><TD>Person 6</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">6</TD><TD>Person 6</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">6</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</TD><TD style="TEXT-ALIGN: right">7</TD><TD>Person 7</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">7</TD><TD>Person 7</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">7</TD><TD>YES</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</TD><TD style="TEXT-ALIGN: right">8</TD><TD>Person 8</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">8</TD><TD>Person 8</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">8</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">10</TD><TD style="TEXT-ALIGN: right">9</TD><TD>Person 9</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">9</TD><TD>Person 9</TD><TD>YES</TD><TD> </TD><TD style="TEXT-ALIGN: right">9</TD><TD>NO</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">11</TD><TD style="TEXT-ALIGN: right">10</TD><TD>Person 10</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">10</TD><TD>Person 10</TD><TD>NO</TD><TD> </TD><TD style="TEXT-ALIGN: right">10</TD><TD>NO</TD></TR></TBODY></TABLE>
<TABLE style="FONT-SIZE: 10pt; BORDER-LEFT-COLOR: #00ff00; BORDER-BOTTOM-COLOR: #00ff00; COLOR: #000000; BORDER-TOP-STYLE: groove; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-RIGHT-STYLE: groove; BORDER-LEFT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-RIGHT-COLOR: #00ff00; BORDER-BOTTOM-STYLE: groove"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-SIZE: 9pt; FONT-FAMILY: Arial" cellSpacing=0 cellPadding=2 border=1><TBODY><TR style="FONT-SIZE: 10pt; BACKGROUND-COLOR: #cacaca"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>J2</TD><TD>=IF(AND(VLOOKUP(I2,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I2,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J3</TD><TD>=IF(AND(VLOOKUP(I3,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I3,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J4</TD><TD>=IF(AND(VLOOKUP(I4,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I4,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J5</TD><TD>=IF(AND(VLOOKUP(I5,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I5,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J6</TD><TD>=IF(AND(VLOOKUP(I6,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I6,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J7</TD><TD>=IF(AND(VLOOKUP(I7,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I7,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J8</TD><TD>=IF(AND(VLOOKUP(I8,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I8,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J9</TD><TD>=IF(AND(VLOOKUP(I9,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I9,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J10</TD><TD>=IF(AND(VLOOKUP(I10,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I10,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR><TR><TD>J11</TD><TD>=IF(AND(VLOOKUP(I11,$A$2:$C$11,3,FALSE)="YES",VLOOKUP(I11,$E$2:$G$11,3,FALSE)="YES"),"YES","NO")</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
 
Upvote 0
Thanks shemayisroel! I'm impressed with the quick reply. How would I do it if Column A in both sheets do not have an exact match of people in the list. Here's an example --

WORKSHEET 1
A ----------- B ------------ C
002 ----- John Smith ----- Book A
004 ----- Greg Ayers ----- Book A
006 ----- Fred Hilton ----- Book A
008 ----- Dave Myers ----- Book A
010 ----- Philip Black ----- Book A

WORKSHEET 2
A ----------- B ------------ C
001 ----- Mark Coles ----- Book B
004 ----- Greg Ayers ----- Book B
006 ----- Fred Hilton ----- Book B
007 ----- Frank James ----- Book B
009 ----- Mary White ----- Book B
010 ----- Philip Black ----- Book B

The result I need is --

WORKSHEET 3
A ----------- B ------------ C ---------- D
004 ----- Greg Ayers ----- Book A ----- Book B
006 ----- Fred Hilton ----- Book A ----- Book B
010 ----- Philip Black ----- Book A ----- Book B

Am I asking too much? Thanks!
 
Upvote 0
That should not make a difference to the result, although to just display the result you showed in your example you'll need to change the approach and would probably require a combination of solutions to achieve the desired result display...
 
Upvote 0
Thanks shemayisroel! Just tried it and it works. Used your code to generate the results then just filtered and sorted to get the display result I needed. Much appreciated!!!
 
Upvote 0

Forum statistics

Threads
1,224,588
Messages
6,179,743
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top