Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Excel Help

Thread Tools
 
Old Mar 1, 2004 | 01:59 PM
  #1  
AquilaEagle's Avatar
Thread Starter
Administrator
Gold Member (Premium)
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Jan 2002
Posts: 95,183
Likes: 69
From: Heath & Reach, Beds, UK
Default Excel Help

I'm trying to compare 2 columns of text in Excel to see if the same text appears in both columns or not. So for example I have:

Column A
Apples
Oranges
Pears
Grapes

Column B
Pears
Grapes

I want Excel to show in another column if each is in both, or in just one of the columns, and return some text, like True (if in both columns or False if just in one of the 2 columns)

I'm dealing with 2500 rows of data so need a formula to do it, and that damn paperclip bloke wont give me the answer

I've tried EXACT, IF, OR and AND formulas but cant get them to work

Help appreciated
Reply
Old Mar 1, 2004 | 02:05 PM
  #2  
AquilaEagle's Avatar
Thread Starter
Administrator
Gold Member (Premium)
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Jan 2002
Posts: 95,183
Likes: 69
From: Heath & Reach, Beds, UK
Default

Here's further explanation:
[CODE]

Reply
Old Mar 1, 2004 | 02:15 PM
  #3  
tomunderhill's Avatar
Registered User
 
Joined: Nov 2003
Posts: 75
Likes: 0
From: Colchester
Default

THis may not be the most elegant solution but all I can come up with at moment

Firstly make sure that column B is the longer of the 2 lists (if they are not the same size)
Then sort all column A alphabetically

Then for column C, use a formula like

=IF(LOOKUP(B2,$A$2:$A$4)=B2, TRUE, FALSE)

where A2 - A4 are your range of first set of data (make sure you change this range)

this formula is for C2 - simply copy this formula for all results in the C column

Hope it helps - let me know if you need any clarification
Reply
Old Mar 1, 2004 | 02:15 PM
  #4  
GSi's Avatar
GSi
Registered User
 
Joined: Oct 2002
Posts: 14,723
Likes: 0
Default

=vlookup(a2,$B$2:$B$99,1,FALSE)

A2 is the cell you are checking for an occurance of
$B$2:$B$99 is the range which contains the cells you want to search through
1 is the column offset (as your range could be more than one column wide)
FALSE tells it only to return exact matches, otherwise it will return the last value it found before it couldn't find the one it was looking for (relies on the B2:B99 range to be sorted)

Returns N/A if not found

Reply
Old Mar 1, 2004 | 02:16 PM
  #5  
GSi's Avatar
GSi
Registered User
 
Joined: Oct 2002
Posts: 14,723
Likes: 0
Default

Great minds..
Reply
Old Mar 1, 2004 | 02:28 PM
  #6  
AquilaEagle's Avatar
Thread Starter
Administrator
Gold Member (Premium)
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Jan 2002
Posts: 95,183
Likes: 69
From: Heath & Reach, Beds, UK
Default

hmm it wont work

Does it make a difference if the 2 data sets are on different worksheets?
Reply
Old Mar 1, 2004 | 02:31 PM
  #7  
GSi's Avatar
GSi
Registered User
 
Joined: Oct 2002
Posts: 14,723
Likes: 0
Default

Only to your formula

wanna send me the spreadsheet?
Reply

Trending Topics

Old Mar 1, 2004 | 02:34 PM
  #8  
AquilaEagle's Avatar
Thread Starter
Administrator
Gold Member (Premium)
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Jan 2002
Posts: 95,183
Likes: 69
From: Heath & Reach, Beds, UK
Default

YHM
Reply
Old Mar 1, 2004 | 08:05 PM
  #9  
Hustn's Avatar
Registered User
 
Joined: Oct 2003
Posts: 862
Likes: 0
From: Conifer, CO
Default

[QUOTE]Originally posted by AquilaEagle
I'm trying to compare 2 columns of text in Excel to see if the same text appears in both columns or not.
Reply
Old Mar 1, 2004 | 11:21 PM
  #10  
GSi's Avatar
GSi
Registered User
 
Joined: Oct 2002
Posts: 14,723
Likes: 0
Default

Hi Hustn, He got an answer

BTW, there is a flaw in your formula. For it to work the lists would have to be exactly the same (both in content and length). As in AEs example above, if the entries were not on the same line that formula wouldn't spot it.

cat bat false
dog dog true
bat pig false

But it should be true as bat is in the second list.

the VLOOKUP function does this searching of the second list for you, so it doesn't matter where in the list the thing you are looking for is or if they are the same length.

Reply



All times are GMT -8. The time now is 08:06 PM.