[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Columns compare

Posted on 2011-03-16
5
Medium Priority
?
259 Views
Last Modified: 2012-05-11
Hi, in my excel file I have two columns. Each of them has thousands of rows.
I want to know whether they are overlap. In other words, column A includes any element in column B?

Thanks.
0
Comment
Question by:zhshqzyc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:akajohn
ID: 35148462
Could you post an example of a few rows.
We would like to know your definition of overlap and is the data text, numbers or dates ?

Thanks.
0
 

Author Comment

by:zhshqzyc
ID: 35148636
column A:7895
7896
7897
7898
7899
7909
7916
7918
7920
7921

Open in new window

column B
3467
3472
3475
3476
3477
3480
3482
3483
297-020
303-020
308-001
310-001
314-001
320-020
325-001
326-001

Open in new window

0
 
LVL 12

Expert Comment

by:telyni19
ID: 35148712
For a simple one-way horizontal text comparison, you could use the SEARCH (not case-sensitive) or FIND (case-sensitive) functions:

=IF(ISERR(SEARCH(B1,A1)),"Distinct","Overlap")

This tests whether cell A1 contains the value of cell B1; if it does, the function returns "Overlap", if it doesn't, an error is generated and trapped to return "Distinct" - these return values could be any appropriate text or number.

If you want to test whether column A contains a whole instance of B1 anywhere, then use VLOOKUP:
=IF(ISERR(VLOOKUP(B1, A$1:A$65536,1,false)),"Distinct","Overlap")

Copy the desired formula down the column as appropriate. The VLookup doesn't need to search the entire column A, only as far down as the data goes, so replace 65536 with the last row of your data.

Your example doesn't show any "overlap" between the two sets of numbers, so I think it's still not clear what you consider an overlap to be, but the two methods I've described above will do comparisons of values in column B in two different ways to column A.
0
 

Author Comment

by:zhshqzyc
ID: 35148916
=IF(ISERR(VLOOKUP(B1, A$1:A$65536,1,false)),"Distinct","Overlap")

Open in new window

Can you double check your formula? I got a wrong result.
0
 
LVL 12

Accepted Solution

by:
telyni19 earned 200 total points
ID: 35148967
Sorry, use ISERROR instead of ISERR. VLOOKUP returns #N/A which isn't considered an error by ISERR but is considered an error by ISERROR.

=IF(ISERROR(VLOOKUP(B1, A$1:A$65536,1,false)),"Distinct","Overlap")
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question