title: How to extract all unique values from a column based on multiple criterion in Excel
body: <p>I am trying to get a list of all the distinct values from a column based on a vlookup type match.</p>
  
  <p>For example: </p>
  
  <p>Sheet 1:</p>
  
  <pre><code>      (colA)         (colB)   (colC)
  Health System Name    EMR     PMR 
  
  System A       
  System B
  System C
  System D
  </code></pre>
  
  <p>Sheet 2 (where all the data is)</p>
  
  <pre><code>Healthy System Name        Tech ID      Vendor
  
  System A                 PMR         ClinicA
  System A                 EMR         ClinicE
  System A                 EMR         ClinicA
  System B                 EMR         ClinicB
  System B                 PMR         ClinicC
  System C                 PMR         ClinicA
  System C                 PMR         ClinicB  
  System C                 EMR         ClinicD
  System C                 PMR         ClinicD
  System C                 EMR         ClinicG
  </code></pre>
  
  <p>I want to be able to search the name of the healthy system from colA in sheet 1 in colA of Sheet 2...and based on whether it is a PMR or EMR...return the number of unique values from the Vendor column into one cell in sheet 1 under the appropriate column. </p>
  
  <p>SO under the EMR column in Sheet 1 for System A, I want the distinct values from the vendor column in sheet 2 that have the tech ID as "EMR"for System A.</p>
  
  <p>In this case it would be : ClinicA, ClinicE</p>
  
  <p>Any help would be greatly appreciated!</p>