title: Excel VBA CountIF To Search For String Array
body: <p>How can I use the <code>COUNTIF()</code> function to count only certain text strings that exist in the range?</p>
  
  <p>I tried to use the below, but I get an error of</p>
  
  <pre><code>Syntax error
  </code></pre>
  
  <p>This is the syntax I attempted</p>
  
  <pre><code>Dim worksheetmaster As String = "Master"
  Dim worksheettocheck As String = "New"
  Dim softcount As Int, i As Long, hardcount As Int
  
  softcount = Evaluate("=COUNTIF(Range('" &amp; worksheettocheck &amp; "'!A:A'" &amp; worksheetmaster &amp; "'!A" &amp; i &amp; ")"Soft")")
  hardcount = Evaluate("=COUNTIF(Range('" &amp; worksheettocheck &amp; "'!A:A'" &amp; worksheetmaster &amp; "'!A" &amp; i &amp; ")"Hard")")
  </code></pre>
  
  <p><strong>EDIT</strong><br>
  I tried to use this syntax without the <code>Range</code> and am still getting the error</p>
  
  <pre><code>hardcount = Evaluate("=COUNTIF('" &amp; worksheettocheck &amp; "'!A:A'" &amp; worksheetmaster &amp; "'!A" &amp; i &amp; ")"Hard"")
  </code></pre>