Index/Match on multiple criteria and between date

snake

New Member
Joined
Jan 7, 2020
Messages
3
I've been searching all morning for a solution and although I think an Index Match is the answer I'm getting stuck with the formula and how best to apply it.

I have two tables one table is a job summary table that has a JobID with an employee name and a start/end date.

The second table is a list of jobs were an employee was, and I'm trying to have the Job ID added to that table.

The formula should return the jobID for where the Job date is between the start/end date and for that employee name.

For example for the first row in Table two, the JobID should be job9897 because jane worked on that project on Jan 1.

First is Index/Match the best option, and if so, how would I develop the formula?

Table 1
JobIDEmployeeNameStart DateEnd Date
job9897Jane
1-Jan-19​
21-Jan-19​
job4934Jane
31-Jan-19​
18-Feb-19​
job3813Mike
1-Mar-19​
1-Apr-19​
job7075Mike
12-Apr-19​
30-Apr-19​
job6153Josh
1-Jan-19​
19-Jan-19​
job4076Josh
1-Apr-19​
29-Apr-19​

Table 2
JobIDVessel NameJob Date
Jane
1-Jan-19​
Jane
3-Jan-19​
Jane
4-Jan-19​
Jane
5-Jan-19​
Jane
1-Feb-19​
Jane
4-Feb-19​
Jane
5-Feb-19​
Jane
6-Feb-19​
Jane
1-Mar-19​
Jane
2-Mar-19​
Mike
2-Mar-19​
Mike
3-Mar-19​
Mike
4-Mar-19​
Mike
5-Mar-19​
Mike
29-Apr-19​
Mike
30-Apr-19​
Mike
1-May-19​
Mike
2-May-19​
Josh
6-Jan-19​
Josh
7-Jan-19​
Josh
8-Jan-19​
Josh
9-Jan-19​
Josh
10-Jan-19​
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Make sure your dates are true dates and not text then try this in A11:

=LOOKUP(2,1/(($B$2:$B$7=B11)*($C$2:$C$7<=C11)*($D$2:$D$7>=C11)),$A$2:$A$7)

with your tables in A1:D7 and A10:C33.
 
Upvote 0
Hi & welcome to MrExcel.
How about
Book1
ABCDEFGHI
1JobIDEmployeeNameStart DateEnd DateJobIDVessel NameJob Date
2job9897Jane01/01/201921/01/2019job9897Jane01/01/2019
3job4934Jane31/01/201918/02/2019job9897Jane03/01/2019
4job3813Mike01/03/201901/04/2019job9897Jane04/01/2019
5job7075Mike12/04/201930/04/2019job9897Jane05/01/2019
6job6153Josh01/01/201919/01/2019job4934Jane01/02/2019
7job4076Josh01/04/201929/04/2019job4934Jane04/02/2019
8job4934Jane05/02/2019
9job4934Jane06/02/2019
10 Jane01/03/2019
11 Jane02/03/2019
12job3813Mike02/03/2019
13job3813Mike03/03/2019
14job3813Mike04/03/2019
15job3813Mike05/03/2019
16job7075Mike29/04/2019
17job7075Mike30/04/2019
18 Mike01/05/2019
19 Mike02/05/2019
20job6153Josh06/01/2019
21job6153Josh07/01/2019
22job6153Josh08/01/2019
23job6153Josh09/01/2019
24job6153Josh10/01/2019
List
Cell Formulas
RangeFormula
G2:G24G2=IFERROR(INDEX($A$2:$A$7,AGGREGATE(15,6,(ROW($A$2:$A$7)-ROW($A$2)+1)/(($B$2:$B$7=H2)*($C$2:$C$7<=I2)*($D$2:$D$7>=I2)),1)),"")
 
Upvote 0
Or as an index match this would work:

=INDEX($A$2:$A$7,MATCH(1,INDEX(($B$2:$B$7=B11)*($C$2:$C$7<=C11)*($D$2:$D$7>=C11),0),0))
 
Upvote 0
thank you all for your advice, all three options work perfectly - I tested all three on the full dataset and all three returned the right answer.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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