Discussion Locked

Need excel macro to feed data from on sp

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need an Excel macro that when a user inputs an employee number on the first spreadsheet it will reference a second spreadsheet, lookup the employee number, get the employee name and copy it to the correct field on the first spreadsheet.

2 replies

by dklippert

You don't need a macro. Use the VLOOKUP function.
Set up the table on one sheet. (EmpID, Name, Address) Select the table and name the Range (i.e. EmpAdd).
Go back to the entry spreadsheet.
Select the results cell and enter this formula =VLOOKUP(A1,EmpAdd,2,False).
This looks at the value in cell A1 and then compares it to the values listed in the table EmpAdd. The result of the formula returns the value in the second column. The final argument, False, says to use an exact match.
Be sure to have the first column of the table sorted in ascending order.

This discussion is closed to new replies.