Count occurrences of text in Excel

This example will teach you how to count the number of occurrences of text in a selected range.

  1. For example, you can count the number of cells containing the text “star” using the following formula:

    =COUNTIF(A1:A7,"star")

    =СЧЁТЕСЛИ(A1:A7;"star")

  2. To count the number of cells containing “star” + 1 character, this formula is suitable:

    =COUNTIF(A1:A7,"star?")

    =СЧЁТЕСЛИ(A1:A7;"star?")

    The question mark (?) matches exactly one character.

  3. You can calculate the number of cells containing “star” + a number of characters (from zero or more) using the formula below:

    =COUNTIF(A1:A7,"star*")

    =СЧЁТЕСЛИ(A1:A7;"star*")

    An asterisk (*) matches a range of characters (zero or more).

  4. You can also count the number of cells that contain “star” anyway, using this formula:

    =COUNTIF(A1:A7,"star*")

    =СЧЁТЕСЛИ(A1:A7;"*star*")

    This function counts all cells that contain “star”, regardless of what comes before or after the search text.

  5. You can also count the number of cells containing any text by writing this formula:

    =COUNTIF(A1:A7,"*")

    =СЧЁТЕСЛИ(A1:A7;"*")

Leave a Reply