title: Google sheets queries with IF statments
body: <p>I am trying to write this query for a while and have tried a few sites but not explain really how to use the IF statement.</p>
  <p>So I have data in columns that are people scores for films</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th></th>
  <th>Jim</th>
  <th>Jack</th>
  <th>Fred</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Film 1</td>
  <td>6</td>
  <td>6</td>
  <td>2</td>
  </tr>
  <tr>
  <td>Film 2</td>
  <td>7</td>
  <td>8</td>
  <td>5</td>
  </tr>
  <tr>
  <td>Film 3</td>
  <td>3</td>
  <td>5</td>
  <td>8</td>
  </tr>
  <tr>
  <td>...</td>
  <td></td>
  <td></td>
  <td></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>for example and i want a query that when i select a cell with a name in it it will return the scores for that person (make top ten and scores by film genera / person etc.)</p>
  <p>So I have this query I know the syntax is not correct I have tried many ways and cant get it to work. (E18 is the cell I with a pick list of the names)</p>
  <pre><code>=Query(Sheet1!A4:D,&quot;select A &amp; IF(E18=”Jim”, select B order by B desc Limit 10&quot;&quot;)&quot;)
  </code></pre>
  <p>What I want to do is when I select a name then it returns the top 10 films for that user + the scores</p>
  <p>Any help greatly received.</p>
  <p>Thankyou</p>
  <p>aaron</p>