Started By
Message

Excel question: How do you compare values in two columns?

Posted on 1/26/17 at 4:22 pm
Posted by euphemus
Member since Mar 2014
536 posts
Posted on 1/26/17 at 4:22 pm
Let's say I have two Columns A and B with about 200 rows of entries. Some of the entiries could be in Column A alone, some in Column B alone and some in both.

What is the best way to come up with a list of entries that are in both columns? Is there a function that can do that?
Posted by spaceranger
Member since Jan 2017
1585 posts
Posted on 1/26/17 at 4:23 pm to
Vlookup
good luck
Posted by Breesus
House of the Rising Sun
Member since Jan 2010
66982 posts
Posted on 1/26/17 at 4:23 pm to
quote:

Let's say I have two Columns A and B with about 200 rows of entries. Some of the entiries could be in Column A alone, some in Column B alone and some in both.

What is the best way to come up with a list of entries that are in both columns?


Just look at them and you can see where there are doubles.

Lazy arse.
Posted by SEClint
New Orleans, LA/Portland, OR
Member since Nov 2006
48769 posts
Posted on 1/26/17 at 4:25 pm to
yeah I don't have anything useful to add either.

Just wanted to reply so you would get your hopes up.
Posted by Peazey
Metry
Member since Apr 2012
25418 posts
Posted on 1/26/17 at 4:25 pm to
Yeah, you can use vlookup to do it.

Eta: The lookup value in 1 column the data array starting in the other, and if it returns an error or nothing then there isn't a duplicate.
This post was edited on 1/26/17 at 4:27 pm
Posted by Paul Redeker
Member since Jan 2013
219 posts
Posted on 1/26/17 at 4:26 pm to
Conditional formatting highlight duplicates? Assuming no duplicate entries in A or B themselves. That's a quick way to do it.
This post was edited on 1/26/17 at 4:28 pm
Posted by Peazey
Metry
Member since Apr 2012
25418 posts
Posted on 1/26/17 at 4:28 pm to
That probably would be a cleaner solution.
Posted by soccerfüt
Location: A Series of Tubes
Member since May 2013
65497 posts
Posted on 1/26/17 at 4:29 pm to
You'll be the first one to kiss their shiny metal asses when the robot overlords assume power.

Robot arse kisser.

Do it manually, it's less than 200 col-umes.
Posted by Peazey
Metry
Member since Apr 2012
25418 posts
Posted on 1/26/17 at 4:29 pm to
Actually you could also just use a simple IF function. If column B=column A then duplicate. Would that work with text? I think so.
Posted by Chinese Bandit
Edmond, Ok
Member since Jan 2004
1543 posts
Posted on 1/26/17 at 4:31 pm to

Add a column in between so data is in A and C Label them Data 1 and Data 2

In column D put a 1 next to every data in Column C Label column D Lookup

In Column b on b2

=vlookup(a2,$c$2:$c$300,2,false)

Copy Formula all the way down column b

For every match in Column a there will be a 1

This post was edited on 1/26/17 at 4:32 pm
Posted by RJL2
Bruno's Tavern
Member since Apr 2015
1933 posts
Posted on 1/26/17 at 4:37 pm to
A really simple way if you suck at excel would be to sort each column A to Z then check it. If it's only 200 rows it won't take long.
Posted by CptRusty
Basket of Deplorables
Member since Aug 2011
11740 posts
Posted on 1/26/17 at 4:38 pm to
vlookup wouldn't really work

What you need is probably something like MATCH or INDEX nested in an IF statement.


Some help here:
LINK



so something like:
In column C:
MATCH(A1,$B$1:$B$200,0) {copied down to every cell so A1:A200 are captured} <-- This would return the row of each duplicate in the B column ...you could nest it in an IF statement to change it to a simple true or false...or now you can use VLookup to get the list of duplicates.



This post was edited on 1/26/17 at 4:45 pm
Posted by LSUfan20005
Member since Sep 2012
8807 posts
Posted on 1/26/17 at 4:41 pm to
Add column to each one stating "in a" "in b".

Then copy the data in the second set below the first set, now you have one continuous set.

Do a pivot table where the entry is the row, and your data will tell you how many sets it is in.

Hard to explain, but the easiest way.
Posted by GOON
Fantasy Land
Member since Mar 2008
7399 posts
Posted on 1/26/17 at 4:43 pm to
=iferror(if(vlookup(a1,B:B,1,false)=a1,"In both columns","Not in both columns"),"Not in both columns")


Actually, this might be better:

=iferror(vlookup(a1,B:B,1,false),"")

That would give you the list of only the values in both columns.
This post was edited on 1/26/17 at 4:50 pm
Posted by pjab
Member since Mar 2016
5643 posts
Posted on 1/26/17 at 4:45 pm to
In c1, =IF(a1=b1,a1," "). Pivot table on column C for unique values or paste values of C into another column then Data>remove duplicates.

Nvm, I read it as matching rows.
This post was edited on 1/26/17 at 4:48 pm
Posted by JudgeHolden
Gila River
Member since Jan 2008
18566 posts
Posted on 1/26/17 at 4:46 pm to
Why can't you run filters?
Posted by GOON
Fantasy Land
Member since Mar 2008
7399 posts
Posted on 1/26/17 at 4:47 pm to
quote:

In c1, =IF(a1=b1,a1," "). Pivot table on column C for unique values or paste values of C into another column then Data>remove duplicates.


That would only work if the values were all in the same rows.

A B
1 1
2 4
3 3
4 5
6 6

the first row would match with your formula, but row 2 wouldn't, even though "4" is in both columns.
Posted by Mir
Member since Sep 2016
2777 posts
Posted on 1/26/17 at 4:51 pm to
You get the people who work underneath you to do it.

Posted by lsu02150
BR
Member since May 2009
195 posts
Posted on 1/26/17 at 6:41 pm to
Delete data highlighted in yellow and blue and paste your columns in. Should give you your answer over the right with up to 300 records in each column. Make sure duplicates are removed from each column.

LINK
This post was edited on 1/26/17 at 6:43 pm
Posted by lynxcat
Member since Jan 2008
24121 posts
Posted on 1/26/17 at 6:57 pm to
Copy both columns into a third column to make one long column and then remove duplicates. This will give you all of the unique values.
first pageprev pagePage 1 of 2Next pagelast page

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram