title: Counting unique values in Range which is Index by another Value
body: <p>I have a list of urgency types which are sorted by building name and Community. Every building name has 5 urgency types and each community has a varying number of buildings in it. I am trying to return a count of how many buildings are associated to each community.</p>
  
  <p>I have tried this formula</p>
  
  <pre><code>=SUMPRODUCT(1/COUNTIF(BuildingCostsTbl[Building Name - Click to go to Sheet],BuildingCostsTbl[Building Name - Click to go to Sheet]&amp;""))
  </code></pre>
  
  <p>but it only returns the total number of buildings in the table and does not count by community. I have also tried using the MATCH function within this to narrow the range criteria for the COUNTIF function but i keep getting errors I do not understand.</p>
  
  <p>Here is an snapshot from my excel worksheet of what I am looking to do.</p>
  
  <p>Excel Snapshot </p>
  
  <p><a href="https://i.stack.imgur.com/HyZ0c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HyZ0c.png" alt="enter image description here"></a></p>
  
  <p>The MATCH formula I was trying to use to narrow the COUNTIF lookup range is</p>
  
  <pre><code>=MATCH(H9,BuildingCostsTbl[Community])
  </code></pre>