title: VBA to count distinct dates based on condition
body: <p>I am currently using this formula to calculate the unique number of dates for each user in column R</p>
  
  <pre><code>=SUM(IF(Q1=$J$2:$J$39115, 1/(COUNTIFS($J$2:$J$39115, Q1, $H$2:$H$39115, $H$2:$H$39115)), 0))
  </code></pre>
  
  <p>This formula works, but takes forever to calculate due to the large number of rows it has to work through.  I am sure there must be a quicker way using a macro or a vba.</p>
  
  <p>Column J contains the list of users (users appears multiple times) and column H contains the dates.</p>
  
  <p>I need to calculate the number of days worked by each user in column Q.(column Q contains the unique list of users . </p>