A step-by-step guide to using the COUNTIFS function in Microsoft Excel

A step-by-step guide to using the COUNTIFS function in Microsoft Excel
  • Homepage
  • >
  • All News
  • >
  • A step-by-step guide to using the COUNTIFS function in Microsoft Excel

COUNTIFS in Microsoft Excel is a versatile, single function that you can use to count any data using any combination of criteria. This function handles AND/OR logic and dynamic cell references as well as partial text matching using wildcards. It eliminates the need to use time-consuming workarounds.

The COUNTIFS syntax (and things you need to know)

The COUNTIFS syntax is straightforward and logical:

=COUNTIFS(criteria_range1,criteria1,[criteria_range2,criteria2],…)

where:

  • criteria_range1 (required) is the first range to be evaluated. The criteria (numbers, expressions, cell references, or texts) used to define the cells of the criteria_range1 that are going to be counted is
  • .
  • criteria_range2,criteria2 (optional) is the second of up to 127 range-criteria pairings. Note that

    • the COUNTIFS can be applied to a single or multiple ranges with different criteria. As an example, the criterion_range1 range and criteria_range2 range can either be the same or different. Use the COUNTIF function to count data using a single criteria. The criteria_ranges and of

    • each must be the same size. The ranges do not have to be adjacent (contiguous), but the shapes must match.

    • Criteria can either be hard coded in the formula, or referenced by a cell that contains the conditions. When a criteria references an empty row, the cell is treated as 0. Here are some examples from real life. Download the Excel file used to illustrate the guide for free. You’ll see the button to download the workbook in the upper-right corner after clicking the link. When you open the document, each scenario is on its own worksheet tab.

      The COUNTIFS function defaults to the AND logic. The COUNTIFS function will count a row only if all conditions are met.

      Example 1: You’ve got a list of sales transactions in Excel named T_Sales. And you want to find out how many meet the criteria for the two conditions: The region “East,” is the”East,”the product “Desk.”

      here’s the formula that you will type in cell G2 :

      =COUNTIFS (T_Sales[Region]].”East”The criteria for the region column is

    • “East” . T_Sales ([Product] ) tells Excel that it should look at the Product column in the same table. The criteria for the column Product is
    • “Desk” . The criteria is hard coded into this formula

    . It’s quick but you will need to edit your formula if you wish to make changes to the criteria. For example, changing “east” into “west,” . In Scenario 2, I will show you an improved method.

    Because the COUNTIFS uses the AND logic, the COUNTIFS only counts transactions which meet both criteria and . Also, note that criteria must be enclosed in double quotes. It is always required to reference text within Excel formulas.

    COUNTIFS and cell references

    When using COUNTIFS, or any Excel formula which uses criteria, it is best to keep your criteria separate in cells, then reference them in the formula. It allows for instant flexibility. Change one of the cells in your criteria and you will see an update to your count.

    Related to

    Look for exact matches.

    Cell references are the easiest way to find a text or value match.

    Example 2: In this scenario, you want to calculate all the transactions that are in the T_Transac Table where both the product and the region match. The formula to use for cell G3 is:

    =COUNTIFS (T_Transac -[Region]G1,T_Transac -[Product]G2,T_Transac –[Product]G2)

    Where:

    T_Transac -[Region] instructs Excel that it should look at the Region column in the T_Transac Table The criteria for the region column is in cell G1. T_Transac ([Product] ) tells Excel that it should look at the Product column in the same table.

  • The criteria for the column Product is contained in cell G2. When you make changes to the criteria of cells G1 or G2, your count will automatically update. When I switch the region from “south” to “desk”the count updates automatically.

    Take it a step further by creating data validation drop down lists for the criterion cells. It saves time typing by ensuring only valid options are selected.

    Comparing operators

    When you have to compare operators (>=,

    View Article Source

Share Article
Facebook
LinkedIn
X
UK businesses restart delayed investment after the Budget, and most of those announcements will go unheard
Berkshire heating engineers put the boiler service first as January bill forecasts climb
As Christmas lists get shorter, Ascot home brand says one lasting piece beats five impulse buys
Secret Link