COUNTIFS determines the number of occurrences by comparing each range with its respective criterion. It then counts how many rows match all the stated criteria.