title: Index/Match multiple columns in Excel
body: <p>I have 2 sheets. Sheet 1 is set up similarly to:</p>
  
  <pre><code>Keyword  Domain  Rank
    A        Z      1
    B        Z      2
    C        Z      3
    D        Y      10
    E        Y      15
    B        Y      20
  </code></pre>
  
  <p>And sheet 2 is set up like:</p>
  
  <pre><code>Keyword  (Domain Z)  (Domain Y)
    A           1          -
    B           2          20
    C           3          -
    D           -          10
  </code></pre>
  
  <p>I'm trying to have a formula that will compare the keywords in Sheet 2 with those in Sheet 1 and then return the rank that corresponds to the correct domain (that's specified in Sheet 2 for that column). I can't get any formula I use to evaluate. I've used 2 formulas so far:</p>
  
  <pre><code>=INDEX(Raw!$H$11:$H$322, MATCH(A3,IF(Raw!$D$11:$D$322=All!$B$2,Raw!$B$11:$B$322),0))
  </code></pre>
  
  <p>The above formula works, to a point. The problem is that it simple pulls the domain for the first instance of the keyword found, which doesn't always match the domain in the column of sheet 2. The second formula I've tried:</p>
  
  <pre><code>=INDEX(Raw!$H$11:$H$322, MATCH(B3,MATCH($C$2,Raw!$D$11:$D$322,0)))
  </code></pre>