title: how do you count using if and sumproduct
body: <p>I have a database of people who may or may not have multiple entries and I'd like to know how to count the total number of people who are male who meet another category using a formula.  I current use the </p>
  
  <pre><code>=SUMPRODUCT((MelanomaEth="U")/COUNTIF(MelMRN,MelMRN&amp;"")))
  </code></pre>
  
  <p>formula to count the number of unique entries with a "U" in the MelanomaEth column.  However, I'd like to go further and determine how many of these U's are males and females.</p>
  
  <p>I tried to use:</p>
  
  <pre><code>=IF(MelSex="M",SUMPRODUCT((MelanomaEth="U")/COUNTIF(MelMRN,MelMRN&amp;"")))
  </code></pre>
  
  <p>but it gives me the incorrect number.</p>
  
  <p>Here is an "dummy" sheet:</p>
  
  <pre><code>MRN  Date   Sex  Ethnicity
  A   8/1/2013    M   U
  B   8/2/2013    F   N
  C   8/2/2013    F   N
  A   9/2/2013    M   U
  A   9/3/2013    M   U
  C   8/31/2013   F   N
  B   8/15/2013   F   N
  D   10/5/2013   M   U
  </code></pre>
  
  <p>If I wanted to know the number of unique names who are M and U, I should get 2.  The number of names who are F and U should be 0, FN should be 2, and 0 MN.</p>
  
  <p>Any suggestions would be appreciated.</p>
  
  <p>Thanks!</p>