title: Compare columns in MS Excel
body: <p>Following is a sample excel spreadsheet. The requirement is to compare each column (say B) with column C and count the number of rows in which both B and C have numbers. For instance, both B and C have values in the first and second rows but only B has a value in the third row, so the output should be 2.</p>
  
  <p>I tried to use if condition in the following manner:</p>
  
  <pre><code>if(and(isnumber(b2),isnumber(c2)),1,0)
  </code></pre>
  
  <p>but it works only for one row not all rows.</p>
  
  <p>How do I achieve this result in MS Excel?</p>
  
  <pre><code>╔═══╦════════╦═══╦═══╦═══╦═══╦═══╗
  ║   ║   A    ║ B ║ C ║ D ║ E ║ F ║
  ╠═══╬════════╬═══╬═══╬═══╬═══╬═══╣
  ║ 1 ║        ║ 4 ║ 5 ║   ║ 6 ║ 5 ║
  ║ 2 ║        ║ 2 ║ 5 ║   ║ 2 ║   ║
  ║ 3 ║        ║ 1 ║   ║ 2 ║ 6 ║ 7 ║
  ║ 4 ║        ║   ║   ║   ║   ║   ║
  ║ 5 ║ Output ║ 2 ║   ║ 0 ║ 2 ║ 1 ║
  ╚═══╩════════╩═══╩═══╩═══╩═══╩═══╝
  </code></pre>