The COUNTIF function can be used to count cells if end with specified criteria. e.g. count cells if end with “A”. In our example, we will count cells based on the text “B” criteria.
The formula used above has following arguments:
range (A4:A9) – The range of cells to count against the criteria.
criteria (“*B”) – The criteria to count only those cells which end with “B” and the “*” symbol or the asterisk is a wildcard in Excel which means “match any number of characters”.