Check if multiple values exist in other columns

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi

I want to check that both ID and Date from the right side match the value in the columns on the left. If both matches are true i want to vlookup(the easy bit!) to return programme name into column I.

I have tried using a match statement but can't get it to work.

Can any one help please?

if and match.xlsx
ABCDEFGHIJK
1IDDateprogrammeID Dateprogramme
212301/11/2021maths22201/12/20214Yes
333301/02/2022english12301/11/2021Yes
422201/12/2021history33301/02/2022Yes
Sheet1
Cell Formulas
RangeFormula
I2I2=IF(MATCH(G2,A:A,0),(MATCH(H2,B:B,0)),"no match")
K2:K4K2=IF(MATCH(H2,B:B,0),"Yes","No")
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
countifs()
=COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)
and then use that in an IF
=IF( COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2) > 0 , Vlookup() , "what to put if not a match")

Book7
ABCDEFGHIJKL
1IDDateprogrammeID DateprogrammeCount
212344501maths222445314Yes1
333344593english12344501Yes1
422244531history33344593Yes1
50
60
7
Sheet1
Cell Formulas
RangeFormula
I2I2=IF(MATCH(G2,A:A,0),(MATCH(H2,B:B,0)),"no match")
K2:K4K2=IF(MATCH(H2,B:B,0),"Yes","No")
L2:L6L2=COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)
 
Upvote 0
i thought i would add the full lookup included , using an index/match or if preferred can use a vlookup

Book7
ABCDEFGHIJKLMN
1IDDateprogrammeID DateprogrammeCountLookupProgramme
212344501maths222445314Yes1historyhistory
333344593english12344501Yes1mathsmaths
422244531history33344593Yes1englishenglish
500no Match
600no Match
7no Match
8no Match
Sheet1
Cell Formulas
RangeFormula
I2I2=IF(MATCH(G2,A:A,0),(MATCH(H2,B:B,0)),"no match")
L2:L6L2=COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)
M2:M6M2=INDEX($C$2:$C$15,MATCH(G2&H2,$A$2:$A$15&$B$2:$B$15,0))
K2:K4K2=IF(MATCH(H2,B:B,0),"Yes","No")
N2:N8N2=IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0, INDEX($C$2:$C$15,MATCH(G2&H2,$A$2:$A$15&$B$2:$B$15,0)),"no Match")
 
Upvote 0
What if there are multiple ID's to look up like this, the vlookup/match wouldn't know which programme to pull back?

if and match.xlsx
ABCDEFGHI
1IDDateprogrammeID Dateprogramme
212301/11/2021maths22201/12/2021history
333301/02/2022english12301/11/2021maths
422201/12/2021history33301/02/2022english
522201/02/2022geography12325/01/2022
612325/01/2022IT22201/02/2022
Sheet1
Cell Formulas
RangeFormula
I2:I4I2=IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0,INDEX(C1:C4,MATCH(G2,A1:A4,0),0),"no")
 
Upvote 0
no , it will only pull back the first one it finds
Off the top of my head not sure , but i know i have seen this solution a few times
Would you want both showing
OR first OR last
OR ?
 
Upvote 0
no , it will only pull back the first one it finds
Off the top of my head not sure , but i know i have seen this solution a few times
Would you want both showing
OR first OR last
OR ?
The one where both id and date match.
 
Upvote 0
NOTE - =IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0,INDEX(C1:C4,MATCH(G2,A1:A4,0),0),"no") needs range changing and fixed anyway
=IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0,INDEX($C$1:$C415,MATCH(G2,$A$1:$A415,0),0),"no")

BUT beside that - just for FYI

how about

=IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0,INDEX($C$1:$C$15,MATCH(G2&H2,$A$1:$A$15&$B$1:$B$15,0),0),"no")
NOTE The range needs to cover the entire table - and needs $ to fix , so as you copy down it does not change


Book2
ABCDEFGHI
1IDDateprogrammeID Dateprogramme
212311/1/21maths22212/1/21history
33332/1/22english12311/1/21maths
422212/1/21history3332/1/22english
52222/1/22geography1231/25/22IT
61231/25/22IT2222/1/22geography
7
Sheet1
Cell Formulas
RangeFormula
I2:I6I2=IF(COUNTIFS($A$2:$A$15,G2,$B$2:$B$15,H2)>0,INDEX($C$1:$C$15,MATCH(G2&H2,$A$1:$A$15&$B$1:$B$15,0),0),"no")
 
Upvote 0
Solution

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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