Comments on: 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. You will find a number of examples for different data types – numbers, dates, text, wildcard characters, non-blank cells and more. Continue reading

Comments page 12. Total comments: 791

  1. Hi there,

    second day in a row, sorry about that.

    Is there a way to search across multiple sheets (i know that is a VLOOKUP) but to return values from the search?

    In this case I have data from various cities, (all sheets are the same layout) and i want to look up the Sector (coloum D) for say "Construction" and return the total cost across all sheets (column F)

  2. Hi there, Im trying to return a result if one 'phrase' is met, and then one do have a difference result if one of 5 others.

    I had a try but seem to have failed miserably with the second criteria/calculation

    please help

    IF(SUM(COUNTIF(E3,{"*In work as a result of LVP*"})),B3,""),(SUM(COUNTIF(E3,{"*In work through other means*","*Awaiting a start date*", "*Out of work*", "*Health Condition*", "*Other*"})),(B3-(B3*2)),"")

    1. Hi,
      if I understood the problem correctly, try this formula:

      =IF(SUM(--ISNUMBER(SEARCH("In work as a result of LVP",E3))),B3, IF(SUM(--ISNUMBER(SEARCH({"In work through other means","Awaiting a start date", "Out of work","Health Condition","Other"},E3))), (B3-(B3*2)),""))

      1. Hi there,, Thankyou SSOOO much, thats amazing

  3. I am trying to use the Countifs to count the number of cells that fall within a specific date range and are between two values.

    Example: If I want to know how many cells are between 40 and 60 (Cell E) and between the dates of 3/1/21 and 3/31/21 (Column A)

    Formula I have been trying to get to work is
    =COUNTIFS($A$4:$A$1000000, ">="&G5, $A$4:$A$1000000, "<="&H5,$E$4:$E$1000000, "&=40")

    however, its returning over 27K as the count. I know I only have 1365 cells in this date range.

    Any help would be appreciate.

    Thanks

    1. Hi!
      Please use the following formula:

      =COUNTIFS($A$4:$A$1000000, “>=”&G5, $A$4:$A$1000000, "<="&H5,$E$4:$E$1000000, ">="&40,$E$4:$E$1000000, "<="&60)

  4. I have a need for a 3rd criteria. Using your example I would want it to countif Susan has a project, with a start date, but no end date. The example I am looking at is under "How to use COUNTIFS with wildcard characters".

    1. Hi Bryan,

      Simply, use 3 range/criteria pairs:

      =COUNTIFS(B2:B10, "susan", C2:C10, "<>"&"", D2:D10,"")

  5. Could you please help me
    If in One Column I have Y 2,Y 1,Y 6, N3 is there a way that i can sum the Numbers only

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =SUM((IF(ISNUMBER(--MID(CONCATENATE(A1,A2,A3,A4),ROW($1:$100),1)),--MID(CONCATENATE(A1,A2,A3,A4),ROW($1:$100),1),"")))

      or

      =SUM((IF(ISNUMBER(--MID(CONCAT(A1:A4),ROW($1:$100),1)),--MID(CONCAT(A1:A4),ROW($1:$100),1),"")))

      I hope it’ll be helpful.

  6. Hi,

    I've been spending days on getting the formula right, but still uncertain how to get the right info.
    I've got two columns with different dates: Start Date (A) & Resignation Date (B).
    Currently using =COUNTIFS(A3:A143, "=",B3:B143,"=>1-90" but doesn't seem to give the right answer.

    I would like to calculate how many people are resigning within 3 months, between 3-6 months, between 6-12 months. Any idea how the formula will look like?

    Thanks.

    1. Hello!
      To calculate how many people are resigning within 90 days, use the formula

      =SUMPRODUCT(((B1:B15-A1:A15)<90)*((B1:B15-A1:A15)>0))

      I hope it’ll be helpful.

      1. Hi Alexander,

        Thank you so much, this is definitely working!! :)

        Regards,
        Cindy

  7. Hi,

    I have following large set of data.

    Catalogue Lot Count
    HBI66545 1320000531 2
    HBI66545 1320000531 2
    HBI66545 1320000531 2
    HBI66545 1319000101 2
    HBI66545 1320000531 2
    HBI66545 1320000531 2
    HBI66545 1319000101 2

    I have used this formula to count.
    =SUM(B2=$B$2:$B$18,(1/COUNTIFS($A$2:$A$18,$A$2:$A$18,$B$2:$B$18,$B$2:$B$18,$C$2:$C$18,$C$2:$C$18)),0)

    But my problem is I would need sum of Catalogue and Lot which should be 5 for 1320000531 and 2 for 1319000101. Could you help me solving this?

    Thanks heaps

    1. Hi!
      Your explanations are not very clear. I am assuming that you want to count the number of occurrences of a value. For example 1320000531.
      A simple COUNTIF formula is suitable for this, as described in this article.
      If this is not what you wanted, please describe the problem in more detail.

  8. How can I use CountIFs function while counting the data of specific individual for a specific range of dates. Example, I have list of names in column A (from A2 to A20), their daily working hours is between column C2 to AF20 (31 days). Now I want to calculate number of days each individual did less than 5 hours shift, number of days an individual was not present in that month, total working days etc. I know I can do all these calculations for each individual at the end of the last column but I am pulling this data at another sheet and the names may not be in same order.

    Is there any other way other than CountIFs? Any help would be appreciated.

  9. I have a spreadsheet that i want to return a count across a row if two conditions are met.

    please whats the best way to write this code =if(AC3="Reject", AF3="vendor", Count(f3:Y3))

    when i wrote this code, i noticed the ones that met the condition only returned "True" instead of counting across the row, see below.

    Number of Rejects Due Supplier
    1
    TRUE
    5
    TRUE
    TRUE

    1. Hi!
      If I understand your task correctly, the following formula should work for you:

      =IF(AND(AC3="Reject", AF3="vendor"), COUNT(F3:Y3))

      I hope it’ll be helpful.

      1. Hello Alexander,
        Yes this was helpful, but i like to have 0 for the once that didnt meet the condition instead of "false"

        Actual expected
        false 0
        3 3
        False 0
        4 4
        1 1

  10. Hi , i am looking formula to rid of all the duplicates & the originals in comparision data . some duplicates starts with "."
    Just example

    Existing:
    a123.com
    .a123.com

    Comparing with
    a123.com

    I need to remove all "a123.com" . i have sheet of of 10000+ in existing & comparing have "2000+" .
    how to remove the duplicates even it have "." in starting .

    i am using the formula of -=IF(COUNTIF(A:A,A2)=1,0,1). it detecting the exact duplicates but not catching any thing with "." in starting.

  11. Hi Alexander,

    I'm trying to create a formula for this scenario. I have two columns, in each column there are only two texts that can be selected from a drop down (I'll call them "Text123" and TextABC"). I would like to create a formula that counts the total results for each for both columns, however, if "TEXT123" was selected in row 1 for both columns 1 & 2, I would only need to count it as one, not 2. How do I create a formula telling excel to count it only once per row, but for two columns total.

    Thanks so much in advance.

    1. Hello!
      If I got you right, the formula below will help you with your task:

      =SUM(--(A1:B10="TextABC"))+SUM(--(A1:B10="Text123"))-SUM(--(A1:A10&B1:B10="Text123Text123"))

  12. Hi Alexander,

    My spreadsheet is quite simple, it has 3 columns.

    Column one has type of activity. (for ease of use, we can say Walk, Run & Swim)
    Column 2 has only 2 options "1st Pass" or "Not 1st Pass".
    Column 3 has a date.

    I need to have a count depending on the month & year.

    I can get each activity & whether its 1st pass or not 1st pass. Input is from Row 3 downwards.
    My problem is when I am trying to choose month = 8 & year = 2021.

    Formula just on basic Walk * 1st pass is =COUNTIFS(Applications!$A$3:$A$974,"Walk",Applications!$B$3:$B$974,"1st pass")

    I have a table which splits each activity (rows) and months (columns). I would like to return the count of 1st pass walks in each month & year? I have used Month & Year function with SUMPRODUCT, but they seem to cause issues with COUNTIFS.

    I was trying (year I am wanting to use is in C1 so I can change review previous years- in below formula looking for August in the year provided in cell C3):

    =COUNTIFS(Applications!$A$3:$A$974,"Walk",Applications!$B$3:$B$974,"1st pass",Applications!$C$3:$C$974,MONTH(Applications!$C3:$C974)=8,Applications!$C$3:$C$974,YEAR(Applications!$C3:$C974)=$C$1)

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =SUMPRODUCT(--(A1:A10="Walk"),--(B1:B10="1st Pass"),--( YEAR(C1:C10)=2021),--( MONTH(C1:C10)=8))

      If this is not what you wanted, please describe the problem in more detail.

      1. Thanks Alexander,

        I am looking to be able to return a result through countifs while searching for specific month & date within the range.

        Just say date values fill up cells A1:A10.

        How would I write a countifs formula searching for the month 8 (Aug) and year 2021?

        Thank you for your review.

        1. Hi!
          The COUNTIFS function compares each value in a range against a criterion. You are comparing a date with a month number. Therefore, your COUNTIFS formula will not work.

    2. Messed up down the bottom:

      I was trying (year I am wanting to use is in C1 so I can change review previous years- in below formula looking for August in the year provided in cell C1):

  13. Hello ,
    Can u help me to set the below formula
    =IF(B4:B30,"Purchase Invoice",COUNTIFS(K3:K30,"1-20"))
    Thanks in advance

    1. Hello!
      The IF function does not work with ranges. Please describe your problem in more detail. It’ll help me understand it better and find a solution for you.

  14. - C1 C2 C3 C4
    R1 Apr-21 Apple 10 Delivered
    R2 Apr-21 Bannana 15 Pending
    R3 Apr-21 Oranges 23 Delivered
    R4 May-21 Apple 12 Pending
    R5 May-21 Apple 45 Delivered
    R6 May-21 Bannana 27 Cancelled
    R7 May-21 Oranges 24 Pending
    R8 Jun-21 Apple 11 Cancelled
    R9 Jun-21 Apple 10 in Transit
    R10 Jun-21 Bannana 26 Cancelled

    need to filter in c1 ( apr, june), then c2 (oranges, apple), then c4 (delivered, pending); the answer should be 2

    I need countifs in single formula for above; please advise

    1. Hello!
      I believe the following formula will help you solve your task:

      =SUMPRODUCT(--(MONTH(A1:A10)=4)+(--(MONTH(A1:A10)=6)),(--(B1:B10="Apple")+(--(B1:B10="Oranges"))),--(D1:D10="Delivered")+(--(D1:D10="Pending")))

      You can learn more about SUMPRODUCT function in Excel in this article on our blog.

  15. Hi, I am trying to count the number of times a two separate strings of text appear in a column that also fall between two dates. I can get it to work if only looking for one string of text but am unsure how to look for two or more.

    For example in my 'D' column I am looking for the number of times the text 'S05' appears if it falls between the dates 01/04/2019 and 01/04/2020 in column 'F'. The formula I currently have for this is:

    =COUNTIFS($D$10:$D$32981,"S05*",$F$10:$F$32981,">=01/04/2019",$F$10:$F$32981,"<01/04/2020")

    This works but I'd also like it to count the number of times the text 'HINGED5' appears in column 'D' at the same time. Are you able to assist?

    1. Hello!
      If you want to use OR logic, try this formula

      =COUNTIFS($D$10:$D$32981,"S05*",$F$10:$F$32981,">=01/04/2019",$F$10:$F$32981,"<01/04/2020") + COUNTIFS($D$10:$D$32981,"*HINGED5*",$F$10:$F$32981,">=01/04/2019",$F$10:$F$32981,"<01/04/2020")

      If you want to use AND logic, try this formula

      COUNTIFS($D$10:$D$32981,"S05*", $D$10:$D$32981,"*HINGED5*", $F$10:$F$32981,">=01/04/2019",$F$10:$F$32981,"<01/04/2020")

      This is described in the article above.

      1. Thank you. I did try that formula after reading the article the first time but couldn't get it to work so I must have mistyped something. This is working perfectly for me know, much appreciated.

  16. Hi, I need to work out a formula for the following:
    I have 5 rows with different info...
    A1 = date, A2 = name, A3 = description, A4 = shop, A5 = amount.
    Now I have to add the total spent for each name and for different expenses.

    For instance, Sam has spent P500 on employment cost, P200 on production cost and P3000 on capital investment

    Sarah has spent P1000 on employment cost, P200 on production cost and P3000 on capital investment.

    Now I have to calculate only employment cost and production cost for Sarah and then seperately for Sam as well.

    How do I go about? Please help.....

    Regards

  17. Hi, I am trying to use the COUNTIFS function as below...
    Column A "start date", I want it to count all dates before 01/04/2021 but then also count in Column B "end date" all dates after 01/04/2021, there are 5 in my test sheet but it's only pulling two when I use this formula =COUNTIFS(Participants!A:A, ""&"1/4/2021")
    I need it to first count those who started before 1st April 2021 then out of those how many finished after 1st April 2021 - please help!

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =COUNTIFS(A1:A6,">"&"1/4/2021",B1:B6,"<"&"1/4/2021")

      If this is not what you wanted, please describe the problem in more detail.

  18. Hi,

    I have a spreadsheet containing tasks and the percentage of completing each task, I am trying to get the number of tasks which 100% completed using function CountIFS as following
    =COUNTIFS(B5:D47,"*leak test*",F5:F47,"=100%")

    each time doing that I got error #VALUE! , So Could you Please Help, Note: leak test is a repeated task

    thanks

    1. Hello!
      The ranges in which the COUNTIFS function checks for values must be the same size.
      Change B5:D47 to B5:B47, C5:C47, В5:В47 .
      Pay attention to the following paragraph of the article above — Count cells with multiple criteria (OR logic)

  19. Good day! is it possible to count data in a single criteria with multiple data inputted in a cell?

    Example:
    Column 1: Gadget Ownership
    Cell 1: Laptop, Desktop
    Cell 2: Smartphone, Desktop

    1. Hello!
      I’m not sure I got you right since the description you provided is not entirely clear. However, it seems to me that the formula below will work for you:

      =SUM(--ISNUMBER(SEARCH(D1,A1:A20,1)))

      D1 - criteria

  20. I have Yes/No in a column. I want to count all "No" till it encounters the first "Yes".Please help

    1. Hello!
      If the records in the column start at row 1, then try the formula

      =MATCH("Yes",D1:D1000,0)-1

      You can learn more about MATCH function in Excel in this article on our blog.

  21. I want to ask how if I need to find 2 criteria on 1 range, example: I have data apple, banana, grape, coconut and I need to count apple and coconut in 1 row

    1. Hi,
      Have you tried the ways described in this blog post? Pay attention to the following paragraph of the article above — How to count cells with multiple criteria (AND logic)
      The formula will be something like this

      =COUNTIFS(A1:A10,"apple",B1:B10,"coconut")

      This should solve your task.

  22. Hi, please advise how to use countif formula if figures are in time
    Example : Total 10:26 9:54 10:15 9:21 9:30 9:55 00:00 00:00 9:39 4:15 9:28 9:57

    Now i have to calculate in above data figures less than 7:00

  23. I am trying to use function countif with greater than or equal to criteria in a particular list.
    e.g there are 70 numbers in a list. Criteria checks numbers less than 50, 50 to 100, 100 to 150, 150 to 200 and above.

    Now from the same count, i want to search the maximum and minimum number from same.

    Please help on this.

    1. Hello!
      You can use the COUNTIFS function as described in the paragraph above: How to count numbers between 2 specified numbers. Then use the MAX function to find the largest number.
      Also you can do calculations with one array formula and FREQUENCY function.
      I hope I answered your question. If something is still unclear, please feel free to ask.

  24. =COUNTIFS(DB10,"",DG10,"") does not work. I see your examples have ranges but in my situation I need a formula to only count specific cells with a date, not through a range. My understanding is counting cells with different dates can be an issue because the dates are numbers and text so I use anything. works in a range with dates in some cells and no dates in other cells and nothing else.
    What I am trying to calculate, in a very basic way, is the number of cells with a date.

    Thank You

    1. Hi!
      Dates in Excel are stored as numbers. If you write down the date as text, you cannot perform any calculations with it.
      Here is the article that may be helpful to you: COUNTIF formulas for dates.
      For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result.
      It’ll help me understand it better and find a solution for you.

  25. How would I count instances of values over a range where a cell contains multiple values? I'm collecting data from a Forms for Excel survey where it separates multiple choices as "Choice A;Choice B; Choice D; All of the above"

    Is there a version of COUNTIFS that will read that range and count instances of just one of these, when the cell may contain more than one? I guess I want this to work kind of like the Find All function

  26. Thanks Alexander for your reply.

    The error I get is

    https://support.content.office.net/en-us/media/38b1b648-6844-4b27-80db-638e4b8f225c.png

    The formula I'm using is the one I put in my original post above and there are no semicolons in sight. I'm not sure what you mean by "...what sort of quotes are you using." All I can say is the quotes are those used in the aforementioned formula which again is

    =SUM(COUNTIFS(B$5:B49,("RICHARD","ALAN")))

    I hope this clarifies things and I look forward to your suggested solution.

    Many thanks

    1. Hello!
      If you specify 2 criteria for COUNTIFS, then you need to do this as described in this manual.
      Or you can write these criteria as an array.

      =SUM(COUNTIFS(B$5:B49,{"RICHARD","ALAN"}))

      I think that was your problem.

  27. Hi

    I'm having difficulty with one of your suggested formulas and in particular one which is covered under heading

    https://www.ablebits.com/office-addins-blog/excel-countifs-multiple-criteria/#count-cells-multiple-criteria-OR-logic

    and sub heading.

    Formula 2. SUM COUNTIFS with an array constant

    The formula is 'SUM(COUNTIFS(range,{"criteria1","criteria2","criteria3",…}))' and it just isn't working for me. I keep getting a warning that it isn't a valid formula.

    Is there a minimum Excel version that this only works with?

    I'm sure I'm applying it correctly but just in case I'm missing something I have a table 49 rows high and column B contains a list of 6 different names which appear randomly and are repeated randomly. Two of the names are Alan & Richard who both appear numerous times so I created the following formula to count the rows that contain either

    =SUM(COUNTIFS(B$5:B49,("RICHARD","ALAN")))

    But, this doesn't work. Please let me know what I'm doing wrong.

    Many thanks.

    1. Hello!
      This function is available since Excel 2007. Please describe your error in more detail. Your Windows may not be using a comma as the list separator, but a semicolon. Also note what kind of quotes you are using.

  28. =COUNTIFS('Loading Summary'!A:A, B3, 'Loading Summary'!E:E, "*Y*") This works,

    but this doesn't work =COUNTIFS('Loading Summary'!A:A, B3, 'Loading Summary'!E:AH, "*Y*")

    I want to give the range from Column E to Column AH to check if there's letter "Y" for a specific Unique ID in Column B3 and count how many are there

    1. Hi!
      Pay attention to the following paragraph of the article above — Excel COUNTIFS - things to remember. It contains answers to your question.

  29. Hi, I realized I have exactly the scenario that can't be covered by COUNTIFS (point 2 under Things to Remember): "Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument)."

    Illustration for simplicity: Col A has country values. Col B to D have 3 survey question responses.

    With a simple COUNTIF, I can count how many "Strongly Agree" from B to D.

    But I'm trying to those who "Strongly Agree" from "USA" only.

    The naive way is to expand Country to 3 columns so that the range matches, but is there a better way? Also, I'm dealing with..... OMG about 100 columns PER question. My column names are in the triple alphabets!

  30. Which formula do I use if I want to count the number of entries in one column that refers to a specific month (e.g. how many entries for the month of March) that also has an entry (of any written text) in another column (this will be a column that refers to a specific behaviour but could be varied for each row e.g. physical aggression in one row but verbal aggression in another row)?

    Hope you can help.

    1. And to clarify a bit further, I do not want to know how many physical aggressions or verbal aggression entries there are individually but just how many entries appear in that column for a particular month altogether.

  31. Hello, and thank you in advance for your help. I need to collate from a data set of a calling center the following:
    1. Branch
    2. Month
    3. Call outcomes collected 8 colums (I,L,O,P, Q,R,S,T). There are 12 different call outcomes eg (didn't answer, person not in, etc) so, the report tells me:
    In April, Branch "A" reported that 10 calls weren't answered, 5 the person wasn't in and so on
    I have tried COUNTIFS but does not do the trick... I get VALUE error. Is this because one criteria is counted several times in different columns some of which are adjacent? or this is not the formula i should use?
    I hope this makes sense, thank you!

    1. Hello!
      Without seeing your data it is difficult to give you any advice. If I understand your task correctly, pay attention to the following paragraph of the article above — Add up two or more COUNTIF or COUNITFS formulas.
      If this advice does not help, write what formula you use and what exactly you want to calculate. It’ll help me understand it better and find a solution for you.

  32. Hi there,

    I am having a dataset of people contacting me with Hours of the day (ColA), Date (ColB). Now I want to create a table where I will see how many times in that hour someone contacted me so I can create a hit map. I am quite struggling with what formula to use which will return the number of a contact in that hour of the specific day. Any help?

    1. Hello!
      If you want to get a list of contacts for a specific day and hour, then use the FILTER function. Read this detailed guide.
      If you want to count how many times a person has contacted you at a certain time, then use the COUNTIFS function. Read this article above.

  33. If I have a sheet that contains dates in Column B (Heading row for Column B has a start date in B1 and End date in B2) and multiple other columns, one (Column L) contains specific words.
    How can a count the number of specific words, in Columns L that fall between 2 dates in Column B?

    For example I have dates from January 1 to March 31 in Column B. I have the word Weston in Column L multiple times. I want to find out how many times Weston between between January 10 to January 16.

    I've tried Countif, Countifs, if(and, if(or, nested if. I am pretty good with excel and teach it, but this one is stumping me.

    Sylvia

    1. Hello!
      Please use the following formula/the formula below to solve your task:

      =COUNTIFS(B1:B10,">="&DATE(2021,1,10),B1:B10,"<="&DATE(2021,1,16),L1:L10,"Weston")

      Read this tutorial on how the COUNTIF function works with dates.

      1. Thank you very much. This had been a great help. I will be definitely be referring back to you if I have any other questions.

  34. I am using a COUNTIFS function to build a report but need one of the many criteria to be a calculation. Specifically I need one of the criteria to count if the Completion Date column is a date after the Due Date column. The formula will be modified to also count when Completion Date ">10" days after Due Date to be counted. How do I embed this calculation comparing dates in a COUNTIFS function?

    It is a large data set of over 1,000 rows and it is for a daily report, so row numbers vary daily but column headings do not change. The dashboard tab is where the formula will reside but the COUNTIFS function pulls from different tabs in same spreadsheet if that matters.

    Thanks!

    1. Hello!
      Unfortunately, without seeing your data it is impossible to give you advice.

      I'm sorry, it is not very clear what result you want to get. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.

      We'll look into your task and try to help.

  35. Hello,

    I'm pulling my hair out. I'm trying to count the number of cells where one range contains specific text and another range is less than today's date. I need both conditions to be true before the cell can be counted. The formula below is not working. Should I use a function other than COUNTIFS?

    =COUNTIFS(C6:NH6,"*-B*",C3:NI3,"<"&TODAY())

    1. Hello!
      The ranges of criteria in the COUNTIFS function must be the same size. For instance:

      =COUNTIFS(C6:T6,"*-B*",C3:T3,"<"&TODAY())

  36. Hello - I am currently using this formula to search for a single value in a range of cells:
    =IF(COUNTIF(AS2:AU2,"*" & "Help Center" & "*"),"True","False")

    However, rather than matching to a single value of "Help Center" with wild card existing anyplace within AS2:AU2, I want to search for multiple values so I don't have to repeat the search multiple times. The values I want to search for are:

    Help Center
    helpcenter

    Can you help?

    1. Hi,
      I’m sorry but your description doesn’t give me a complete understanding of your task. Correct me if I’m wrong, but I believe the formula below will help:

      =IF(COUNTIF(AS2:AU2,”*” & A1 & “*”),”True”,”False”)

      After that you can copy this formula down along the column.
      A1 -- Help Center
      A2 -- helpcenter etc.
      If this is not what you wanted, then describe the problem in more detail.

      1. Thanks for the response. This is a long spreadsheet that gets sorted frequently or filtered. Ideally the search values would be on another tab, and not added into a row on the current tab.

        Something like this, with a filter:
        =IF(COUNTIF(AR2:AT2,"*" & !Filter,C1:C7" & "*"),"True","False")

        I also tried this, but it gives a Spill error:
        =IF(COUNTIF(AS2:AU2,"*" & {"Help Center","groups.xxxx.com","https://xxxxx.service-now.com/sp","helpcenter","help.xxxx.com"} & "*"),"True","False")

        For example, I have this forumula in another column, and tried to use a similar filter condition with the other command, but can't get it to work.
        =IF(ISERROR(VLOOKUP(T2,Filter!$A$2:$A$100,1,FALSE)), "NO","Collaboration")

        Is there a way to use countif with wild card and referring to a list of values on another tab?

        Thanks again!

        1. I think I just got it! Thanks so much:

          =IF(OR(COUNTIF(AS2:AU2,"*" & Table1[Portals] & "*")),"Out of Scope","False")

  37. ok, so im trying to figure out how to add 2nd variable onto my formula to count them both. but i cant get anything to work.

    =COUNTIFS(DUE!A:A,"DLA",DUE!C:C,"250",DUE!N:N,"V")

    now this currently works, but i also want to add Y that is also in the same column as "V"

    any help would be greatly appreciated

  38. I need a formula to count if columns A, B, C, OR D have "*apples*" AND column E is not blank.

    1. Hello!
      If I got you right, the formula below will help you with your task:

      =SUM((ISNUMBER(SEARCH("apples",A1:A10,1))+ISNUMBER(SEARCH("apples",B1:B10,1))+ISNUMBER(SEARCH("apples",C1:C10,1))+ISNUMBER(SEARCH("apples",D1:D10,1)))*NOT(ISBLANK(E1:E10)))

      I hope my advice will help you solve your task.

  39. Hi, I doing a sale excel were I need to count all the same product multiply by the amount of order.

    Order product
    2. Apple
    3. Orange
    1 apple

    Were apple should be 3

  40. Hi,

    Thanks for this article. My problem now is it doesn’t count when one cell has the same text, especially two names of the same person.

    The text goes like this:

    G2:G10 = James
    G11:G20 = James Pattinson

    Formula:

    =(COUNTIFS(F:F, $K$5, G:G,{"James", "James Pattinson"},D:D,"Done"))

    The formula refuses to count cells that have the same first keyword. Please advise on how to solve this.

    Paul

    1. Hello!
      I believe the following formula will help you solve your task:

      =SUM(COUNTIFS(F:F, $K$5, G:G,{“James”, “James Pattinson”},D:D,”Done”))

      or

      =COUNTIFS(F:F, $K$5, G:G,“James”&"*",D:D,”Done”)

      I hope my advice will help you solve your task.

  41. Hello,

    In the example "How to use COUNTIFS with wildcard characters"

    How would I count the number of "Mike" in column B when the date in C equals the date in D?

    Kind regards,
    Mitchell

    1. Hello!
      Please try the following formula:

      =SUMPRODUCT((B2:B10="Mike")*(--(C2:C10=D2:D10)))

      Hope this is what you need.

      1. Hello Alexander,

        Thanks for your feedback. Unfortunately I don't get the desired result, but a "value not available error".

        So what I'm trying to do:
        On sheet 1 I have information on deliveries. (suppliers (column N), promise dates(column G), actual delivery dates(column H), and many more)

        On sheet 2 I have listed all suppliers(column A) and added a column(B) with a formula which counts the number of times a supplier made a delivery =COUNTIF(Sheet1!$A$2:$P$268;A2)
        Now I want to add a column(C) which only counts the times this supplier actually delivered on the promise date.(Sheet 1, G=H)

        With your help I tried below formula, which returns a "value not available error".

        =SUMPRODUCT((Sheet1!$A$2:$N$268="A2")*(--((Sheet1!$G$2:$G$268:Sheet1!$H$2:$H$268))))

        Based on above information, is there a formula which can calculate this without adding columns to sheet 1?

        Kind regards,
        Mitchell

        1. Hello!
          I wrote this formula based on the description you provided in your original comment. Please note that if you’d provided me with the precise and detailed description of your task from the very beginning, I’d have created a different formula that would have worked for your case.

          =SUMPRODUCT((Sheet1!$N$2:$N$268=A2)*(--(Sheet1!$G$2:$G$268=Sheet1!$H$2:$H$268)))

          I hope this will help

  42. Hi, I have a cell range with a start date and a cell range with an end date and I'm trying to use the TODAY function to return the amount of people within the two date ranges when I load the sheet - any idea?

  43. Hi, I am trying to set up a spreadsheet to check whether colleagues are completing specific tasks (that are recorded on a different spreadsheet), at least once within each 28 day period and to count how many of the task they did within the period. The best way I can think of it to to pull the count for each date and then have a separate tab that then works off that count to be certain the colleague is competent over the year. But I'm struggling to get the correct formula. What I need is: the count if column M on spreadsheet A is equal to cell A2 on spreadsheet B AND the date within column Q on spreadsheet A is equal to B1 on spreadsheet B - spreadsheet A being the one that contains the original data and spreadsheet B being the new one I am setting up. Is there any way to do this?

    1. Hello!
      Without seeing your data it is difficult to give you any advice. You have not specified what data you want to retrieve into the new table.
      Please check out the following article on our blog, it’ll be sure to help you with your task:
      Vlookup multiple matches based on multiple conditions
      You can also solve your problem without formulas using a pivot table.
      I hope I answered your question. If something is still unclear, please feel free to ask.

  44. Hello!
    Without seeing your data it is difficult to give you any advice. You spelled the COUNTIFS formula incorrectly. For each criteria, you need to specify criteria_range:

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

    I think you should use the COUNTIF function as described in this section above.
    I hope I answered your question. If something is still unclear, please feel free to ask.

  45. =COUNTIFS('C.O MONITORING'!X8:X992,"MOIA",'C.O MONITORING'!AE8:AE992,"BELLA")
    this is my old formula. counting the number of contracts executed by a certain person "Bella"

    for new formula
    I want to count the number of the contract executed by "BELLA" per months (with a specific date)

  46. Hi,

    I have data that shows me how many times different projects pass or fail, but I want to count how may times a project fails on different days, i.e. not to count it twice if it failed twice on the same day. See simplified data below; I want to return Project 101 as 'Failing' 3 times, i.e. on 3 days, not 4 individual occasions.

    A B C
    Date Project Result
    01 Jan 101 Fail
    01 Jan 101 Fail
    02 Jan 102 Fail
    02 Jan 101 Fail
    03 Jan 101 Pass
    03 Jan 101 Fail
    04 Jan 103 Pass

    Thanks in advance
    Paul

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =IFERROR(ROWS(UNIQUE(FILTER($A$1:$A$8, $B$1:$B$8=$D$1))), 0)

      where $D$1=101.
      You can learn more about count unique values with criteria in this article.
      I hope it’ll be helpful.

  47. I'd appreciate any help or insight.

    Use Case: Get count of multiple criteria from different columns

    Criteria1: =COUNTIFS('Sales Report'!$G:$G,"Damy Dams",'Sales Report'!$H:$H,"Nov",'Sales Report'!$I:$I,{"Movies","Music"}),

    Criteria 2: 'Sales Report'!$E:$E, {"Offline","Onsite","Podcast"})

    My formula returned the count for Criteria 1 BUT does not return the count for Criteria 2

    How can I combine all into one statement?
    For example: =SUM(Criteria1,Criteria2)

    AND NOT

    =SUM(Criteria1+ SUM(COUNTIFS(Criteria2)…. this gives a much higher count value and is not the requirement.

    1. Hello!
      Use the formula for Criteria2

      =SUM(COUNTIFS('Sales Report'!$E:$E, {“Offline”;”Onsite”;”Podcast”}))

      I hope it’ll be helpful.

  48. Assuming I have a table with two columns J and K with entries of rows either, row1 ,(J=No,K= Yes), row2(J=yes,K=No), row 3 (J=Yes,K=Yes) ROW 4, (J=No,K=No), row5 ,(J=No,K= Yes), row6 (J=yes,K=No), row 7 (J=Yes,K=Yes) ROW 8, (J=No,K=No),...onwards for different documents.
    Whenever a No appears on either column J or K or both columns it should be termed error. What formula can I use to help me analyze a large data with the above scenarios. Analysis can be done on another sheet.

    1. Hello!
      If I got you right, the formula below will help you with your task:

      =IF((COUNTIF(J:J,"No") + COUNTIF(K:K,"No"))>0,"Error","Ok")

      I hope my advice will help you solve your task.

  49. I'm trying to do countif to get results from different cells not ranges.

    A1 table
    A2 chair
    A3 table
    A4 leg

    I basically need countif (A1,A3, "table") but that doesn't work.
    I've tried this indirect formula but it still doesn't work =SUM(COUNTIF(INDIRECT({"a1:a1","a3:a3"}),"table"))

    Any ideas?

    1. Hello!
      The COUNTIF function can only work with one range. Therefore your formula is not possible. Try

      =SUM(--(A1="table"),--(A3="table"))

      I hope it’ll be helpful.

  50. I have to calculate attendance for 5 periods in different sheets. Using countif how can i calculate attendance

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 :)