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 50. Total comments: 2055

  1. Excellent information dear...!
    This information made my day.
    Once again, thanks a lot.

  2. Hi,

    i want to count if the column contains a date(unconditioned)

  3. found the answer. I need to test criteria on each and sum:
    =COUNTIFS(date1,text)+COUNTIFS(date2,text)+...+COUNTIFS(daten,text)

  4. Evening Svetlana,
    I have used your posts many a time to gain answers for my questions and until now was always able to find an answer. I have an issue that I cannot figure out. What I am looking for is a way to count the number of records that meet multiple criteria. My issues comes when adding in the multiple fields. I have a project list with Start dates, Team name, Department and Type of project. Above that I have a list of the start and stops for each week of the year.
    What I am trying to do is count the records where the start of the project is between the start\stop date for the given weeks but only when the project team is a given name (Blue, or Green) or the Department is a given name (SRT). The fields are exclusive but complimentary so I need to add an "or" statement but cannot get it to work.

    1. Hi Thomas,

      To count with the OR logic, you need to add several SUMIF or SUMIFS functions, for example:

      =COUNTIFS(A2:A10, ">=start date", A2:A10, "<=end date", B2:B10, "team1",) + =COUNTIFS(A2:A10, ">=start date", A2:A10, "<=end date", B2:B10, "team2",)...

  5. My example was cut off, let me try again...

    If Text = "Major"
    and Date GE lowerLimitDate
    and Date LE upperLimitDate then count it.

    Henry

    1. Hi Henry,

      You can use a formula similar to this:

      =COUNTIFS(Table1[text], "Major", Table1[date], ">4/10/2015", Table1[date], "<4/20/2015")

      Where [text] is your Text column, [date] - column with dates, 4/10/2015 is lowerLimitDate and 4/20/2015 is upperLimitDate.

  6. Great article; maybe you can help me. I have a named table with over two dozen date columns and one column of text.

    I want to count the number of dates within a date range and that have a specific text value

    date1 date2 ... date26 Text

    Logically this would be:

    If Text = "Major" and Date = upperLimitDate then count it.

    I can't get COUNTIFS to do this.

  7. PLZ REPLY FAST

  8. i have a sheet in which a column shows percentage of attendance i have to provide the formula for next column to give the values for the percentage..for example
    if the student have percentage in between 75 to 80 i have to give 01 marks and 81 to 85 then 02 marks ,86 to 90 03 marks etc.the how to write formula?

  9. Is there a way to combine a COUNTIF with a MIN function? I have three different amounts for each client, and I need a count for how many times the first value was the least of the 3, how many times the second value was the least of the 3, and how many times the third value was the least of the 3. Any help is greatly appreciated.

  10. Hi There,

    I am not able to find the right countif formula to count "AA" in next column with reference to another column!! For example in Column 1 I have different Cable types and in next four columns whether is applicable or not I had mentioned with AA, BB, CC, DD. Here I have to count how many "AA" are available against one type of Cable. Could any one please help me out??

    1. Hi Kardon,

      If column 1 (let's say column A) contains unique cable types only, i.e. a single record for a certain type, you can use the following formula:
      =COUNTIF(B2:F2, "AA")

      Where columns B - F contain AA, BB, CC, DD. The formula counts the number of AA in each row.

      If you have multiple instances of the same cable type in column A, then the best solution I can come up with is this lengthy formula:

      =COUNTIFS(A2:A8, "cable1",B2:B8, "AA") + COUNTIFS(A2:A8, "cable1",C2:C8, "AA") + COUNTIFS(A2:A8, "cable1",D2:D8, "AA") + COUNTIFS(A2:A8, "cable1",E2:E8, "AA") + COUNTIFS(A2:A8, "cable1",F2:F8, "AA")

      Where "cable1" in the cable type, 2 is the first and 8 is the last row with data.

  11. Hi There

    I was wondering if it was possible to have 3 COUNTIFS formulas in one cell?

    1. Hi Jake,

      It is not possible to have several different formulas in one cell. However, you can put 3 different conditions in 1 COUNTIFS formula.

  12. I'll explain what I have:
    I created color function to count cells with certain color and now I want to count celles that has value and certain color at the same time

  13. hi, i need your help:
    can i incloCan I include function within the COUNTIFS function like the following example:
    =COUNTIFS(D4:AH4,"COUNTA(D4:AH4)")
    It does not give me correct answer. Please help me.

    thank you.

    1. Hi Ghazi,

      If you are looking for a way to count non-blank cells in D4:AH4, you can use the following formula instead:
      =COUNTIF(D4:AH4,"<>"&"")

  14. Hello again Svetlana,

    Apologies. I neglected to type the words "Inside" and "Outside" in full within the formula in my last post. Sorry!

    Regards,
    Leela.

  15. Hello Svetlana,

    I'm not sure if I can use COUNTIF/COUNTIFS for my following query. Perhaps the solution may be SUMPRODUCT as I have tried. I'll wait for your advice.

    I have a column (A) going down 1000 rows. Each cell has either "Inside" or "Outside" typed in them. The next column (B) has dates in each cell (also going down 1000 rows). I need to search Column A and if the cells contain the word "Inside" or the word "Outside", total the number of dates in Column B that are less than or equal to(<=) Today(). There will occaisionally be blank cells in Column B. I have come up with this formula but it still counts the blank cells in Column B :-

    =IF(ISBLANK(A:B),"",SUMPRODUCT((B:B<=TODAY())*(A:A="In")+(B:B<=TODAY())*(A:A="Out")))

    Greatly appreciate any help.

    Regards,
    Leela.

  16. Long story short, thank you, Svetlana, for this post! Your explanation and examples using COUNTIFS were just what the doctor ordered!!

  17. Hello!
    I have two columns I have to match. I thouught I can use COUNTIF function to calculate the frequencies from column B matching it to a value in column C (as there are more then one values in column C, so I have to choose to calculate the frequencies of each of them separately). How do I do that? I tried all the combinations but I don't think I understood the above explaination correctly.

  18. Hi,

    I have 3 columns containing the following info regarding subscription period to a website: User, Service Start Date, and Service End Date, with the dates ranging from 2013 to 2016. I'm having some trouble using both COUNTIF and COUNTIFS to get how many Users (A2:A617) are active on a particular period (e.g. Jan-2013 has 21 active subscribers, Feb-2013 has 24, etc.).
    I would really appreciate your help.
    Thank you.

  19. Hello,

    I have two sheets. One is called "Rollup" and the other is called "Data". On the "Rollup" sheet, I am using column "E" for my formula and what I'm trying to do is count anytime whenever the name in column "B" of the "Rollup" sheet appears in D2:D39228 of the "Data" sheet. So, on the "Rollup" sheet for example, cell E2 will have a COUNTIF formula that asks how many times the name in B2 of "Rollup" sheet appears in D2:D39228 of the "Data" sheet. Does that make sense?

  20. Hi there. I need help with Countif. So I have two columns, both are dates.

    1. Target Award Date
    2. Actual Award Date

    I need to count how many actual award dates were before the target.

    For example.
    Target Award Date is 2/10/2015
    Actual Award Date is 2/8/2015
    This should be counted

    If the Target Award Date is 2/11/15 and actual award Date is 2/15/2015, then it wouldnt be counted.

  21. Part code Qty
    1 12 Part number '1' total-
    2 85 Part number '2' total-
    1 47 Part number '3' total-
    4 69 Part number '4' total-
    3 32
    1 12
    4 45
    2 12
    3 36
    1 58
    4 51
    2 78

    Please help in summing the total of each part number...

  22. i have a range of data from A2:A308 i want to place a criteria that if the data in the range falls less than 8 it should display primary if greater than equal to 8 and less than 13 it should display secondary and if greater than equal to 13 it should display tertiary

    1. Hi Zeta,

      I think this will help...
      =IF($A1=13,"Tertiary","Secondry"))

      1. =IF($A1=13,"Tertiary","Secondry"))

  23. i have a problem
    that is i have a range of data from A2:A308 i want to place a criteria that if the data in the range falls =8 and =13 it should display tertiary

  24. Greetings from South Africa!

    I am creating a database to count four different types of clinical personnel receiving training on medical male circumcision. Information will produce two basic spreadsheets. One counts the number of trainees per training type (8) and segregating each clinical personnel type per month (1,350 cells). The other segregates each clinical personnel type and training received per province (state) (9,350 cells) Thanks to information from your website I created formulas that are working, but my question is how can I copy and paste the formulas that automatically change the month I want to capture. An example is below where 01 represents January. How can I copy and paste the formula setting the month to change automatically to 02, 03, etc?
    =COUNTIFS($A$25:$A$5000;"01";$G$25:$G$5000;"D";$I$25:$I$5000;"S";$L$25:$L$5000;"EC"&"")

    Thousands of Thank yous if you can help.

  25. Hi,

    A B E F
    1 Santosh 10 Raj
    2 Raj 5 Sajan
    3 Sajan 8 Ankit
    4 Ranjan 9 Tara
    5 Sameer 10
    6 Priyanka 4
    7 Ankit 8
    8 Tara 6

    in the above spread sheet there is some names from A1 to A8 consequent the figures on B1 to B8,

    My question is Cell E1,2,3,4 i mentioned few names in jumbling way ok, if those names are in the list of A1 to A8 then i want the consequent figure (which mentioned at B1 to B8) to be visible @ F, ok

    guide me with the formula...............

    1. Here you go...

      if you want name with consequent figure..
      =IF(ISERROR(VLOOKUP($C2,$A$2:$A$9,1,0)),"",$C2&VLOOKUP($C2,$A$2:$B$9,2,0))

      If you only want the figure then...
      =IF(ISERROR(VLOOKUP($C2,$A$2:$A$9,1,0)),"",VLOOKUP($C2,$A$2:$B$9,2,0))

  26. Hi. I have an excel spreadsheet with first names in column A and last names in column B and other information in columns C and on. I access and change this file daily. I need to know when a specific person shows up 6 or more times and then I have to move the data to another sheet. I already have it sorted by last name, column B, but I still have to go through and count each individual name to make sure there are 5 or less or I have to move them. Is there a way to use COUNTIF(S) to let me know if there are names that appear more than 5 times and maybe even what the names are? I have to go through this process every day and it would save me a lot of time looking through the 800 rows.

  27. Hello Svetlana, I really hope there is an answer to this I've tried several ways but it doesn't seem to work. Assuming I have data in A1:A3 and the data totals are in A4 & A5. The data that needs to be added across for example are 2/2, 3/2, 4/1; the left number is the attendance for adults and right side are the children. The data total for A4 would = 9 and A5 = 5. Does it matter if the data in one cell is seperated by either symbol? Ex. 2/2 or 2:2 or 2+2? I need HELP how to add the data across but keeping left side total from right side. Is there a simple solution?

  28. Recipt Credit
    Cash Book Bank

    564 914308
    30,000 30000
    30000 4654
    43660 30000
    1245247 19344
    30000 465654

    I want to know matching values in col a & b
    e.g there are 2 values (30000) in col b
    it should show corresponding 2 values in col A & not 3
    values as appeared in col a

  29. Recipt Credit
    Cash Book Bank

    564 914308
    30,000 30000
    30000 4654
    43660 30000
    1245247 19344
    30000 465654

  30. ok i am trying to make spread sheet that tracks the units average score for said events, but I don't wont to enclude the certain personal that are on a profile preventing them to take a certain event.

    So I guess the question is there a way to put an AVERAGE Formula and a COUNTIF Formula in the smae cell, in order track all this type of information or am I too far out in Left Field this function is impossible?

    Thanks for your time and answer/assisstance with this issue I have.

  31. If
    Names Sales Profit
    Kim 100 10
    John 250 25
    Tim 300 30
    Tom 325 33
    Sheetal 350 35
    Nidhi 375 38
    Shyam 400 40
    Rahim 425 43
    Ali 375 38
    Sheetal 325 33
    Tom 275 28
    Seema 225 23
    Tom 175 18
    Kim 150 15
    Sheetal 200 20
    John 250 25
    Tim 300 30

    How use 'countif'formula for
    Q : Excluding Kim there are how many people in the list?

  32. Hi!

    How can I use countifs and vlookup together?

    Thank you.

  33. Excellent! Thanks for the clear explanation. This really helped.
    H

  34. Hi Alexander,

    I guess even my query has been missed out. 176 is my number. So please if you can help me out.

    Thank you.

  35. I have two columns, column 1- Dates, column 2- Names.
    01/02/2015 ARYA
    01/02/2015 ARYA
    01/02/2015 ARYA
    02/02/2015 ARYA
    From the above example, I want the count to reflect 2, in other words I would want it to count as a single occurrence per day i.e., 01/02 - one occurrence & 02/02 one occurrence. Please help me with this. Please help me without date ranges as i need to use it for the entire year for different names.

  36. Hello there, I hope you can help with the following worksheet with multiple tabs.I Maybe COUNTIF could work but i really can't figure it out how.

    Code Account Title Jan-05 Feb-05

    1000 Advertising $750,75 $-

    2000 Office Equipment $- $-

    3000 Printers $- $-

    1st- I would like to set the date in each column as 16Jan-15Feb, 16Feb-15Mar etc., so that it sums up the invoices amount for each code of only those dates, at the moment it only adds each full month, and i can't seem to find a way to change it without errors. This is how the formula is shown:

    =SUMIF('Itemized Expenses'!$J:$J;"="&($A6&TEXT(C$4;"mmm-yy"));'Itemized Expenses'!$E:$E

    2nd - I would like to add another formula to this, which also adds the amounts within those dates depending on methods of payment and display it in another column, that is the total paid in cash, total credit card, total direct debit, etc.
    Thank you very much in advance for your help.
    Lotus

  37. I am ubable to count below data

    Name Time
    A 12:03:00 PM
    B 12:17:00 PM
    C 12:00:00 PM
    D 12:44:00 PM
    E 5:01:00 PM
    f 12:21:00 PM
    A 12:03:00 PM
    B 12:17:00 PM
    C 12:00:00 PM
    D 12:44:00 PM
    E 5:01:00 PM
    f 12:21:00 PM
    A 12:03:00 PM
    B 12:17:00 PM
    C 12:00:00 PM
    D 12:44:00 PM
    E 5:01:00 PM
    f 12:21:00 PM

    NAME Count
    A
    B
    C
    D
    E
    f

    Please help

  38. Thanks again Alexander.

  39. Thanks Alexander, but the formula counts empty cells also in the column. How to count only the cells with values, neglecting empty cells?

    1. =SUM(LEN(A2:A10)-LEN(SUBSTITUTE(A2:A10,",",""))+(--NOT(ISBLANK(A2:A10))))

  40. How do you count two different 'tasks' that are in the same column but only if they are marked 'active' in another column.

    I seem to have botched this up & have ended up with this mess:

    =COUNT((IF('Combined Project & Milestone'!F:G,"DESTRUCTIVE TESTING")),+OR((COUNTIF('Combined Project & Milestone'!F:G,"INITIAL REPORT")),+(COUNTIF('Combined Project & Milestone'!F:G,"Active"))))

    REALLY hope you can help soon.

    Thanks

    1. Please disregard the above - I worked it out.

  41. How to count the number of values in a cells separated with a coma.
    eg.
    1
    4,5
    6
    The number of values should be 4 in the 3 cells. Count function only counts 2 values.

    1. Please use this array formula (press Ctrl+Shift+Enter to complete it):
      =SUM(LEN(A2:A10)-LEN(SUBSTITUTE(A2:A10,",",""))+1)

      Where A2:A10 is your cells with data. Please note that the formula will return wrong results, if your cells contain some text, e.g. "1,text,text20"

  42. Hi,I Am making a file for my poject.I am facing the some problem in xls pls do help in that. I have to add the farmula that How may rows is on Time and Early only for NAGAR as given the example. total should be come in one cell for both On time+Early of the NAGAR name.

    NAGAR On Time
    RPRAD Early
    BBIAD Late
    CCUBG Late
    NAGAR On Time
    RPRAD Late
    BBIAD Late
    CCUBG Late
    NAGAR Early
    RPRAD Early
    BBIAD Early
    CCUBG Early
    NAGAR On Time
    RPRAD Early
    BBIAD Late
    CCUBG Late
    NAGAR Early
    RPRAD On Time
    BBIAD Late
    CCUBG Late
    NAGAR On Time
    RPRAD Late
    BBIAD Late
    CCUBG Late
    Thank you.

    1. Please use
      =countifs(A2:A1000, "NAGAR", B2:B1000, "On Time") + countifs(A2:A1000, "NAGAR", B2:B1000, "Early")

      1. Grate. Thank You.....

  43. Thanks Svetlana, you just saved my life and a lot of typing :) awesome post

  44. 1 JAMES SHJ MALE MALE FEMALE KIDS
    2 RICKY DXB MALE SHJ Formula ? Formula ? Formula ? 7
    3CHRISTINA SHJ FEMALE DXB Formula ? Formula ? Formula ? 2
    4 LIBA SHJ KIDS AUH Formula ? Formula ? Formula ? 2
    5 JOSEPH AUH MALE 11
    6 ZARINA SHJ FEMALE
    7 WINSTON DXB MALE
    8 JENNIFER SHJ FEMALE
    9 MINNU SHJ KIDS
    10 ARASH AUH MALE
    11 MAHIR SHJ MALE

    1. uum yeah, that was very clear how's going to Dubai and sharjah I suppose?

      1. Hello Eddie,

        I am sorry, your data look distorted in the comment. For us to be able to assist you better, please post a small sample workbook with your data on our forums and describe in detail what you want to count. We will try to help.

  45. I've been reading around and I apologize if I've missed this(the information has me a bit...confused and I overwhelmed)

    I am trying to keep track of some projects between me and a person.

    Under one column of cells I have the type of project and in another I have who did it.

    I have somewhere a list of how many of each TYPE of project is done and beside that who it was done by so I can keep track of the giant project list.

    So say...the C columne says "Project type 1" or "Project type 2" and the D column has "Done by Susy" or "Done by Dave"

    I was keeping track of "Project type 1" in one cell. So it's counting how many we did of that type very well.
    Then I did the same for Project type 2.

    But when I got to the point of: "Project type 1 done by Susy", I tried to put in a formula to count how many times Project1 was done by Susy and another counting how many times it was done by Dave.

    ...cept it doesnt work. And I'm not quite sure how to do it. I got confused reading the information because it seems to always be consistent info in different columns or different info in the same column and rarely did I find "Only count if both these conditions are met"

    Is that..even possible? Neither have value numbers. They use words rather than numbers(obviously they arent actually called 'Project 1' and '2'.

    Gah..just writing gets me confused.

  46. Hello, i thank you for helping others unconditionally. I have asked for help and posted twice. Number 177 is the only one i can find. I understand that you have extremely high traffic volumne. But i was just wondering if i am able to get help here or even my request for help is misssed. thank you again for the good works you are doing for all persons and society.

  47. I'm trying to calculate the total number of individuals who meet a certain criteria, but I can't seem to make the "COUNTIFS" formula fit what need. I have a column, EDU and here is some sample data. I want all data to count as 1 except "HS" which should not be counted. The purpose is to calculate the number of individuals who have post-HS education.

    Do you have suggestions on how to make the formula work with multiple conditions?

    EDU
    HS
    BA
    BS
    AA
    AS
    HS
    HS
    BA
    AA

    1. Hello Shannon,

      Please use the following formula:
      =COUNTA(A2:A20)-COUNTIF(A2:A20,"HS")

      Where A2:A10 is the EDU column

  48. Hi! For my previous question I get answer! But I have other one - if I want to count only "OK" results for IF function for example H7:H19, what function do I need to use?

  49. =IF(C7>0;"OK";"BAD") this one is working, but if I put region
    =IF(C7:G7>0;"OK";"BAD")or =IF((C7:G7)>0;"OK";"BAD") excel give me VALUE

  50. Hi,
    I'm trying to get excel to find numbers ending in a 7 (i.e. 47, 57, 67) and then need to tell the computer is raise the number to 47 to 50, 57 to 60 and 67 to 70. Please can someone help please?

    Thanks

    Sue

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