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 57. Total comments: 2053

  1. Hi all,

    I Believe someone can help me here. what i want is from few different cell, i want to select certain letters or numbers. and want to to be able to link to one cell where it
    collect the selected letters and numbers from different cell and show as eg. cell 4 = (12345GB).

    eg. cell 1 = 0012
    eg. cell 2 = 4434
    eg. cell 3 = Good Buy

    i hope this is clear. its just so as i am inputting data on other cells and it generates like a ref if you like on the cell 4 as i instructed.

    please help?

  2. Hi,

    I want to count 1 column of data (contains £££) if another column contains a specific word.

    Could you help?

    Thanks

    1. Hi RC,

      I am not sure I understand your task correctly. Anyway, if you want to sum cell in column A if a corresponding cell in column B contains a given word, you can use the following SUMIF formula:

      =SUMIF(B:B,"word",A:A)

  3. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    25
    64
    54
    654
    546
    40

    so how can find highest number in excel sheet

    1. Hi Zaheer,

      You can use the MAX function for this, e.g:
      =MAX(A1:A20)

      Where A1 is the first and A20 is the last cell in the range.

  4. as example,,in the first sheet as below,,,
    A B D E F
    CODE FILLING STATION K.M AMOUNT ALAWNS
    5347 FALAJ AL-QABAIL F/S 15 16.74 1
    5294 FALAJ AL-QABAIL T 16 23.02 1
    5365 FALAJ AL-QABAIL N 17 23.02 1
    5727 SHINAS F/S 12 24.7 1.5
    5124 SOHAR BEACH F/S 25 24.7 1.5
    5530 SOHAR TREEF F/S 25 24.7 1.5
    5336 AL-WUQAIBA F/S 28 29.3 1.5
    5054 SOHAR SINAIYA F/S 29 29.3 2
    5299 SOHAR F/S 29 29.3 1.5
    5442 HUMAIRA F/S 30 29.3 1.5
    5211 AQAR F/S 45 38.51 2.5
    5438 AQAR TWIN FjS 47 41.86 2

    in the second sheet will be like as below,,,

    J k L M N
    CODE FILLING STATION K.M AMOUNT Allowances
    5727 ? ? ? ?
    5442 ? ? ? ?
    5294 ? ? ? ?

    My question is ,,if i type the number which is i column "A" in the secound sheet in the column "J" how can i make a formula to get the information from
    column "B" ,"C" , "D" , "E" in the secound sheet in the column "K" , "L"
    "M" ,"N" , ???or whatever columns in any sheet even at the same one,,

    i hope my question clear to you

    Thanks in Advance

  5. Hi

    I am currently struggling with this - I need a formula that works out the oldest date in A that does not have a processed date in Q.

    I have a formula that works out A =MIN(Audits!A7:A3026)but cannot figure out the COUNTIF for the second criteria, does anyone know if I am on the right track with a COUNTIF or am I just doing this wrong?

    Regards

  6. Thank you for the details shared.
    I have 4 digit numbers like 1234,2345,2334, etc. i want to know when 4 comes as 4th digit which number comes mostly in 3rd digit as well as in the 1st and 2nd.
    there are thousands of numbers looking forward for your reply. it would help me a lot

  7. hello

  8. -----A----------B------------C------------D-----------E
    --CODE------LOCATION-------KM-----------COST--------EXTRA
    --100-------SOHAR---------50------------25-----------2--

  9. hi,

    can you help please,,,
    i have five columns with differents informations and want to get all in another sheet by using only code, example:

    A B C D E
    CODE LOCATION KM COST EXTRA
    100 SOHAR 50 25 2

    the information in the cells never change,,,can i make a formula ,when typing a code then get the other information in another 4 cells

    thanks

  10. Greetings,
    Maybe I missed the answer but need help in applying a formula to only count dates that are within the last year. My data is pulled from SharePoint Lists then using another tab I am able to count how many items are done based on each section (currently have 5 different sections)
    The formula I am using is:

    COUNTIFS(Table1[Section],”Section”,Table1[Safety],””)

    I would like it to only count the dates in Safety that are within the last year when the sheet is refreshed.

    Any help will be greatly appreciated.

    1. After safety I have between the quotes in the formula.

  11. I need to calculate following Commissions on Sales how can i put in Formula

    <=20,000 = 1000 (Fixed)

    20,000 to 50,000 = 4%

    50000 to 100,000 = 3%

    100,000 to 200,000 = 2.5%

    And

    200,000 and Above =2%

    Please help me ...

  12. Hi,

    I came across to this forum and it looks nice.
    I need your help in excel that would assign the same number in multiple rows example below.

    I need to do this in 58,000 plus records and really want to somehow automate the process.

    Col1 Col2 Results
    Kit 1 Kit 1
    Kit 2 Kit 1
    Kit 3 Kit 1
    Len 4 Len 2
    Len 5 Len 2
    Len 6 Len 2
    Len 7 Len 2
    Daddy 8 Daddy 3
    Daddy 9 Daddy 3
    Daddy 10 Daddy 3
    Amy 11 Amy 4
    Amy 12 Amy 4
    Amy 13 Amy 4
    Stephanie 14 Stephanie 5
    Stephanie 15 Stephanie 5
    Stephanie 16 Stephanie 5
    Mommy 17 Mommy 6
    Mommy 18 Mommy 6
    Mommy 19 Mommy 6
    Mommy 20 Mommy 6

    1. Col1 Col2 Results
      Kit 1 Kit 1
      Kit 2 Kit 1
      Kit 3 Kit 1
      Len 4 Len 2
      Len 5 Len 2
      Len 6 Len 2
      Len 7 Len 2
      Daddy 8 Daddy 3
      Daddy 9 Daddy 3
      Daddy 10 Daddy 3
      Amy 11 Amy 4
      Amy 12 Amy 4
      Amy 13 Amy 4
      Stephanie 14 Stephanie 5
      Stephanie 15 Stephanie 5
      Stephanie 16 Stephanie 5
      Mommy 17 Mommy 6
      Mommy 18 Mommy 6
      Mommy 19 Mommy 6
      Mommy 20 Mommy 6

  13. hi,
    i have multiple mobile numbers where i want to check that how many time 1 Numbers coming but i am not able found however i have check with countifs but it not happening so please help me then how can check such type values in 10 digit mobile numbers

    Regards
    Bhajan lal Sharma

  14. Ok. Because question 4 passed in mass i need to track earned sick time. I want to set up the sheet that if a cell is 30 the next cell =1 if 60 =2 and so on. What formula should I use.

  15. Is there way count cells when the date change? Say for instance I have a list people and their birthdays. Column A includes the names and Column B includes the birthdays. Is it possible to count how many people have the same birthdays? I believe I can do it birthday individually but is there is there a function that will automatically count them. I am do something similar to that however I have over 75,000 records to check. Is there that well automatically give me total after each birthday is changed. Like, if the previous birthday is not equal to the next date, display total of the previous birthday and reset total. Please advise. Thanks in advance!

  16. Svetlana,

    Having some dificulties trying to figure out, how to count certain transactions that met 2 criterias City=Dallas and Type=SH.
    The table has multiple values and the following columns

    City
    Date
    Type
    Transaction

    I have been trying using Countifs, with no success.

    Thanks a lot for your support.

    Juan Pablo...

  17. Hello Svetlana,

    can you help please?

    I have a workbook referencing different tabs, on one sheet I have:

    Crew Manpower
    A 4
    A 4
    B 5
    C 3

    And on the other sheet I have:

    Crew Crew Member
    A John
    Steve
    Beto
    Frank

    B Ted
    Mike
    Chris
    Nate
    Terry

    In the cell that states "Manpower" I wan to count the number of crew members according to the "crew" letter. I've tried nested COUNTA, IF, AND COUNTIFS and i keep getting errors.

    what am i doing wrong?

    Thank you!

  18. Hi,

    Im trying to do a sum of a range whilst looking at the date completed, for example....

    Qty Date
    5 02-Oct-14
    100 02-Nov-14
    5 02-Oct-14
    5 02-Nov-14
    4 02-Nov-14
    54 02-Dec-14
    5 02-Dec-14
    6 02-Dec-14

    Is there a formula give me the sum of left column against the factor Oct for instance and should bring back the result 10.

    Thanks for your help
    Gavin

  19. Is there any way I can use a formula that will add up different amount of rows but in the same column? Example. In cell AG12, I need it to have the sum of AF8:AF12, however, then I need AG15 to have the sum of AF13:AF15

    1. The only solution I can suggest in this case is writing different formulas for those cells.

  20. Hi Svetlana,

    I have data in Col that A.
    I want to know no of lines between each pipe (|)

    Expected Result in B col for
    first pipe is 0
    Second Pipe is 6
    Third Pipe is 7

    Data
    |
    1
    ZGF1213420
    S ILIYAAZ
    S AZEES MIAH
    34-53-22
    29
    |
    2
    ZGF0316174
    U SUMALATA
    NARASHIMHA
    MURTHI
    53/1
    21
    |

    Kindly do the neeful.
    I have emailed the sheet to you emailid.

    1. Hi Khalid,

      You need a special macro for your task, sorry I cannot help with this.

  21. I skimmed the comments and didn't see my situation listed:
    I want to determine the number of unique entries in a column (D:D) that fall between a pair of dates (say a1 and a2) where the dates of the events are in a different column (J:J).
    I know I can count all of the entries in the date range using
    =COUNTIFS(!J:J, ""&A2)
    and I know I can count all of the unique entries in D:D using
    =SUMPRODUCT((D:D"")/COUNTIF(D:D,D:D&""))

    How do I put them together?

    1. That didn't post right:
      COUNTIFS(J:J, ""&A2)

      1. It's not posting correctly, but hopefully you can interpret what I mean.
        COUNTIFS(J:J, ""&A2)

        Thank you for any help.

        1. Hello!

          Regrettably, we don't know the way to fulfill your task using just one formula. You can either add a helper column or use a VBA macro.

          For example, you can enter one of the following formulas in cell K2 (if unique entries are checked by column D and date range):
          1 =IF(AND(J2>=$A$1,J2<=$A$2,COUNTIFS(D:D,D2,J:J,">="&$A$1,J:J,"<="&$A$2)=1),1,0)

          If you check for unique data only by column D:
          2 =IF(AND(J2>=$A$1,J2<=$A$2,COUNTIF(D:D,D2)=1),1,0)

          Just copy the formula to the other cells of the helper column and then sum the data in the column.

          1. Thank you for the quick and informative reply.

            1. Hi
              I want to use coutifs to select some criteria and count the number of unique numbers (or text) in a column.
              Is this possible?

              eg I have a list of product codes and each code as a different column for the colour, I want to count the number of product codes (ie some are in more than once)

              Cheers, Kate

  22. Is it possible to change the value of a cell so that is counted as two as opposed to one? I'm using COUNTIF to calculate the number of hours each employee is working in a schedule, but some cells equate to 2 hours and others equate to 3.

    1. Hi Abby,

      And how do you determine that a particular cell equates 2, or 3 or 1?

  23. In cells A1 to A30 I have 2 alphabets A&E and in the BCells have values .I need a formula to count the no. Of values of A& E in the Bcell. Pl help

    1. Hello Gespion,

      Try the following formulas:

      Sum values in column B corresponding to "A" in column A:
      =SUMIF(A1:A20,"a",B1:B30)

      Sum values in column B corresponding to "E" in column A:
      =SUMIF(A1:A20,"e",B1:B30)

  24. Hi,

    Your example 4: The formula show B and C cells but you highlighted B and D cells in the printscreen.

    Regards.

  25. Hi - how can I find the LATEST TIME for different products. Product can be repeated multiple times. example:

    Prod1 - 12:30
    Prod1 - 13:45
    Prod2 - 07:00
    Prod2 - 16:00
    Prod1 - 09:00

    Now it should report Prod1 as 13:45 and Prod2 as 16:00.

    Thanks for your help in advance.

  26. Hey Svetlana Cheusheva, I am trying to count values in a column, but I would like to leave out all the blanks and 0 values. Any help would be appreciated.

  27. Hi,

    I have a doubt in excel. I have row from a1 to d1 with numbers or string and c1 have no numbers or string.

    what i am looking is when any cell is blank then the formula would return the text otherwise sum of all number from a1 to d1.

    reply or solutions much appreciated

    thanks

    1. hi

      Can you explain with an example?

      If you come with an example that would be great

    2. I don't have too much experience but I think a simple if min=0 then text else sum shoulf=d be easy to make.

  28. Hi there,

    Here is the formula I am working with that almost produced the desired result:
    =COUNTIF('Entity SPORTS'!$A6:$A20,"'Entity SUMMARY'!A6")+COUNTIF('Entity SPORTS'!$C6:$C20,"m")

    I want to count ONLY IF the first part is true AND the second part is true. Should I be using a different type of formula?

    To provide some context: On one worksheet I have a list of clubs (column a - club name is repeated as many times as there are people in the club), the names of the people in the clubs (column b), and their gender (column c, listed as M or F). I want to summarize the number of males and females for each club on a separate worksheet so that column A states the club name, column b will have the number of M, and column C will have the number of F.

    Any help would be greatly appreciated!

  29. Hi Svetlana, I just sent you an email asking for your help with a formula. Thank you so much for all you do!

  30. Hi, Svetlana,

    Do you know if you can use countifs accross multiple worksheets? I'm tyring to count an occurance of a entry from a pick list, it occurs in the same column on each sheet but I can't find out how to reference multiple sheets?

    Any help would be greatly apprciated!

    1. Hi Brandy,

      Just add a sheet's name with the exclamation mark before the range, for example like this:
      =COUNTIFS(Sheet1!A:A,1, Sheet2!A:A,1)

      This formula counts how many 1's there are in column A in Sheet1 and Sheet2 in the same rows.

      1. Hello Svetlana,
        Iam impressed with your suggestions given above.
        below is the table for date & related days. I want count of total Saturdays. Means it should not consider repeated entries of same dates.
        My result should be 2.

        Can you help me
        3-Jan-15 Sat
        3-Jan-15 Sat
        10-Jan-15 Sat
        10-Jan-15 Sat

        Thanks in advance.

        1. Hello Tushar,

          If you want to count only unique Saturdays, then you need to add a helper column to your table.

          Please enter the following formula into the 2nd cell of the helper column:
          =IF(AND(COUNTIF($A$2:A2,A2)=1,WEEKDAY(A2,2)=6),1,0)

          Where A is the column with dates.

          Then just copy the formula down to the end. After that you need to sum this column, e.g. =sum(C:C)
          Where C is the helper column.

  31. Svetlana Cheusheva
    Hi,

    I'm trying to get a count of common digit like (1234-2345-2789-1289-2548 = 2 100% 4 50% 8 50% 3 20%

    Please help

  32. Hi Svetlana,

    Just mailed you my sheet can you help me with that please

  33. Just mailed you my sheet can you help me with that please

  34. Hi,

    I'm trying to get a count of dates that are due but on condition that they are listed as being follow up. My countif for follow up works fine {=countif(Q2:Q,"*up")}, and my countif for overdue dates works fine {="Follow up (due = "&countif(J2:J,"<="&today()&" )")}, but no matter what I do I can't manage to combine them. Any help would be much appreciated.

    Thanx.

    1. Turns out that the was a bracket in the wrong place:
      ="Follow up (due = "&countif(J2:J,"<="&today())&" )"
      works very nicely.

  35. Hello,
    Problem I cannot seem solve.
    Looking for a formula that counts occurrences of a value IF they occur after a certain date.
    This works fine with SUMIF e.g. =SUMIF($O$2:$IU$2;"<=" & TODAY();O26:IU26) Where the sum of numbers after a certain date are returned.

    DATASET looks like:
    DATES : 25/10|26/10|27/10|28/10|29/10...
    TASK A done by: A | B | A | A | C
    TASK B done by: B | A | B | C | A

    I want to know how many times A, B and C occur after TODAY...

    Thanks a lot for your much appreciated help!

    Floris

    1. Hello Floris,

      Please specify how many tasks and how many A/B/C/ for each task you have. Are the dates sorted in ascending order? Do you want to get the result on the same sheet or on a new one?
      Anyway, I believe the best solution for this task is to use a VBA macro.

  36. Hi Swetlana,
    Hope you doing well.
    I am having difficulty with formulas of multiple critearia.

    My formulas below is worked with me.
    =Countif(ACTL!B3:B50001;A$1;ACTL!$E$2:$E$50000;B$2;ACTL!$G$2:$G$50000;$B7)
    I want to add one more criteria which is date period.My Dates coloumn is starting from C1 till C1000.
    The target date is at B1(15oct2014)
    How can I continue to my formulas which will give me the total after 15Oct2014.
    If you can help me on it will be appreciate.

    Thanks & Regards.
    Utkan

    1. Hi Utkan,

      All ranges in COUNTIFS formulas should have the same number of rows and columns. Most likely, you need this formula:

      =COUNTIFS(ACTL!B3:B50001;A$1;ACTL!$E$2:$E$50000;B$2;ACTL!$G$2:$G$50000;$B7, ACTL!$C$2:$C$50000;$B$1)

  37. Hi,

    I have a data in 2 rows 1st row contains date, and in the 2nd row i have comment codes, i want the latest comment code and latest date in a separate cell in the same row.

    Example:

    1st Row: 1-oct, 2-oct, 3-oct, 4-oct, 5-oct, 6-oct, 7-oct,.....
    2nd Row: ASDF DSFA FGHJ WERT, SDFA .....

    I want the latest comment and date at the end of row for each row.

    I hope you understand the requirement...please help me.

    Prasad

    1. Hello,

      I am not sure I can follow you. If you can send your sample workbook to our support team at support@ablebits.com, we will try to help.

  38. Dear Mam ,
    I will appreciate to resolve my problem.
    i have different date in column which i required the count where dates is mentioned and rest blank not count .
    Please help me

    Center Revised Date 2nd PM Plan Date 3rd PM Plan Date Total Count

    Bannu-1 1-Oct-14 1-Oct-14 Blank ?(Answers should be 2)

    1. Hello Muhammad,

      You can use this formula to count all non-blank cells:
      =COUNTIF(B2:F2,"*")

      To count only dates and numbers greater than 0, please use the following array formula (you have to press Ctrl + Shift + Enter to complete it):

      {=SUM(--NOT(ISERROR(DATEVALUE(TEXT(A2:F2,"mm/dd/yyy")))))}

      Where A2:F2 is the range you want to count.

  39. Hi,
    Is there a way to have a total price adjusted based on the day they typed a quantity into a cell? Lets say price goes up on oct 24 for apples, from $10 to $15. Is there a way to have it calculate the order of 2 apples on Oct 23 (before the 24th), but also calculate the total if they order the apples on the 25th (after the 24th)? If they didn't type in the quantity till after the advanced priced date. This has to be real time.

    Thanks, Ryan

  40. Hi,

    I am counting up unique string values in a range of cells in a column. Tow of the values are "Uses Look Up" and "Value in table". To attempt to get a sum of the counts of the 2, I set up the COUNTIFS functions as follows:

    =COUNTIFS(F1:F128,"=Uses Look Up",F1:F128,"=Value in table")

    The value retuned is 0, however, when I count them separately the count is 75. Why did the COUNTIFS function return 0?

    Thanks, Carlo

  41. Hello,

    I have an excel file with 2 worksheets: the first worksheet contains 10 columns and 10 rows with random values (A, B, C, D, E).

    I need a formula in the second worksheet to count the number of times that value "B" appears after value "A" in the first worksheet.

    It's really important and urgent, if you can answer this you would save me a big headache.

    Thank you

  42. I am trying to create a formula that will give the total number of cells within a range that contain a letter. The formula I currently have is: =COUNTIFS(C4:AC4,"=L",C4:AC4,"=F",C4:AC4,"=T"), however it is ot correct because within this range of cells three of them contain each a letter which are the ones in the formula and my total shows as 0 instead of 3.

    What should I change to get it corrected or would it be possible to even have such formula?

  43. Hi, is it possible to count B4:D200 (multiple column) and a column of uncategorized age to be counted in a column of categorized age?

    thanks,
    Leo

    1. Hi Leo,

      Sorry, I am not sure I can follow you. If you can post a sample of your data, I will try to help.

  44. Hi,

    I want the cell range in =COUNTIFS to be variable, ie. it might be b4:b60 on one occasion, then with a different set of data it might be b4:b70.
    Can the COUNTIFs formula pull the range in from another cell if the range is entered there?

    Thanks,

    Bernie

  45. Hi ,

    By having the Alphabets (A-Z) & numbers consider from (0-9) need the combination of these only with 2 characters alone eg:
    AA
    AB
    AC....
    BA...
    A1
    A2...
    Could you please give an excel formulae or as a vba macro code to display in an excel.
    Please drop me an email.
    Thanks,
    Rajamani

  46. Hi,

    I have a project involving several varying length lists of email addresses which are overlapping, meaning there are duplicate values between the various lists. Additionally, the list order from left to right is important. Each list is an adjacent column in a single worksheet.

    I would like to be able to identify (highlight via conditional formatting) the duplicate values in each successive list (column) occuring in the preceding list(s) to the left of column I'm evaluating, working my way to the nth column all the way to the right in my worksheet. For example, evaluating column B, highlight all cells where there is a duplicate value somewhere in column A. Evaluating column C, highlight all cells where there is a duplicate value anywhere in columns A or B. And so on up to my last column (20) which will be evaluated for matching values anywhere in the other 19 preceding columns to the left. Note that there are no duplicate values within any single list.

    Is there a formula I can use to achieve this goal? Thanks for any suggestions you can offer!

    Andrew

  47. I'm trying to calculate how many times a particular staff is scheduled to work during the week. This staff can be assigned to work in a different location so she can be listed in a column (to specify the day of the week) and rows are the location. The only problem is that I would only be needing to add two to five cells in a column, then another few cells from another column. How would I need to indicate that I'm adding another command?

  48. I am working with multiple workbooks, about 30. Each workbook has the names of associates that performed different tasks in it. I am trying to count how many times each persons name is used in all the workbooks.
    (Ex. Workbook 1 - Jane is used twice, Bill three times. Workbook 2 - Jane is used 4 times, Bill 1 time. Jane's total would 6 and Bill's would be 4 within two workbooks. Can the COUNTIF or COUNTIFS functions acomplish this in an easy way?
    Thanks!

  49. Hello Svetlana!

    Good day!

    Please help me, I'm a begginer on Excel. I have an exam today that may include below; (see data and scenario below)

    (Scenario: Need to count the total no of landline nos, I use =COUNTIFS(DATA!D5:D135,">1") formula however it only gives me 20 total counts, where there should be a total of 21 inlcuding 3401031 LOC. 213. What formula should I use then? Please :) )

    DATA:

    LANDLINE NO.
    325163952
    2691919
    4222239
    323445488
    2623224
    324161040
    2314987
    4898389
    2545410
    2735652
    2358818
    4206340
    2382144
    4149143
    4104661
    3463201
    2366113
    322731025
    2694647
    3401031 LOC. 213
    2339450

  50. I need to track escalation in certain readings.
    For example, I have 2 Columns, A and B; I need to count how many times column B is greater than column A when column B is greater or equal to 10.

    Sample Data:

    A B
    5 8
    10 15
    14 11
    18 22
    9 10

    From above, the answer/count should be 3

    Thanks
    Your help is great appreciated

    1. You can use the following array formula (remember to press Ctrl + Shift + Enter):
      {=SUM((B2:B6>=10)*(B2:B6>A2:A6))}

      1. Thanks a world.
        You're a live saver.

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