title: Macro - countif function checking if the range "contains" the criteria
body: <p>I have a macro which does the countif function checking the criteria from the column B in arange in a column A. Both (range and criteria) might have different size, so the macro goes until the last cell populated. However, it checks exactly the same matches. I would like to transform it to check if the range contains the criateria. For instance, if the criteria is "Manager" and in the range we have "Marketing Manager", I would like to count it. Below you can find the screenshot of the excel file and the code of my macro. </p>
  
  <p><strong>Screenshot:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/LnzxP.jpg" alt="enter image description here"></p>
  
  <p><strong>Macro Code:</strong></p>
  
  <pre><code>Sub Countif_Until_LastRow()
  
  Dim lastRowColumnB As Long
  lastRowColumnB = Range("B65000").End(xlUp).Row
  
  For i = 2 To lastRowColumnB
  Cells(i, 3) = Application.CountIf(Range("A:A"), Cells(i, 2))
  Next
  End Sub
  </code></pre>