B
Brad Autry
Greetings. My scenario is as follows:
I have a look-up table with four fields:
position code, begin date, end date, and job code.
The job codes assigned to a position can change over time, but don't
necessarily. For example:
position begin date end date job code
1234 1/1/2009 4/1/2009 5678
1234 4/2/2009 12/31/9999 9012
4673 1/1/1900 12/31/9999 4736
On another table I have a list of people, a corresponding position code,
along with a date.
I need to assign the job code based on whether the date falls into the range
of begin and end date on the lookup table.
I tried the following with mixed results:
=IF(AND(VLOOKUP(I2,joblookup,2,0)<=G2,VLOOKUP(I2,joblookup,3,0)>=G2),VLOOKUP(I2,joblookup,4,0),"f'd up")
where: I2 is the position code on the table with employees
joblookup is a named range for the entire position/beg date/end date/job
code table (column 2 is the begin date, 3 end date, 4 job code)
G2 is the date associated with the employee
I receive accurate results in about 75% of the cells. The other 25% I'm
getting "F'd up" as a result and I can't determine the common factor amongst
these cells to figure out why. I'm assuming there's a problem because there
are multiple rows on the lookup table with the same position code and perhaps
vlookup requires unique values in the column. I'm not certain what else to
try, though.
Thank you for wading through this lengthy post.
Any ideas or suggestions would be greatly appreciated.
Regards,
Brad
I have a look-up table with four fields:
position code, begin date, end date, and job code.
The job codes assigned to a position can change over time, but don't
necessarily. For example:
position begin date end date job code
1234 1/1/2009 4/1/2009 5678
1234 4/2/2009 12/31/9999 9012
4673 1/1/1900 12/31/9999 4736
On another table I have a list of people, a corresponding position code,
along with a date.
I need to assign the job code based on whether the date falls into the range
of begin and end date on the lookup table.
I tried the following with mixed results:
=IF(AND(VLOOKUP(I2,joblookup,2,0)<=G2,VLOOKUP(I2,joblookup,3,0)>=G2),VLOOKUP(I2,joblookup,4,0),"f'd up")
where: I2 is the position code on the table with employees
joblookup is a named range for the entire position/beg date/end date/job
code table (column 2 is the begin date, 3 end date, 4 job code)
G2 is the date associated with the employee
I receive accurate results in about 75% of the cells. The other 25% I'm
getting "F'd up" as a result and I can't determine the common factor amongst
these cells to figure out why. I'm assuming there's a problem because there
are multiple rows on the lookup table with the same position code and perhaps
vlookup requires unique values in the column. I'm not certain what else to
try, though.
Thank you for wading through this lengthy post.
Any ideas or suggestions would be greatly appreciated.
Regards,
Brad