Excel vlookup problems

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Dear all,

I am relatively new to Excel and have little experience with functions, especially across different excel files.

I currently have two excel-files, where one looks like this (file 1):

Excel file 1 snip.PNG


And the other one looks like this (file 2):

excel file 2 snip.PNG


Currently, what I would like is for file 1 to return the value "YES" to every cell in column K. However, I ONLY want it to do this, if the client in column D in the corresponding cell number in file 1 is also present as a client in column D in file 2.

Is there some nice way to do this for example through a vlookup? And how would I go about it?

Any assistant would be greatly appreciated! Thank you so very much everybody! :)

Kind regards,
Jyggalag
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to Mr Excel :)

There are many ways that you could do this, I would say that either MATCH or COUNTIF would be the simplest methods.
Excel Formula:
=IF(ISNUMBER(MATCH(D2,[Book2]Sheet1!$D$2:$D$11,0)),"YES","NO")
Excel Formula:
=IF(COUNTIF([Book2]Sheet1!$D$2:$D$11,D2),"YES","NO")
Countif would be my personal choice, but that will not work if 'file 2' is closed.
 
Upvote 0
Welcome to Mr Excel :)

There are many ways that you could do this, I would say that either MATCH or COUNTIF would be the simplest methods.
Excel Formula:
=IF(ISNUMBER(MATCH(D2,[Book2]Sheet1!$D$2:$D$11,0)),"YES","NO")
Excel Formula:
=IF(COUNTIF([Book2]Sheet1!$D$2:$D$11,D2),"YES","NO")
Countif would be my personal choice, but that will not work if 'file 2' is closed.
Thank you so much Jason!

I can see that you refer to book2 and sheet1 in these codes.

Can I just enter this as a function in excel or would I need to use VBA codes?
 
Upvote 0
Or try this:

=IF(ISNA(VLOOKUP(D2,[Book2.xlsx]Sheet1'!$D$2:$D$40,1,0)),"No","Yes")
 
Upvote 0
H
Welcome to Mr Excel :)

There are many ways that you could do this, I would say that either MATCH or COUNTIF would be the simplest methods.
Excel Formula:
=IF(ISNUMBER(MATCH(D2,[Book2]Sheet1!$D$2:$D$11,0)),"YES","NO")
Excel Formula:
=IF(COUNTIF([Book2]Sheet1!$D$2:$D$11,D2),"YES","NO")
Countif would be my personal choice, but that will not work if 'file 2' is closed.
Hello Jason,

Currently if I do it I get this error (please note that I have to write ; instead of , when making formulas):

1615207932784.png
 
Upvote 0
You need to include the single quotes like
Excel Formula:
=IF(ISNA(VLOOKUP(D2,'[Book2.xlsx]Sheet1'!$D$2:$D$40,1,0)),"No","Yes")
You also need to change Book2.xlsx & Sheet1 to the name of your workbook & sheet
 
Upvote 0
Solution
Currently if I do it I get this error (please note that I have to write ; instead of , when making formulas):
You need to change all of the commas to semicolons, you've only done the last 2 :oops:

Excel Formula:
=IF(ISNUMBER(MATCH(D2;[Book2]Sheet1!$D$2:$D$11;0));"YES";"NO")
Phuoc's formula is missing an apostrophe
Excel Formula:
=IF(ISNA(VLOOKUP(D2'[Book2.xlsx]Sheet1'!$D$2:$D$40'1'0))'"No"'"Yes")

Other than that both should work fine.

edit:- one point to note, I haven't used the file extension (.xlsx) with my suggestion. In the event that you have 2 workbooks open with the same name and different file extensions then you could encounter problems there (never actually tried it).

Also, if 'Book2' is not open then you would need to include the entire file path in the formula (gets messy), so it is better to do it with the file open, excel will then add the rest of the path for you' Just remember that if you move or rename the file then the formula will break (this applies to any formula that refers to a different workbook, not just mine).
 
Last edited:
Upvote 0
You need to include the single quotes like
Excel Formula:
=IF(ISNA(VLOOKUP(D2,'[Book2.xlsx]Sheet1'!$D$2:$D$40,1,0)),"No","Yes")
You also need to change Book2.xlsx & Sheet1 to the name of your workbook & sheet
You need to change all of the commas to semicolons, you've only done the last 2 :oops:

Excel Formula:
=IF(ISNUMBER(MATCH(D2;[Book2]Sheet1!$D$2:$D$11;0));"YES";"NO")
Phuoc's formula is missing an apostrophe
Excel Formula:
=IF(ISNA(VLOOKUP(D2'[Book2.xlsx]Sheet1'!$D$2:$D$40'1'0))'"No"'"Yes")

Other than that both should work fine.
Fluff I remember you, you're literally a legend on this website. Very honored to have you visit my thread here :-)

Thank you so incredibly much guys. Truly! Both of you!

I fixed it and it works now!! :D

I cannot express my graditude, you're helping me so much here! Thank you!

1615209097427.png


I apologize for being way inferior compared to you in Excel. I really appreciated your patience here as well :)

Have a wonderful monday!

Kind regards,
Jyggalag
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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