title: Application.Match formula Error
body: <p>I have developed the code below using the <code>Application.Match</code> function.</p>
  
  <p>The statement that I wish to execute when I get an error in my first <code>Application.Match</code> (tested for by using <code>IsError(x)</code>) does not appear to be executed.</p>
  
  <p>My intention is that, if the first <code>Application.Match</code> returns an error, I would like my code to perform the same match but with the search item being a date which is one day earlier than the original match.</p>
  
  <p>My code:</p>
  
  <pre><code>Sub macro1()
  
      i = 8
      Dim xx As Date
  
      For a = 1 To 3
          x = Application.Match(Sheets("Dump"). _
                  Cells(1, i), Sheets("sheet2").Range("A1:C1"), 0)
  
          Set aa = Sheets("Dump").Cells(1, i)
          xx = aa - 1
          If IsError(x) Then x = Application.Match(xx, Sheets("sheet2").Range("A1:C1"), 0)    
          Sheets("Dump").Cells(2, i) = x
  
          i = i + 1
      Next
  
  End Sub
  </code></pre>
  
  <p>Sheet "Dump":</p>
  
  <p><img src="https://i.stack.imgur.com/vdeEb.png" alt=""></p>
  
  <p>Sheet "Sheet2":</p>
  
  <p><img src="https://i.stack.imgur.com/tLCrI.png" alt=""></p>