zhshqzyc
asked on
Columns compare
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.
I want to know whether they are overlap. In other words, column A includes any element in column B?
Thanks.
ASKER
column A:7895
7896
7897
7898
7899
7909
7916
7918
7920
7921
column B3467
3472
3475
3476
3477
3480
3482
3483
297-020
303-020
308-001
310-001
314-001
320-020
325-001
326-001
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)),"Dis tinct","Ov erlap")
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.
=IF(ISERR(SEARCH(B1,A1)),"
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)),"Dis
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.
ASKER
=IF(ISERR(VLOOKUP(B1, A$1:A$65536,1,false)),"Distinct","Overlap")
Can you double check your formula? I got a wrong result.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
We would like to know your definition of overlap and is the data text, numbers or dates ?
Thanks.