title: Creating a list of top 5 occuring UNIQUE values (text) between 2 date ranges
body: <p>I am hoping someone can help me. I am aiming to create a list of unique values (in this case email addresses) that occur the most in a column between 2 date ranges. I have 1 sheet with data (sheet 1) and another where I am creating this list (sheet 2).</p>
  <p>So far I have managed to do this by adding a new column in sheet 1 with =IF(D2=&quot;&quot;,&quot;&quot;,COUNTIF(D:D,D2)) to the data.</p>
  <p>Then using the below to list all unique values + count (sheet2)
  =SORT(UNIQUE({'1st line appeals data'!B:B,'1st line appeals data'!D:D}))</p>
  <p>Then using  the below to select the top 5 occuring text + count (sheet 2)
  =QUERY(AF:AG,&quot;Select AF, AG where AF&lt;&gt;'' Order by AG Desc limit 5&quot;)</p>
  <p>This works perfectly but what I want to do now is to add a between and to date value to the top 5.
  In sheet 2, A5 I have date from value and sheet 2,A6 I have date to.</p>
  <p>The numbers represented in A5,A6 are week numbers. I am hoping to reference them to the week numbers listed in sheet 2 something like - '1st line appeals data'!$A:$A,&quot;&gt;=&quot;&amp;$A$5,'1st line appeals data'!$A:$A,&quot;&lt;=&quot;&amp;$A$6</p>
  <p>Demo sheet here - <a href="https://docs.google.com/spreadsheets/d/1zMJ17LM7iA9a18WGbJ2IIuQAU_aS49cyn2K2X1bp6ts/edit#gid=0" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1zMJ17LM7iA9a18WGbJ2IIuQAU_aS49cyn2K2X1bp6ts/edit#gid=0</a></p>
  <p>Any help would be hugely appreciated
  Thanks</p>