Dear all,
I'm facing an issue in implementing Index and Match using VBA.
PFA for 2 files:
Index and Match.xlsx -> Successfully implemented Index and Match using Formula.
Index and Match.xlsm-> To implement Index and Match using VBA
Input sheet: Mapping
Output sheet: To Map
In " Mapping " sheet, Columns A through D has ID, Name, Age and Year.
In " To Map" sheet, Columns A and B has ID and Year respectively.
I need to map the correct Age for the give ID and Year using VBA.
= Input =
ID Name Age Year
1 A 12 2012
1 A 13 2013
2 B 12 2012
2 B 13 2013
= Expected Output =
ID Year Age
1 2012 12
2 2013 13
Formula is at Cell C2.
Request you to debug Mapping() in Index and Match.xlsm
Code causing error:
ActiveCell.FormulaR1C1 = "=INDEX(Mapping!R2C3:R"" & lastrow_Age ""C3, MATCH(RC[-2]&RC[-1],INDEX(Mapping!R2C1:R"" & lastrow_Age & ""C1 & Mapping!R2C4:R"" & lastrow_Age & ""C4,0),0))"
Request you to help me correct/implement the same using VBA.
P.S: Data is always of dynamic range.
Thanks,
Vinod Krishna
Bookmarks