Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default IFs with VLOOKUPs

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,j oblookup,3,0)=G2),VLOOKUP(I2,joblookup,4,0),"f'd up")

whe 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 751
Default IFs with VLOOKUPs

Assuming joblookup in A2:D101.

=INDEX($D$2:$D$101,MATCH(1,($A$2:$A$101=I2)*($B$2: $B$101=G2)*($C$2:$C
$101<=G2),0))

This is an *array* formula (commit with Shift+Ctrl+Enter). It will
find the first job code in this position that falls between the two
dates.

HTH
Kostis Vezerides

On Aug 3, 4:44*pm, Brad Autry
wrote:
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,j oblookup,3,0)=G2),VLOOKU*P(I2,joblookup,4,0),"f'd up")

whe 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


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default IFs with VLOOKUPs

I'd wanted to follow up on the INDEX and MATCH method. I'm having trouble
getting it to work. I'm using the following formula:

=INDEX(Job,MATCH(1,(position=I2)*(begin=G2)*(end< =G2),0))

Whe

Job is named range for column D on the lookup table, containing the job code
information
position is named range for column A on the lookup table, containing
position codes
I2 is the lookup value, a position code
begin is a named range for column C on the lookup table, containing the
range begin date
end is the named range for range end date

It is, essentially, what was suggested yesterday, only with named ranges. I
am entering it as an array formula.

Any ideas why it is not working? Thank you ahead of time.

"vezerid" wrote:

Assuming joblookup in A2:D101.

=INDEX($D$2:$D$101,MATCH(1,($A$2:$A$101=I2)*($B$2: $B$101=G2)*($C$2:$C
$101<=G2),0))

This is an *array* formula (commit with Shift+Ctrl+Enter). It will
find the first job code in this position that falls between the two
dates.

HTH
Kostis Vezerides

On Aug 3, 4:44 pm, Brad Autry
wrote:
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,j oblookup,3,0)=G2),VLOOKUÂ*P(I2,joblookup,4,0),"f' d up")

whe 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



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default IFs with VLOOKUPs

Yes, where you have duplicate codes VLOOKUP will only find the first
one. The solution is to ensure that the position codes are not
duplicated, but how you achieve that will depend on your procedures.

Hope this helps.

Pete

On Aug 3, 4:44*pm, Brad Autry
wrote:
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,j oblookup,3,0)=G2),VLOOKU*P(I2,joblookup,4,0),"f'd up")

whe 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


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default IFs with VLOOKUPs

=SUMPRODUCT((position=I2)*(begin_date<=G2)*(end_da te=G2),job_code)


"Brad Autry" wrote:

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,j oblookup,3,0)=G2),VLOOKUP(I2,joblookup,4,0),"f'd up")

whe 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



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default IFs with VLOOKUPs

Thanks to everyone who offered advice/suggestions. I had some issues with
the array formula, so I spent the morning reviewing that INDEX & MATCH
procedure before something else came up I had to attend to. I tried the
SUMPRODUCT route when I got back to this project; that one worked like a
charm, although how or why I'm still quite uncertain.

Both good suggestions though and I thank you.

Regards,
Brad
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 VLookups Guitarbuyer Excel Worksheet Functions 1 August 4th 08 09:45 PM
Dependent vlookups - nested vlookups (maybe) Maniv Excel Worksheet Functions 1 April 22nd 08 07:40 PM
Vlookups Office Junior[_2_] Excel Discussion (Misc queries) 1 March 30th 08 08:08 PM
VLOOKUPS Brett Excel Worksheet Functions 5 June 22nd 06 02:50 PM
Vlookups Shaya M Excel Discussion (Misc queries) 3 May 27th 05 07:17 AM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"