Excel - Data Matching Between two sheets

PikK45

New Member
Joined
Sep 3, 2013
Messages
5
All,

I have been using VLOOKUP for a long time now. But, there are many limitations to that. This one below is an example where I couldn't complete with VLOOKUP.

Lets say we have 6x2 rows in "sheet1".
XXX1
YYY2
BBB1
BBB1
OOO1
PPP1

<tbody>
</tbody>

Now, I have 10x2 rows in "sheet2". I have to search for col1[sheet2] in col1[sheet1]. If it is present, then I should put "YES" in col2[sheet2]. Below are the scenarios, where I get trouble.
  • XXX value on sheet1 is just1. So in Sheet2, I should get "YES" for only 1 row. But on VLOOKUP, I get "YES" for both.
  • BBB is present twice in sheet1. No matter how many times BBB occur in sheet2, I get YES for all

Is there a method to over come this limitation of VLOOKUP? Any other script or formula to get this thing done?

XXXYES
YYYYES
YYYYES
XXXNO
BBBYES
NNNNO
EEENO
OOOYES
BBBYES
SSSNO

<tbody>
</tbody>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Welcome to MrExcel.

Formula in E1 copied down:

Excel 2010
ABCDE
1XXX1XXXYES
2YYY2YYYYES
3BBB1YYYYES
4BBB1XXXNO
5OOO1BBBYES
6PPP1NNNNO
7EEENO
8OOOYES
9BBBYES
10SSSNO

<COLGROUP><COL style="BACKGROUND-COLOR: #dae7f5"><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet1

Worksheet Formulas
CellFormula
E1=IF(SUMIF(A:A,D1,B:B)>=COUNTIF(D$1:D1,D1),"YES","NO")

<THEAD>
</THEAD><TBODY>
</TBODY>

<TBODY>
</TBODY>
 
Upvote 0
Two ways:
1) Write an "IF" statement, the logic being:
if Yes then "1"
else "2"

2) Make an additional column next to the values you want and ask your VLOOKUP to bring that column instead -- this column could say whatever you need it to.

Hope that helps.
 
Upvote 0
Try this: =IF(COUNTIF($A$1:$A1,A1)<=SUMIF(Sheet1!$A$1:$A$6,A1,Sheet1!$B$1:$B$6),"Yes","No")
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,295
Members
451,636
Latest member
ddweller151

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