[Solved] How to return result form Vlookup with IF AND statements

jing

New member
Hi,

Am trying to match the client ID from a range where the client ID is associated to one or more sub-customers. From the matched ID, we need to return the YES or NO status depending on the sub-customers.

Vlookup ID, IF ID Match, look through sub-customer column
If sub-customer = Yes and sub-customer = Yes return YES
If sub-customer = No and sub-customer = Yes return NO
If sub-customer = No and sub-customer = No return NO

But am not sure how to use the formula as there was an error "#NAME".
This was what I had used and it had an error - =VLOOKUP(A2,IF(AND(Sheet1!A:R,6="Yes",Sheet1!A:R,6="No"),"No", IF(AND(Sheet1!A:R,6=No,Sheet1!A:R,6="No"),"No", IF(AND(Sheet1!A:R,6="Yes",Sheet1!A:R,6="Yes"),"Yes"))),"")

Do share on how it should be done. Thank you.

Screenshot 2023-04-23 at 2.31.23 PM.png

Screenshot 2023-04-23 at 2.31.51 PM.png
 

Attachments

  • Screenshot 2023-04-23 at 2.16.59 PM.png
    Screenshot 2023-04-23 at 2.16.59 PM.png
    67.4 KB · Views: 3
  • Screenshot 2023-04-23 at 2.27.19 PM.png
    Screenshot 2023-04-23 at 2.27.19 PM.png
    21.8 KB · Views: 3
Hello,
Welcome to the ExcelDemy forum. According to your post, you wish to get the correct formula to match the client ID from a range where the client ID is associated with one or more sub-customers using VLOOKUP, IF, and AND Statements. Please follow the below formula to execute this process.
=IF(AND(VLOOKUP(A2,Sheet1!A:B,2,FALSE)="Yes",VLOOKUP(A2,Sheet1!A:B,2,FALSE)="Yes"),"Yes",IF(AND(VLOOKUP(A2,Sheet1!A:B,2,FALSE)="No",VLOOKUP(A2,Sheet1!A:B,2,FALSE)="Yes"),"No",IF(AND(VLOOKUP(A2,Sheet1!A:B,2,FALSE)="No",VLOOKUP(A2,Sheet1!A:B,2,FALSE)="No"),"No","")))
 

Attachments

  • Correct Formula.png
    Correct Formula.png
    22.5 KB · Views: 2
  • Range.png
    Range.png
    6.3 KB · Views: 2

Online statistics

Members online
0
Guests online
36
Total visitors
36

Forum statistics

Threads
292
Messages
1,268
Members
531
Latest member
lonkfps
Top