Jeremy-M
asked on
VLOOKUP does not work.
I have an Excel workbook of employees. One table has them ranked by seniority. The seniority table is not alphabetically ordered by name. I have tables for each department with a seniority column; however, I have been unable to create a formula that will search the employee worksheet and return the seniority rank, a number, of the employee. VLOOKUP requires that the lookup table or array be ordered alphabetically. Any suggestions:
Employee Table Shipping Department
Name Seniority Name Seniority
John Jones 1 Chris Smith
Mary Brown 2 Al Ryan
Walt Baker 3
Al Ryan 4
Chris Smith 5
Employee Table Shipping Department
Name Seniority Name Seniority
John Jones 1 Chris Smith
Mary Brown 2 Al Ryan
Walt Baker 3
Al Ryan 4
Chris Smith 5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use a vlookup with the last argument 0
like
=Vlookup(C2,$A$1:$B$100,2, 0)
like
=Vlookup(C2,$A$1:$B$100,2,
To expand on the above two comments, VLOOKUP does NOT require the data to be sorted when using FALSE or 0 for the last parameter. The FALSE or 0 tell the formula to find an exact match regardless of sort order.
If this parameter is omitted, the data does have to be sorted in order for the CLOSEST match to be found. If the data is not in order the VLOOKUP will find the first match that is close to but not larger than the search value. So for example, the data below is not fully sorted:
55
76
96
77
43
Doing a vlookup for value 78 would return a match at the row with 76 whereas if the data was sorted it would return the result from finding the 77. Searching for 44 would give an error because the first result is already larger whereas sorted would give 43.
Thanks
Rob H
If this parameter is omitted, the data does have to be sorted in order for the CLOSEST match to be found. If the data is not in order the VLOOKUP will find the first match that is close to but not larger than the search value. So for example, the data below is not fully sorted:
55
76
96
77
43
Doing a vlookup for value 78 would return a match at the row with 76 whereas if the data was sorted it would return the result from finding the 77. Searching for 44 would give an error because the first result is already larger whereas sorted would give 43.
Thanks
Rob H
ASKER
The two answers I accepted worked.I learned a use of VLOOKUP that I was not aware would work and I learned more about using INDEX-MATCH I have awarded both of you an A for excellent and clear answers.
You can actually use V-Lookup in your example by using a similar formula below:
=VLOOKUP(A2,'Employee Table'!$A$2:$B$6,2,FALSE)
Sincerely,
Ed
VlookUp.xlsx