title: Rank subgroup within dynamic range
body: <p>I've got a ROI comparison table like this:</p>
  
  <pre><code>Month | ROI | 1  | 2  | 3  |
  Jul   | A   | 1% | 
  Jul   | B   | 3% |
  Jul   | C   | 2% |
  Jun   | A   | 4% | 6% |
  Jun   | B   | 5% | 7% |
  Jun   | C   | 6% | 8% |
  May   | A   | 2% | 4% | 7% |
  May   | C   | 3% | 5% | 6% |
  </code></pre>
  
  <p>I would like to rank each product's ROI (A, B and C) each month - so only rank the most right percentage for a given month.</p>
  
  <p>But the range need to be dynamic as each product may have a different launch date. For example, the month of May doesn't have product B.</p>
  
  <p>So the output will be:</p>
  
  <pre><code>   Month  | ROI | 1  | 2  | 3  | Rank
      Jul   | A   | 1% |    |    | 3
      Jul   | B   | 3% |    |    | 1
      Jul   | C   | 2% |    |    | 2
      Jun   | A   | 4% | 6% |    | 3
      Jun   | B   | 5% | 7% |    | 2
      Jun   | C   | 6% | 8% |    | 1
      May   | A   | 2% | 4% | 7% | 1
      May   | C   | 3% | 5% | 6% | 2
  </code></pre>
  
  <p>I'm thinking of using the Index/Match function:</p>
  
  <pre><code>=RANK(INDEX(G3:S3,MATCH(9^99,G3:S3,1)),G3:G5,0)
  </code></pre>
  
  <p>But I'm not sure how to make the G3:G5 dynamic.</p>