title: Specifying search direction in Excel VLOOKUP() function
body: <p>There are many great answers on Stack Overflow describing how to use Excel's <code>VLOOKUP()</code> function.  A few that I researched prior to asking this question are here:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/18808932/using-vlookup">Using VLOOKUP()</a></li>
  <li><a href="https://stackoverflow.com/questions/16023472/excel-vlookup-function">Excel Vlookup Function</a></li>
  <li><a href="https://stackoverflow.com/questions/37649611/using-lookup-vlookup-formula">using lookup , vlookup formula</a></li>
  </ul>
  
  <p>It looks like <code>VLOOKUP()</code>, by default, returns the first matching entry in a table (i.e. "top-first" search).  I have a need to instead return the <em>last</em> entry in a table (i.e. "bottom-first" search) -- <strong><em>is there a way to specify search direction using the <code>VLOOKUP()</code> function or, barring that, an alternative function that works like <code>VLOOKUP()</code> but allows one to specify search direction?</em></strong></p>
  
  <p>EDIT:
  Here is a sample of my data.  I have network traffic where I am trying to calculate timestamp differences between packets with the same identifiers.</p>
  
  <pre><code>Packet ID  Timestamp (ms)
  A          0.0
  B          1.0
  C          2.0
  C          3.0
  A          4.0
  B          5.0
  .          .
  .          .
  .          .
  </code></pre>
  
  <p>and I need to calculate the timestamp differences similar to below</p>
  
  <pre><code>Packet ID  Timestamp (ms) Timestamp Difference (ms, packet ID basis)
  A          0.0            0.0
  B          1.0            0.0
  C          2.0            0.0
  C          3.0            1.0 (i.e. "3.0 - 2.0")
  A          4.0            4.0 (i.e. "4.0 - 0.0")
  B          5.0            4.0 (i.e. "5.0 - 1.0")
  C          6.0            3.0 (i.e. "6.0 - 3.0")
  .          .              .
  .          .              .
  .          .              .
  </code></pre>
  
  <p>To accomplish this, I am trying to create a <code>VLOOKUP()</code> on <code>Packet ID</code> to find the timestamp of the directly previous packet with that same ID.</p>