title: VBA Match Against a Column With Duplicate Values
body: <p>I have an excel range I'm using as a database.  The first column is sorted in ascending order by date, but there can be multiple records with the same date, e.g.</p>
  
  <pre><code>       A          B
  1 15-Apr-2015   Carrot
  2 15-Apr-2015   Yamagobo
  3 16-Apr-2015   Turnip
  4 17-Apr-2015   Parsnip
  5 17-Apr-2015   Rutabaga
  6 17-Apr-2015   Radish
  7 18-Apr-2015   Daikon
  </code></pre>
  
  <p>(The stuff in column A are formatted dates, not text strings.)</p>
  
  <p>What I'd like to get is the first record that has a date greater than or equal to the one I'm searching for, so I have:</p>
  
  <pre><code>Dim searchDate As Date
  searchDate = CDate("4/17/15")
  Dim searchRange As Range
  Set dbRange = Worksheets("My DB").UsedRange
  Dim v As Variant
  v = Application.Match(CLng(searchDate), dbRange.columns(1), 1)
  </code></pre>
  
  <p>I expect v to now contain the index of the first row with 17-Apr-2015 in column A, 4.  Instead, it seems to be returning the <em>last</em> row with 17-Apr-2015, 6.</p>
  
  <p>Two questions:</p>
  
  <p>1) Is there a way to use Match() (or any other function) to point at the first entry that matches, instead of the last?</p>
  
  <p>2) Match() freaks out if I give it a Date type as its match parameter (hence the CLng() conversion).  Is this to be expected, or am I doing something stupid?</p>
  
  <p>Thanks.</p>