title: Get closest date based on matching mutiple criteria in Excel
body: <p>I have two tabs as below in Excel:</p>
  
  <p>Table 1:</p>
  
  <pre><code>    Date      Vehicle Number      Planned Leave Time    Actual Leave Time
    8/7/2017        10001            8/7/17 4:59 AM   
  </code></pre>
  
  <p>Table 2:</p>
  
  <pre><code>  Date   Vehicle Number   Actual Leave Time
  8/7/2017    10001          8/7/17 4:29 AM
  8/7/2017    10001          8/7/17 5:59 AM
  8/7/2017    10001          8/6/17 3:05 PM
  8/7/2017    10003          8/6/17 2:05 PM
  </code></pre>
  
  <p>I want to get the actual leave time from table 2 based on matching the same date, same vehicle number between table 1 and table 2;</p>
  
  <p>Also, as you can see, there are multiple records for a same vehicle and same date in table 2, so I think I have to compare the time (8/7/17 4:59 AM) to all the time in table 2 that on 8/7/2017 and for vehicle 10001, to get the closest time, which has the minimum abs difference between my planned time and active time. </p>
  
  <p>So can anyone please tell me what formula I should use in Excel in order to achieve my purpose?</p>
  
  <p>Thanks so much
  Pudge</p>