title: Excel - Counting Distinct Dates within a Date Range With One Critieria
body: <p>I'm trying to create a formula that counts the number of unique dates within a date range based on the type of item.</p>
  <p>I've tried several different formulas and researched ways to do it, but each formula was so specific to the poster's specific problem, that it did not work so I decided to post mine for your help.</p>
  <p>This formula counts duplicated days when I only want distinct days counted between two dates:</p>
  <blockquote>
  <p>=COUNTIFS(Sheet1!$D:$D,&quot;&gt;=&quot;&amp;$A$2,Sheet1!$D:$D,&quot;&lt;=&quot;&amp;$B$2,Sheet1!$B:$B,A8)</p>
  </blockquote>
  <p>The full dataset is on Sheet1 (for simplicity, I've only illustrated 16 rows, but it has potential to be within the thousands):</p>
  <p><a href="https://i.stack.imgur.com/NLLUm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NLLUm.jpg" alt="sheet2" /></a></p>
  <p>The calculations are on Sheet 2:</p>
  <p><a href="https://i.stack.imgur.com/7XHuC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7XHuC.jpg" alt="enter image description here" /></a></p>
  <p>In short, using the data on Sheet1, I want to know how many unique dates occurred between, say, 6/1/2020 and 6/8/2020 with the criteria being a banana. These items will change in the future so I'd like the date and items to be referenced cells.</p>