excel calculate how many cells containing specific text code example Example: excel count columns with text =COUNTIF(B4:B8,"*")