In this article, you will learn how to use INDEX & MATCH function in VBA to match 2 criteria’s in excel using VBA code.
To get the output we will use combination of OFFSET & COUNTA functions to create Name Manager list.
Let us understand with an example:
We need to follow the below steps to launch VB editor
This will create new module.
Enter the following code in the Module
myName = [F2]
mySubject = [G2]
mark = Application.WorksheetFunction.Index([StMark], _
Application.WorksheetFunction.Match(myName, ([StName]), 0) + _
Application.WorksheetFunction.Match(mySubject, [StSubject], 0) - 1)
[H2] = mark
End Sub
This is how we can get results using Index Match worksheet function in VBA.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
Have this excel file, please share
The only one that worked. Thanks!
Thanks Darrin
What if the name was a column A2:A20 and the subject was row B1:H1 and the MARK are the area B2:H20
can I have an excel sheet copy of that please ?
Are we adding 2 rows given by 2 match functions - 1,
here each match function gives independent Row number,
resultant row number may change as per data position? may not give same result
I love learn vba
I would also like a copy of the sheet to review. Thank you very much
Can I ask for a copy of the excel file for this?
I would also like a copy of the excel sheet for review please. Thx. Dane