title: Return last instance of value from column when two criteria met in row
body: <p>I'm having trouble getting an Excel formula that returns the last instance of a value in a column when two criteria are met in the adjacent row.</p>
  
  <p>In the dummy example, I have a diary of what activities I have performed with which pets when. See image below.</p>
  
  <p><a href="https://i.stack.imgur.com/UtaRt.png" rel="nofollow noreferrer">Workbook screen shot</a></p>
  
  <p>I'd like a formula that tells me when I last performed a particular activity with a particular pet.</p>
  
  <p>For example, when did I last massage my frog? Or when did I last brush my cat?</p>
  
  <p>Using <code>=INDEX(B:B,SUMPRODUCT(MAX((Pet=A2)*ROW(Pet))))</code> in B2 or <code>=LOOKUP(2,1/(Pet=A3),B8:B13)</code> B3 I can get Excel to tell me when I last did <em>an</em> activity with a particular pet.</p>
  
  <p>But I'd like to know when I last did a <em>particular</em> activity with a particular pet.</p>
  
  <p>Any help much appreciated.</p>