Formula Date Lookup with a Vlookup

brandy5122000

New Member
Joined
Feb 25, 2014
Messages
2
I have an issues with trying to pull the correct data. My scenario is I have an employee number with a worked date next to it (tab 1). I also have a tab (tab 2) that shows by employee number when an employee was active. The issues I am having is on this tab his active status could be multiple lines (due to being active on and off). I am looking for a way to retrieve the status (from tab 2) if the dates fall in that range and insert them on tab 2 (like a vlookup). Any help would be appreciated.

Tab 1
EMP_NUM DATE
11315-Apr-13
11316-Apr-13
1134-Oct-13
1135-Oct-13
1136-Oct-13
11311-Dec-13
11312-Dec-13
11313-Dec-13
12021-Jan-13
12022-Jan-13
1403-Sep-13
1404-Sep-13
1405-Sep-13
1406-Sep-13
14023-Dec-13
2087-Jan-13
2088-Jan-13
2084-May-13
2085-May-13
20812-Dec-13
20819-Dec-13

<colgroup><col><col></colgroup><tbody>
</tbody>


Tab 2

EMP NumStatusStart DateEnd Date
113Overseas09/28/201311/01/2013
208Overseas04/06/201309/06/2013
588Overseas11/10/201204/26/2013
120US1/1/20134/1/2013
120Overseas9/15/201312/31/2013
140Home2/5/20134/6/2013
140US7/25/201310/30/2013
140Overseas11/15/20132/7/2014

<colgroup><col span="2"><col span="2"></colgroup><tbody>
</tbody>

<colgroup><col span="2"><col span="2"></colgroup><tbody>
</tbody>
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Not the prettiest of formulas, but this seems to work:

Code:
=IFERROR(INDEX(Sheet2!$B$1:$B$1000,IF(SUMPRODUCT(--(Sheet2!$A$1:$A$1000=A2),--(Sheet2!$C$1:$C$1000<=B2),--(Sheet2!$D$1:$D$1000>B2),ROW(Sheet2!$A$1:$A$1000))=0,"-",SUMPRODUCT(--(Sheet2!$A$1:$A$1000=A2),--(Sheet2!$C$1:$C$1000<=B2),--(Sheet2!$D$1:$D$1000>B2),ROW(Sheet2!$A$1:$A$1000))),1),"-")

It assumes there's no overlap in dates for the same EMP_Num.
 
Upvote 0

Forum statistics

Threads
1,221,469
Messages
6,160,028
Members
451,611
Latest member
PattiButche

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top