Merge two data sets based on time window

shansakhi

Active Member
Joined
Apr 5, 2008
Messages
276
Office Version
  1. 365
Platform
  1. Windows
Hello All,
I have two data sets - Data Set 1 and Data Set 2.
I want to take Bus No from Data set 1 and incorporate in Data Set 2 using below criteria.

1. Dep Date
2. Dept Sta
3. Arvl Sta
4. Need to see if Dept Time in Data Set 1 is coming between DepartureTimeWindow in Data Set 2.

Attached is the Screenshot with Data Set 1, Data Set 2 and Output.

Capture.PNG


Regards,
Shan
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
We need a sample worksheet to test.
try to attach mini sheet via XL2BB
 
Upvote 0
Sorry, but I do not have authority to down load add in.
I tried searching XL2BB add in in add in list but it is not available.
Is there another way to upload excel file.
 
Upvote 0
I am able to get the Xl2bb.
Please find below the link. Let me know if I am able to provide the link properly.

Book1
ABCDE
1Date Set 1
2Dep DateBus NoDept StaArvl StaDept Time
328-Nov-2210222MANZRH14:20
45-Dec-2210232DELBOM1:10
515-Dec-2210023LHRMAN19:05
6
7Date Set 2
8Dept StaArvl StaDEPARTURE TIME WINDOWDep Date
9MANZRH1201-150020221128
10MANZRH1501-230020221128
11DELBOM0000-180020221205
12DELBOM1801-230020221205
13LHRMAN1200-200020221215
14LHRMAN1200-200020221217
15
16Output
17Dept StaArvl StaDEPARTURE TIME WINDOWDep DateBus No
18MANZRH1201-15002022112810222
19MANZRH1501-2300202211280
20DELBOM0000-18002022120510232
21DELBOM1801-2300202212050
22LHRMAN1200-20002022121510023
23LHRMAN1200-2000202212170
Sheet1
 
Upvote 0
Is it?

Book1
ABCDE
1Date Set 1
2Dep DateBus NoDept StaArvl StaDept Time
328/11/202210222MANZRH14:20:00
405/12/202210232DELBOM01:10:00
515/12/202210023LHRMAN19:05:00
6
7Date Set 2
8Dept StaArvl StaDEPARTURE TIME WINDOWDep Date
9MANZRH1201-150020221128
10MANZRH1501-230020221128
11DELBOM0000-180020221205
12DELBOM1801-230020221205
13LHRMAN1200-200020221215
14LHRMAN1200-200020221217
15
16Output
17Dept StaArvl StaDEPARTURE TIME WINDOWDep DateBus No
18MANZRH1201-15002022112810222
19MANZRH1501-230020221128 
20DELBOM0000-18002022120510232
21DELBOM1801-230020221205 
22LHRMAN1200-20002022121510023
23LHRMAN1200-20002022121710023
Sheet1
Cell Formulas
RangeFormula
E18:E23E18=IFERROR(LOOKUP(2,1/($C$3:$C$5=A18)/($D$3:$D$5=B18)/($A$3:$A$5-DATE(LEFT(D18,4)+0,MID(D18,5,2)+0,RIGHT(D18,2)=0))/($E$3:$E$5-(LEFT(C18,2) & ":" & MID(C18,3,2))>=0)/($E$3:$E$5-(MID(C18,6,2)&":"&RIGHT(C18,2))<=0),$B$3:$B$5),"")
 
Upvote 0

Forum statistics

Threads
1,216,096
Messages
6,128,807
Members
449,468
Latest member
AGreen17

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