How to use Excel COUNTIFS and COUNTIF with multiple criteria

The tutorial explains how to use COUNTIFS and COUNTIF formulas with multiple criteria in Excel based on AND as well as OR logic. You will find a number of examples for different data types - numbers, dates, text, wildcard characters, non-blank cells and more.

Of all Excel functions, COUNTIFS and COUNTIF are probably most often mixed up because they look very much alike and both are purposed for counting cells based on the specified criteria.

The difference is that COUNTIF is designed for counting cells with a single condition in one range, whereas COUNTIFS can evaluate different criteria in the same or in different ranges. The aim of this tutorial is to demonstrate different approaches and help you choose the most efficient formula for each particular task.

Excel COUNTIFS function - syntax and usage

The Excel COUNTIFS function counts cells across multiple ranges based on one or several conditions. The function is available in Excel 365, 2021, 2019, 2016, 2013, Excel 2010, and Excel 2007, so you can use the below examples in any Excel version.

COUNTIFS syntax

The syntax of the COUNTIFS function is as follows:

COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)
  • criteria_range1 (required) - defines the first range to which the first condition (criteria1) shall be applied.
  • criteria1 (required) - sets the condition in the form of a number, cell reference, text string, expression or another Excel function. The criteria defines which cells shall be counted and can be expressed as 10, "<=32", A6, "sweets".
  • [criteria_range2, criteria2]… (optional) - these are additional ranges and their associated criteria. You can specify up to 127 range/criteria pairs in your formulas.

In fact, you don't have to remember the syntax of the COUNTIF function by heart. Microsoft Excel will display the function's arguments as soon as you start typing; the argument you are entering at the moment is highlighted in bold. The syntax of the Excel COUNTIFS function

Excel COUNTIFS - things to remember!

  1. You can use the COUNTIFS function in Excel to count cells in a single range with a single condition as well as in multiple ranges with multiple conditions. If the latter, only those cells that meet all of the specified conditions are counted.
  2. Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument).
  3. Both contiguous and non-contiguous ranges are allowed.
  4. If the criteria is a reference to an empty cell, the COUNTIFS function treats it as a zero value (0).
  5. You can use the wildcard characters in criteria - asterisk (*) and question mark (?). See this example for full details.

How to use COUNTIFS and COUNTIF with multiple criteria in Excel

Below you will find a number of formula examples that demonstrate how to use the COUNTIFS and COUNTIF functions in Excel to evaluate multiple conditions.

How to count cells with multiple criteria (AND logic)

This scenario is the easiest one, since the COUNTIFS function in Excel is designed to count only those cells for which all of the specified conditions are TRUE. We call it the AND logic, because Excel's AND function works this way.

Formula 1. COUNTIFS formula with multiple criteria

Suppose you have a product list like shown in the screenshot below. You want to get a count of items that are in stock (value in column B is greater than 0) but have not been sold yet (value is column C is equal to 0).

The task can be accomplished by using this formula:

=COUNTIFS(B2:B7,">0", C2:C7,"=0")

And the count is 2 ("Cherries" and "Lemons"): Counting cells with multiple criteria based on AND logic

Formula 2. COUNTIFS formula with two criteria

When you want to count items with identical criteria, you still need to supply each criteria_range / criteria pair individually.

For example, here's the right formula to count items that have 0 both in column B and column C:

=COUNTIFS($B$2:$B$7,"=0", $C$2:$C$7,"=0")

This COUNTIFS formula returns 1 because only "Grapes" have "0" value in both columns. COUNTIFS formula with identical criteria

Using a simpler formula with a single criteria_range like COUNTIFS(B2:C7,"=0") would yield a different result - the total count of cells in the range B2:C7 containing a zero (which is 4 in this example).

How to count cells with multiple criteria (OR logic)

As you have seen in the above examples, counting cells that meet all of the specified criteria is easy because the COUNTIFS function is designed to work this way.

But what if you want to count cells for which at least one of the specified conditions is TRUE, i.e. based on the OR logic? Overall, there are two ways to do this - by adding up several COUNTIF formulas or using a SUM COUNTIFS formula with an array constant.

Formula 1. Add up two or more COUNTIF or COUNITFS formulas

In the table below, supposing you want to count orders with the "Cancelled" and "Pending" status. To have it doen, you can simply write 2 regular Countif formulas and add up the results:

=COUNTIF($C$2:$C$11,"Cancelled") + COUNTIF($C$2:$C$11,"Pending") Counting cells that meet any of the specified criteria

In case each of the functions is supposed to evaluate more than one condition, use COUNTIFS instead of COUNTIF. For example, to get the count of "Cancelled" and "Pending" orders for "Apples" use this formula:

=COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Cancelled") + COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Pending") Another formula to count cells with multiple criteria and OR logic

Formula 2. SUM COUNTIFS with an array constant

In situations when you have to evaluate a lot of criteria, the above approach is not the best way to go because your formula would grow too big in size. To perform the same calculations in a more compact formula, list all of your criteria in an array constant, and supply that array to the criteria argument of the COUNTIFS function. To get the total count, embed COUNTIFS inside the SUM function, like this:

SUM(COUNTIFS(range,{"criteria1","criteria2","criteria3",…}))

In our sample table, to count orders with the status "Cancelled" or "Pending" or "In transit", the formula would go as follows:

=SUM(COUNTIFS($C$2:$C$11, {"cancelled", "pending", "in transit"})) A more compact formula to count cells with multiple criteria and OR logic

In a similar manner, you can count cells based on two or more criteria_range / criteria pairs. For instance, to get the number of "Apples" orders that are "Cancelled" or "Pending" or "In transit", use this formula:

=SUM(COUNTIFS($A$2:$A$11,"apples",$C$2:$C$11,{"cancelled","pending","in transit"})) Counting cells with multiple criteria_range / criteria pairs and OR logic

You can find a few more ways to count cells with OR logic in this tutorial: Excel COUNTIF and COUNTIFS with OR conditions.

How to count numbers between 2 specified numbers

By and large, COUNTIFS formulas for numbers fall into 2 categories - based on several conditions (explained in the above examples) and between the two values you specify. The latter can be accomplished in two ways - by using the COUNTIFS function or by subtracting one COUNTIF from another.

Formula 1. COUNTIFS to count cells between two numbers

To find out how many numbers between 5 and 10 (not including 5 and 10) are contained in cells C2 through C10, use this formula:

=COUNTIFS(C2:C10,">5", C2:C10,"<10") A COUNTIFS formula to count numbers between X and Y

To include 5 and 10 in the count, use the "greater than or equal to" and "less than or equal to" operators:

=COUNTIFS(B2:B10,">=5", B2:B10,"<=10")

Formula 2. COUNTIF formulas to count numbers between X and Y

The same result can be achieved by subtracting one Countif formula from another. The first one counts how many numbers are greater than the lower bound value (5 in this example). The second formula returns the count of numbers that are greater than the upper bound value (10 in this case). The difference between the first and second number is the result you are looking for.

  • =COUNTIF(C2:C10,">5")-COUNTIF(C2:C10,">=10") - counts how many numbers greater than 5 and less than 10 are in the range C2:C10. This formula will return the same count as shown in the screenshot above.
  • =COUNTIF(C2:C10, ">=5")-COUNTIF(C2:C10, ">10") - the formula counts how many numbers between 5 and 10 are in the range C2:C10, including 5 and 10.

How to use cell references in COUNTIFS formulas

When using logical operators such as ">", "<", "<=" or ">=" together with cell references in your Excel COUNTIFS formulas, remember to enclose the operator in "double quotes" and
add an ampersand (&) before a cell reference to construct a text string.

In a sample dataset below, let's count "Apples" orders with amount greater than $200. With criteria_range1 in cells A2:A11 and criteria_range2 in B2:B11, you can use this formula:

=COUNTIFS($A$2:$A$11, "Apples", $B$2:$B$11, ">200")

Or, you can input your criteria values in certain cells, say F1 and F2, and reference those cells in your formula:

=COUNTIFS($A$2:$A$11, $F$1, $B$2:$B$11, ">"&$F$2)

Please notice the use of absolute cell references both in the criteria and criteria_range arguments, which prevents the formula from being broken when copied to other cells. Using cell references in COUNTIFS formulas

For more information about the use of an ampersand in COUNTIF and COUNTIFS formulas, please see Excel COUNTIF - frequently asked questions.

How to use COUNTIFS with wildcard characters

In Excel COUNTIFS formulas, you can use the following wildcard characters:

  • Question mark (?) - matches any single character, use it to count cells starting and/or ending with certain characters.
  • Asterisk (*) - matches any sequence of characters, you use it to count cells containing a specified word or a character(s) as part of the cell's contents.

Tip. If you want to count cells with an actual question mark or asterisk, type a tilde (~) before an asterisk or question mark.

Now let's see how you can use a wildcard char in real-life COUNTIFS formulas in Excel. Suppose, you have a list of projects in column A. You wish to know how many projects are already assigned to someone, i.e. have any name in column B. And because we are learning how to use the COUNTIFS function with multiple criteria, let's add a second condition - the End Date in column D should also be set.

Here is the formula that works a treat:

=COUNTIFS(B2:B10,"*",D2:D10,"<>"&""))

Please note, you cannot use a wildcard character in the 2nd criteria because you have dates rather that text values in column D. That is why, you use the criteria that finds non-blank cells: "<>"&"" The COUNTIFS formula to count entries containing any text in one column and non-blank cells in another column.

COUNTIFS and COUNTIF with multiple criteria for dates

The COUNTIFS and COUNTIF formulas you use for dates are very much similar to the above formulas for numbers.

Example 1. Count dates in a specific date range

To count the dates that fall in a certain date range, you can also use either a COUNTIFS formula with two criteria or a combination of two COUNTIF functions.

For example, the following formulas count the number of dates in cells C2 through C10 that fall between 1-Jun-2014 and 7-Jun-2014, inclusive:

=COUNTIFS(C2:C9, ">=6/1/2014", C2:C9, "<=6/7/2014")

=COUNTIF(C2:C9, ">=6/1/2014") - COUNTIF(C2:C9, ">6/7/2014") The COUNTIF formula with 2 conditions to count dates in a specific date range

Example 2. Count dates with multiple conditions

In the same manner, you can use a COUNTIFS formula to count the number of dates in different columns that meet 2 or more conditions. For instance, the below formula will find out how many products were purchased after the 20th of May and delivered after the 1st of June:

=COUNTIFS(C2:C9, ">5/1/2014", D2:D9, ">6/7/2014") The COUNTIF formula to count dates with multiple conditions

Example 3. Count dates with multiple conditions based on the current date

You can use Excel's TODAY() function in combination with COUNTIF to count dates based on the current date.

For example, the following COUNTIF formula with two ranges and two criteria will tell you how many products have already been purchased but not delivered yet.

=COUNTIFS(C2:C9, "<"&TODAY(), D2:D9, ">"&TODAY()) The COUNTIF formula to count dates with multiple conditions based on the current date

This formula allows for many possible variations. For instance, you can tweak it to count how many products were purchased more than a week ago and are not delivered yet:

=COUNTIFS(C2:C9, "<="&TODAY()-7, D2:D9, ">"&TODAY())

This is how you count cells with multiple criteria in Excel. I hope you will find these examples helpful. Anyway, I thank you for reading and hope to see you on our blog next week!

2035 comments

  1. I need to write a fomula that counts the UPC codes that were used in Las Vegas. There is a mixture of blanks and with letters. Here is a similar example:

    Location UPC Codes
    Las Vegas 981
    Los Angeles 8989
    Tokyo 9867
    Las Vegas 8989
    Los Angeles 8989
    Tokyo
    New York 65464
    Miami Pi757
    Las Vegas
    Los Angeles 8989
    Tokyo 2165
    New York
    Miami 235
    Las Vegas 8989
    Los Angeles G192
    Tokyo Pi757
    New York 8989
    Miami 8989

    • Hi! Please check out this article to learn how to count unique values in Excel: with criteria, ignoring blanks.
      Try to use this formula:

      =IFERROR(ROWS(UNIQUE(FILTER(B2:B20,A2:A20="Las Vegas"))), 0)

  2. I need to identify the presence of an element in at least one column, in columns that are separated from each other, but I need to count it just once (even if it is in several columns).
    For example, in column A I have attendance on day X; in column D I have the attendance for day Y and in column H I have the attendance for day Z. Each day is marked "Yes" or "No".
    I need to count the people who attended, regardless of whether they went 1, 2 or 3 times. When using the countifs function, if the person was not there on a day, it doesn't count them. On the other hand, if I combine the countifs function and add what is derived from the Or function, then it counts it 1, 2, or 3 instead of 1. Is there a way to do it?

  3. DATE SALESMAN PRODUCTION HORECA
    01-Oct-23 KOUSHAL JOSHI FOLLOW UP
    01-Oct-23 NEERAJ PARIHAR CLOSED
    01-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP
    01-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
    01-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
    06-Oct-23 RAFIQ SHEIKH FOLLOW UP
    06-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
    06-Oct-23 RAFIQ SHEIKH CLOSED CLOSED
    09-Oct-23 NEERAJ PARIHAR FOLLOW UP FOLLOW UP
    10-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
    10-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
    10-Oct-23 RAFIQ SHEIKH FOLLOW UP
    13-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
    14-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
    15-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP
    15-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
    15-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
    15-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP

    Need to know that which sales man has generated how many leads in production and HORECA on daily basis. Required daywise report

  4. Hi, i have a question about a seemingly simple function but i cannot get it figured out.

    So this is the formula i have

    =COUNTIFS(I:I,"",D:D,"DEPO",B:B,"2024FA")+COUNTIFS(J:J,"86",D:D,"DEPO",B:B,"2024FA")

    Now, the context is that i need to count a person whether they have either any value in Column I, or a value of 86 in Column J as well as the criteria for columns D and B staying the same. People CAN have both values present. The way the formula is written now, if someone has both values present, they are counted twice.

    Am i missing something? I thought of using an OR function, but i cannot get that to work. Anyone have any insight into this?

    Thank you!

    • Hello! Subtract the number of people who have both values present. Try the formula:

      =COUNTIFS(I:I,"",D:D,"DEPO",B:B,"2024FA")+COUNTIFS(J:J,"86",D:D,"DEPO",B:B,"2024FA") - COUNTIFS(I:I,"",J:J,"86",D:D,"DEPO",B:B,"2024FA")

  5. Hi! I'm trying to count a range of cells across a large array; *if* they match the criteria in a single column,
    so, my first through was; It should be as simple as

    =COUNTIF(B3:B123, "A Shift", F3:HH123, "Assigned"),

    now; if i'm understanding correctly; the the vertical range must be the same size;
    Is failing because the horizontal range is larger?

    If so; what's the solution to simply find

    if x=a in a single vertical column, count how many occurrences on the horizontal =b

    I've tried

    =IF(B3:B123=A, COUNTIF(F3:HH123, "Assigned"),0) and that wants to spill to nearby cells;

    What am I missing here?

    • Hi! If I understand your task correctly, to count the number of values across multiple criteria, try using the SUMPRODUCT function. Here is an example formula:

      =SUMPRODUCT((B3:B20="A Shift")*(F3:M20="Assigned"))

      I hope it’ll be helpful.

      • Thanks for the speedy reply;
        Unfortunately that example is returning 0

        For what i'm trying to do, I have Column B which is just "A", "B", and "C" about 20 times each as we go down the rows from 3 to 123;

        Then I have a matrix going across all the way from Column F to Column HH,

        Some of the cells have dates in to indicate when a task completed; and some contain just the word "Assigned";

        I'd like to count how many occurances of "Assigned" appear across the range where column B="A", then once that's working follow on for rows where Column B="B" and where Column B="C"

        I originally used
        =COUNTIFS('Primary Matrix'!F3:T30,"*Assigned*") to count the rows where Column B="A"

        but this would mean that someone will have to manually adjust the formula whenever a new person is added to the range where B="A"

        So rather i'd like to create a formula that will sum all occurrences of "Assigned" between Columns F and HH; only IF column B="A"

        So i've tried your example like this, and I can see how it should work;

        =SUMPRODUCT((B3:B123="A")*(F3:HH123="*Assigned*"))

        But it returned 0 across a range that does contain multiple occurences of "Assigned", and I feel like i'm missing something obvious; but I can't work out what.

        • Hi! The formula I sent to you was created based on the description you provided in your first request. However, as far as I can see from your second comment, your task is now different from the original one.
          To learn how to find a partial text match, please read: How to find substring in Excel.
          For example:

          (ISNUMBER(SEARCH("Assigned",F3:HH123)))

          • Hi,

            I'll give that a go;

            Apologies if it was unclear; the task has always been: count number of "*Assigned*" in a range; only where column B (outside of that range)="A*", and ignore other instances (within the range) of "*Assigned*"

            • So, I've found a workaround;

              I wanted to avoid adding any additional columns to the page with the data;

              but by doing a single column with just

              =COUNTIF(F3:HC3,"*Assigned*")

              after the final data column; then all I had to do was (on the page I wanted to display the data)

              =SUMIF('Primary Matrix'!B:B,"A*",'Primary Matrix'!HF:HF)

              and likewise for B, and C.

              that's solved it; not how I wanted to solve it; but it unarguably works now.

              • *A single column, with that COUNTIF repeated for each row of data.

  6. =COUNTIFS('Section 2'!$AC:$AC,"Pending",'Section 2'!$AA:$AA,">12 months")

    I am trying the above formula to get the number of cases pending beyond 12 months, as per my data sheet the result of this formula should be 0. however, the formula is returning a value i.e. 1 in first instance & 2 in second instance.

    When I removed the > sign, I got the desired result. Also, when I tried adding >12 months in my data sheet as a dummy value to test the formula, it did not return the correct number. why is that so?

  7. I am trying to incorporate the today function into my countifs formula. I have a column that reflects the date of activity but I can't seem to get it right.

    =COUNTIFS(Master_TTHU_Inventory!$H$2:H$5000, A4,Master_TTHU_Inventory!$G$2:$G$5000,"MISSION READY")

    The above formula is for my grand total report, but I need to show daily totals for cob that day on a separate sheet using the same information.

    • Hi! Create a column with dates on a separate sheet. Then add a condition for the date to the COUNTIFS formula. For example:

      =COUNTIFS(Master_TTHU_Inventory!$H$2:H$5000, A4,Master_TTHU_Inventory!$G$2:$G$5000,"MISSION READY", Master_TTHU_Inventory!$D$2:$D$5000,New_Sheet!D2)

      D - column with dates.
      You can get a report without formulas, using a pivot table with grouping by days. Read more: How to make and use Pivot Table in Excel.
      I hope it’ll be helpful. If something is still unclear, please feel free to ask.

  8. I appreciate a lot to the information provided above. We are learning. However, I am still not clear on something I dont know which formula works best for the following example.

    A B C
    Month Dept Service Requested

    1 Jan-23 Sales 0001
    2 Jan-23 Sales 0001
    3 Jan-23 Sales 0001
    4 Jan-23 Operations 0001
    5 Jan-23 Accounts 0002
    6 Jan-23 Operations 0002
    7 Jan-23 Accounts 0002
    8 Jan-23 Admin 0003
    9 Feb-23 Accounts 0004
    10 Feb-23 Sales 0004
    11 Mar-23 Accounts 0005
    12 Mar-23 Operations 0006
    13 Mar-23 Sales 0007
    14 Mar-23 Operations 0008
    15 Apr-23 Admin 0009
    16 Apr-23 Admin 0010
    17 May-23 Admin 0011

    I want to count "how many service types were requested by each department per month". This means the formula has to count the similar service type once for same dept in the same month right.

  9. I am using this formula and it is generating an incorrect value. =COUNTIFS('Tray Audit Log'!D:D, "Y",'Tray Audit Log'!B:B,">6/1/2023") - COUNTIFS('Tray Audit Log'!B:B,"<6/30/2023"). The data is counting 641 when there are actually 194 yes in the month of June.

    I am trying to count the total y(yes) from one column and the MONTH from another column all information on a different tab. I can send the data via email I cannot attach it to this chat.

  10. I want to compare multiple dates for Planning dates vs. Actual dates; it seems that in planning dates there are several activities inclusion same with actual dates. I need to compare it 1 by 1 activity date and the true values will determine the condition of green, amber and red.

    • Hi! Please clarify your specific problem or provide additional information to understand what you need. Give an example of the source data and the expected result.

  11. Any way please to get the function criteria at countifs from a cell with multiple values into a criteria like {"A,", "B", "C") automatically?
    A B D E
    Item1 London PART DEPOT
    Item1 London Item1 Frankfurt
    Item2 London Item2 Hong Kong
    Item1 Heathrow Item1 London
    Item2 Manchester Item1 London, Manchester
    Item1 Sandwell Item2 London, Manchester, Glasgow
    Item1 Glasgow
    Item2 Glasgow
    Item3 Frankfurt

    For example I need a =sum(countifs(A:A,D6,B:B, {"London", "Manchester","Glasgow"}) next to E6.
    E6 is London, Manchester, Glasgow separated by comma.
    any quick way to write the function so I can reference this cell but in a way it turns into {"London", "Manchester","Glasgow"} within the function instead of me typing it out?

    • Unfortunately, the COUNTIFS function does not work with array formulas. You can write an array of values directly in a formula, but you cannot pass an array of values to a COUNTIFS formula using another function.

  12. Can we use countifs in MS Excel with in different online sheets...

  13. Hello,

    I have tried using one of your formulas but I might have an incorrect understanding of it.

    I am trying to count multiple criteria (frequency of the word "CVD" tagged to "Antipolo DC")

    I try to use this formula =COUNTIFS(N3:N2028,"Antipolo DC",Y3:Y1048576,"CVD") but the results show #Value!

    May I kindly check what I am possibly doing wrong?

    Please note that Antipolo DC is a location (there are 20 other locations in the list) and CVD is an option (there are 5 other options in the list)

    • Hi! I have said many times on this blog that the sizes of all ranges (that is, the number of rows and columns) in the COUNTIFS and SUMIFS functions should be the same.

  14. Hi,
    I am wanting to know if there is a formula on excel that would give me employees working at a given period per day. For example - there is a total of 20 people working at the facility but they all start and finish at different times. I want to know how many people are working from 9am to 10am etc etc. hope this makes sense.

    Thanks

    • Hi! The answer to your question can be found in this paragraph of the article above: How to count numbers between 2 specified numbers. Count the number of values greater than the start time and less than the end time. I can't offer you a formula as I don't have your data.

  15. Hello, I cannot figure out what formula to use for this problem. Referring to the data set below... Let's say column A is an employee number and I need to count all of the Ns for that employee, how would I write that formula? The other issue is the number of rows for each employee will not always be the same. For example, employee 1260 may have 7 rows, employee 1266 may have 12 rows, employee 1279 may have 15 rows.... so the range will always be different. The next issue is that the spreadsheet has 115311 rows so I cannot individualize each formula with the employee number or range. The formula would need to find each unique employee, establish the range and then count the number of Ns or Ps or whatever within that range. I was trying the =countifs formula trying to get it to use whatever number is in A1 as Criteria1, then giving the next range and asking it to count the Ns. =COUNTIFS($A2:$A115311,"=A2", C2:I27,"N") ..... this formula did not work. LOL

    Not picky if it is displayed on a separate sheet. If its easier, it could put the report on a separate sheet which would list the unique employee number followed by how many Ns, Ps, 7s, As, etc.

    1260 4/2/2023 N N N N 7 N N
    1260 4/9/2023 N 7 N P N N N
    1260 4/16/2023 N N N N N A Q
    1260 4/23/2023 A P N N N A N
    1260 4/30/2023 7 N N A A A Q
    1266 5/7/2023 N N A N N N N
    1266 5/14/2023 N N A A P 7 N
    1266 5/21/2023 N P N A A A Q
    1266 5/28/2023 N N N N N N N
    1266 6/4/2023 N N N A A Q N

    Thank you for any help you could offer!

    • Hi! Read the instructions above carefully. Also note that all ranges in the COUNTIFS function must have the same size, i.e. the same number of rows and columns.

  16. A need Help for All Apples count and only show Delivered Percentage
    if i use this code "=COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Delivered")" its show (Apples Delivered 3) . if i had total 10 Apples and Delivered only 3 it will show Apples Delivered 30 %.

  17. Thanks for the information.

    I would like to count the number of unique value based on a set of "OR" & "AND" criteria.

    Given the following,
    A 3366 1 0
    A 3329 1 1
    B 2282 1 1
    B 2282 1 1
    B 2282 0 1
    B 3409 1 0

    To count the number of unique value of column B with following criteria: column A = "B" AND column C = 1, I could get the answer with
    ={SUM(IF((A1:A6="B")*(C1:C6=1),1/COUNTIFS(A1:A6,"B",C1:C6,1,B1:B6,B1:B6)))}

    How to add an "OR" condition to the criteria for this?
    say I would like to count the number of unique value of column B with the following criteria: column A = "B" AND ((column C = 1) or (column D = 1))
    of course apart from generating a new column E to do the logic.

    Thank you.

  18. I'm wondering if it's possible to count selected cell with conditional formatting with a date. counting the following
    A5 + A8 +A10

    each cell draws information using lookup formulas and conditional formatting

    A5 = date (01/05/24)
    A8 = date (26/09/22)
    A10 = Txt (not trained)

    = number of cells greater then TODAY()
    this example = 1

  19. Hello all, this is a fantastic site, I've learned so much, can't tell you! OK, I can't seem to figure out how to do this, it seems simple, I must be missing something.
    I want to count cells that have certain text strings within the cell that has a whole bunch of words in it. So let's say I've got a whole bunch of cells that contain sentences like this:

    Mary went to the store to get apples
    James went to the store to get oranges
    James went to the store to get apples

    etc., etc.

    I want a formula that will count how many cells contain both "Mary" and "apples". I've tried the following, but they don't work:

    =COUNTIFS($A$1:$A$10,*Mary*,$A$1:$A$10,*apples*)
    =COUNTIFS($A$1:$A$10,"Mary",$A$1:$A$10,"apples")

    Do I need to use the AND statement? Or maybe there's an issue searching for the words in the cell?

    Thanks all.

    Tom

    • Add quotation marks to the text string. Try this formula:

      =COUNTIFS($A$1:$A$10,"*Mary*",$A$1:$A$10,"*apples*")

      Please have a look at this guide: How to find substring in Excel. For example:

      =SUMPRODUCT(ISNUMBER(SEARCH("apple",A1:A10)) * ISNUMBER(SEARCH("mary",A1:A10)))

      I hope it’ll be helpful.

      • This is perfect, thank you so much for replying, much appreciated!

        Tom

  20. This formula counts 5 occurrences of 'X' or more than 5 'X' as 1 and it also does not count lower case 'x' and it is good. But, how can I modify this so that it will not count interrupted appearance of 'X' in a row but only unbroken 5 'X' or XXXXX? Broken and interrupted is like this ( XXXX X, XXX__XX and others) =SUM(IF(MMULT(--(EXACT(F8:AK39, "X")), TRANSPOSE(COLUMN(F8:AK39)^0)) >= 5, 1, 0))

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)