title: Conditional median in MS Excel
body: <p>I'm trying to calculate the conditional median of a chart that looks like this:</p>
  
  <pre><code>A  |  B
  -------
  x  |  1
  x  |  1
  x  |  3
  x  |  
  y  |  4
  z  |  5
  </code></pre>
  
  <p>I'm using MS Excel 2007.  I am aware of the AVERAGEIF() statement, but there is no equivalent for Median.  The main trick is that there are rows with no data - such as the 4th "a" above.  In this case, I don't want this row considered at all in the calculations.</p>
  
  <p>Googling has suggested the following, but Excel won't accept the formula format (maybe because it's 2007?)</p>
  
  <pre><code>=MEDIAN(IF((A:A="x")*(A:A&lt;&gt;"")), B:B)
  </code></pre>
  
  <p>Excel gives an error saying there is something wrong with my formula(something to do with the * in the condition)  I had also tried the following, but it counts blank cells as 0's in the calculations:</p>
  
  <pre><code>=MEDIAN(IF(A:A = "x", B:B, "")
  </code></pre>
  
  <p>I am aware that those formulas return Excel "arrays", which means one must enter "Ctrl-shift-enter" to get it to work correctly.</p>
  
  <p>How can I do a conditional evaluation and not consider blank cells?</p>