Vlookup date range and result based on criteria

rahmit

New Member
Joined
Jul 23, 2018
Messages
1
Dear friends,

I required your help for the below excel query:

The following is the data set sample:

[TABLE="width: 210"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Class. Date[/TD]
[TD] Reg.No [/TD]
[TD="align: right"]Course[/TD]
[/TR]
[TR]
[TD="align: right"]12/05/2017[/TD]
[TD="align: right"] 123456[/TD]
[TD="align: right"] ?[/TD]
[/TR]
[TR]
[TD="align: right"]19/05/2017[/TD]
[TD="align: right"]123456[/TD]
[TD="align: right"]?[/TD]
[/TR]
[TR]
[TD="align: right"]30/05/2017[/TD]
[TD="align: right"]123456[/TD]
[TD="align: right"]?[/TD]
[/TR]
[TR]
[TD="align: right"]02/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]?[/TD]
[/TR]
[TR]
[TD="align: right"]09/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]?[/TD]
[/TR]
[TR]
[TD="align: right"]16/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]?[/TD]
[/TR]
[TR]
[TD="align: right"]23/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]?[/TD]
[/TR]
</tbody>[/TABLE]

I require the course name based if two criteria are met:
a) Reg no
b) Data range is within category from the below data set:


Reg no From To Course
123456 1/05/2017 26/05/2017 Maths
123456 27/05/2017 31/05/2017 Geography
901999 1/05/2017 15/06/2017 Science
901999 16/06/2017 30/06/2017 History

Based on the below, the final data set with course name should be as follows:

[TABLE="width: 210"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Class. Date[/TD]
[TD] Reg.No [/TD]
[TD="align: right"]Course[/TD]
[/TR]
[TR]
[TD="align: right"]12/05/2017[/TD]
[TD="align: right"] 123456[/TD]
[TD="align: right"]Maths [/TD]
[/TR]
[TR]
[TD="align: right"]19/05/2017[/TD]
[TD="align: right"]123456[/TD]
[TD="align: right"]Maths[/TD]
[/TR]
[TR]
[TD="align: right"]30/05/2017[/TD]
[TD="align: right"]123456[/TD]
[TD="align: right"] Geography[/TD]
[/TR]
[TR]
[TD="align: right"]02/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]Science[/TD]
[/TR]
[TR]
[TD="align: right"]09/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]Science[/TD]
[/TR]
[TR]
[TD="align: right"]16/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]History[/TD]
[/TR]
[TR]
[TD="align: right"]23/06/2017[/TD]
[TD="align: right"]901999[/TD]
[TD="align: right"]History

[/TD]
[/TR]
</tbody>[/TABLE]

Hope its clear. Thanks
Rahmit
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Book1
ABCD
1Reg noFromToCourse
21234562017-05-012017-05-26Maths
31234562017-05-272017-05-31Geography
49019992017-05-012017-06-15Science
59019992017-06-162017-06-30History
Sheet1



Book1
ABC
1Class. DateReg.NoCourse
22017-05-12123456Maths
32017-05-19123456Maths
42017-05-30123456Geography
52017-06-02901999Science
62017-06-09901999Science
72017-06-16901999History
82017-06-23901999History
Sheet2


In C2 of Sheet2 control+shift+enter, not just enter, and copy down:

=INDEX(Sheet1!$D$2:$D$5,MATCH(B2,IF(A2>=Sheet1!$B$2:$B$5,IF(A2<=Sheet1!$C$2:$C$5,Sheet1!$A$2:$A$5)),0))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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