I have attempted to do this with index/match, vlookup, If statements, etc. I have searched for days (It it possible I don't know how to define what I am doing properly). VBA is new to me.
I have 2 sheets, the first Sheet (dataWs) is data to search titled Ach. Column A contains employee ID's on or about 3500 rows. Column B contains job duty codes. A single employee may have 1 or 20 job code entries, based on jobs they are qualified to perform. There are other columns for status and expire date, but they are not relevant.
Sheet 2 (outputWs) contains ID numbers in column A (and a contact email in column B). I would like column C to find ID number in Sheet 1 column a, then in all entries for that ID, find job code 53 in sheet1 column B then reflect true or false if the employee ID is qualified to perform job duty 53 on Sheet 2 column C. If it is easier - putting just "53" in column c would also work.
Here is a standard index match that works for ID lookup but does not consider the code 53 lookup:
Sub findJobQual ()
Dim outputWs As Worksheet, dataWs As Worksheet
Dim outputLastRow As Long, dataLastRow As Long, x As Long
Dim IndexRng As Range, MatchRng As Range
'Sources
Set outputWs = ThisWorkbook.Worksheets("Qualified")
Set dataWs = ThisWorkbook.Worksheets("Ach")
'count rows in tables
outputLastRow = outputWs.Range("A" & Rows.Count).End(xlUp).Row
dataLastRow = dataWs.Range("A" & Rows.Count).End(xlUp).Row
'Data column to return values from (Desired return)
Set IndexRng = dataWs.Range("B2:B" & dataLastRow)
'Data sent match to(Row)(Column)
Set MatchRng = IndexRng.Offset(0, -1)
On Error Resume Next
For x = 2 To outputLastRow
'Send Cell
outputWs.Range("A" & x).Value = Application.WorksheetFunction.Index(IndexRng, _
Application.WorksheetFunction.Match(outputWs.Range("C" & x).Value, MatchRng, 0))
'Return Cell
Next x
End Sub
I am aware that the above code is incomplete or may not be the method to do what I am trying to do. I am providing it as a boiler plate, as it will match ID numbers and output a value in other parts of my workbook. the above code may still need adjustment to work with the info I have provided. I know I need to add another argument but I am not sure how.