title: Last occurence of a cell in excel sheet based on 2 conditions
body: <pre><code>id    request   count
  
  23415   ABC      1    
  23415   XYZ      1    
  54167   ABC      1    
  33405   ABC      1    
  23415   XYZ      2    
  23415   XYZ      3    
  12346   ABC      1    
  23415   ABC      2
  </code></pre>
  
  <p>On each new entry I need to check if it is present previously along with the request type and update it according to its last occurrence. In the example above, if I try to add 1 more entry for 23415, then based upon the request type (<code>ABC</code> or <code>XYZ</code>), I need to update the count.</p>
  
  <p>I already know how to increase count with last occurrence of just 23415 with the formula <code>=IFERROR(IF(E2=VLOOKUP(E2,$E1:E$2,1,0),SUM(INDEX($G1:$G$2,SUMPRODUCT(MAX(ROW($E1:$E$2)*($E2=$E1:$E$2))-1)),1),1),1)</code>, where E is id, F is request, and G is count.</p>
  
  <p>However, I need to combine another condition with it for request type, i.e. last occurrence of 23415 if request is <code>ABC</code> then count should be 3 else if its <code>XYZ</code>, it should be 4. I'm not sure how to do that.</p>