Vlookup on multiple columns

pjandshelly

Board Regular
Joined
Jan 25, 2017
Messages
55
I have a table of courses with the name of the student. Then I have another table that I am trying to get a Yes or No value based on if they took the class. I believe I need a vlookup function, but I am missing how to get that data.

Student Course
Tom Smith Math 101
Jerry Jones Math 101
Jerry Jones Science 101

Student Math 101 Science 101
Tom Smith Yes No
Jerry Jones Yes Yes

Thank you for any help.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,177
Office Version
365
Platform
Windows
Here is one way.

Let's say that your data of studetns and courses is in the range A1:B4.
And let's say that they new table with formulas you are trying to build is in F1:H3
Then, place this formula in cell G2:
Code:
=IF(COUNTIFS($A:$A,$F2,$B:$B,G$1)>0,"Yes","No")
and copy all the way to H3 (so G2:H3 all have formulas).
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,177
Office Version
365
Platform
Windows
You are welcome.

If you have a lot of data, and find that it runs slow sometimes, you may be able to speed it up by using specific range references, instead of entire column references, i.e.
Code:
=IF(COUNTIFS([COLOR=#ff0000]$A1:$A1000[/COLOR],$F2,[COLOR=#ff0000]$B1:$B1000[/COLOR],G$1)>0,"Yes","No")
Just make sure that you go down far enough to cover all your data, and make sure that the two ranges highlighted in red have the same row numbers.
 

Forum statistics

Threads
1,078,442
Messages
5,340,305
Members
399,366
Latest member
ahmed elsaid

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top