Forum Discussion
INDEX and MATCH Function help
I am trying to use the functions above as opposed to Vlookup to place the new salaries for the staff from sheet 2 to sheet 1.
The new salaries are in Sheet 2 and are sorted by Staff ID.
I want these salaries to reflect in Sheet 1 but located in Column J thereby replacing the old salary figures there.
I have tried this with my actual data set and have got error messages ranging from #Ref to N/A.
I have tried to make sure I have the same data in both sheets as i discovered that if there is a name on one sheet that is not on the other it throws off the formula.
Also i thought that with this function, i did not have to worry about sorting my data but that appears not to be the case.
Here is the formula I used for my actual data set
INDEX(Sheet1!$E$2:$E$245,MATCH(Sheet1!A51,'3WORKINPROGRESS'!$D$2:$D$245,0))
Sheet1E2:E245 is where the new salary values are
Sheet1 Column A is where the Staff ID is (both are on the same sheet)
D2:D245 is where the staff ID with the old salaries are located (different sheet to the above)
I am sorry this is long, but i hope someone can understand what i am saying and use the sample sheets attached to lay out the correct structure and show me where I am going wrong.
- Haytham AmairahSilver Contributor
Hi Joy,
I've updated the workbook you attached with the solution.
You can use either VLOOKUP or INDEX & MATCH as follows:
=VLOOKUP(D2,'Sheet 2'!$A$2:$D$7,4,0)
=INDEX('Sheet 2'!$D$2:$D$7,MATCH(D2,'Sheet 2'!$A$2:$A$7,0))
Hope that helps
- Joy AmobiCopper Contributor
Thanks a lot Haytham. It worked.