Vlookup

ekhawaja

Board Regular
Joined
Dec 16, 2018
Messages
60
Office Version
  1. 365
Hello,

Looking for a formula that looks for an item in sheet 2, the tag name is repeated in sheet 2, and want the formula to return "yes" only if all the corresponding Status is "yes". If a "no" or "blank" or a combination of "yes", "no", "blank" exists, the formula should return "No".
Thanks in advance!
Sheet 1Sheet 2
TagStatusTagStatus
applenopeachyes
orangeyespeachno
peachnoappleyes
orangeyes
peachyes
peachyes
orangeyes
orangeyes
apple
apple
appleyes
appleno
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
how about
=IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no")

sheet1
Book2
ABC
1TagStatus
2applenono
3orangeyesYes
4peachnono
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no")


sheet2
Book2
AB
1TagStatus
2peachyes
3peachno
4appleyes
5orangeyes
6peachyes
7peachyes
8orangeyes
9orangeyes
10apple
11apple
12appleyes
13appleno
Sheet2
 
Upvote 1
thank you so much for the reply @etaf , for some reason, I am getting all "yes", I feel something is wrong with my formula .😁
 
Upvote 0
thank you so much for the reply @etaf , for some reason, I am getting all "yes", I feel something is wrong with my formula .😁
One more thing i realized we need to incorporate, if for example we lookup "pear" in Sheet 2, and it doesn't exist in sheet 2, to return error.
 
Upvote 0
for some reason, I am getting all "yes", I feel something is wrong with my formula
it would be worth posting your data layout , using xl2bb or on a share see below

f for example we lookup "pear" in Sheet 2, and it doesn't exist in sheet 2, to return error.

=IF(COUNTIF(Sheet2!A2:A13,Sheet1!A2)=0,"error",IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no"))

Book4
ABC
1TagStatus
2applenono
3orangeyesYes
4peachnono
5pearerror
6salmonerror
Sheet1
Cell Formulas
RangeFormula
C2:C6C2=IF(COUNTIF(Sheet2!A2:A13,Sheet1!A2)=0,"error",IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no"))


Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 1
Solution
I think something is wrong with the format of the table that i am using, i have 1000s rows of data, so i cannot upload sheet. Plus, i downloaded the XL2BB but the Minisheet is grayed out.
 
Upvote 0
you cannot upload excel here But you could put on a share like dropbox or onedrive or google sheet
and then post the share link
 
Upvote 0
it would be worth posting your data layout , using xl2bb or on a share see below



=IF(COUNTIF(Sheet2!A2:A13,Sheet1!A2)=0,"error",IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no"))

Book4
ABC
1TagStatus
2applenono
3orangeyesYes
4peachnono
5pearerror
6salmonerror
Sheet1
Cell Formulas
RangeFormula
C2:C6C2=IF(COUNTIF(Sheet2!A2:A13,Sheet1!A2)=0,"error",IF(COUNTIF(Sheet2!$A$2:$A$13,Sheet1!A2)=COUNTIFS(Sheet2!$A$2:$A$13,Sheet1!A2,Sheet2!$B$2:$B$13,"yes"),"Yes","no"))


Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
this formula is working now, error was that some of the cells had "extra space" in them which resulted in the error. I had to manually delete the "spaces" then the formula worked perfectly!!
 
Upvote 0

Forum statistics

Threads
1,216,067
Messages
6,128,590
Members
449,461
Latest member
jaxstraww1

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