Change your formula to a COUNTIFS
which takes multiple parameter sets and use the second parameter set to test if column H has no value/text
=COUNTIFS(B:B,"CM",H:H,"<>")
Note, this doesn't exclude the possibility that cells in column H may contain a formula. That's a question I can't answer.
I'm not sure if you wanted to count cells in column B that equal "CM" or contain "CM". Your formula will count any cells that equal upper or lower case "cm" (or any combination thereof). If you really want cells containing "CM", wrap it in asterisks
=COUNTIFS(B:B,"*CM*",H:H,"<>")