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 10. Total comments: 2050

  1. we have data in column like
    AOHO001
    AOHO002
    AOU1003
    AOU2004
    AOU3005
    AOU1006
    AOU2007
    AOHO008
    we have to count how many no. are AOHO

  2. plz help me
    59 rows 1000 number same then 59 rows 10002 number same then 59 rows 10003 number same in one column .....last 3000 number in excel how to work in excel. plz solve issue.

  3. Hi there,

    Wasn't aware you could use arrays like you've shown. It's much neater.

    Is there a way to use an array of Criteria_ranges like this?

    The formula I want to use is:
    =COUNTIFS(data!$C:$C,Sheet2!$C20,data!N:V,">0.0137",data!N:V,"<0.0432")

    I'm aware this doesn't work because of the different size of criteria ranges. Is there any neat / simple way to check each of the columns from N through V for these two conditions, with out writing 18 different range, criteria pairs?

    Hope that makes sense. Thanks

    1. Hello!
      Try using COUNTIFS for each column, something like this:

      =COUNTIFS($C:$C,$C20,N:N,">0.0137",N:N,"<0.0432") + COUNTIFS($C:$C,$C20,O:O,">0.0137",O:O,"<0.0432")+ .........

      Read more here: COUNTIF and COUNTIFS with OR conditions.

      Please note that if the formula refers to the entire column, then the calculation speed will slow down.

      1. OK. Great thanks.

        So there isn't any way to have an array of criteria ranges being checked against a single Criteria?

  4. My request is simple for you. I want it to give me a total count if two things in different in to columns (same line) match criteria entered

    =COUNTIFS($K$2:$K$5541,"Smith, Mary (56123)",&,$H$2:$H$5541,"BHA")

    So if a row contains both Smith, Mary (56123) in one column and BHA is a another column that would be one so 1 would show on the count.

    What am I missing?

  5. Hi,

    Your website is very informative. And I would like to request your help to understand why COUNTIFS function is not working when I add one criterion.

    Example data:

    Counting Date Material Batch TUID LUID UoM Number of Counts QTY Expected QTY Counted QTY Difference QTY Difference ABS Bin Accuracy
    jun 10, 2022 72823224S 21DM14100 104824 1045886 EA 1 2 2 0 0 TRUE
    jun 10, 2022 75005333 E75239 125158 1054899 EA 1 16 16 0 0 TRUE

    Sheet Raw Data contains (among other columns):
    Column A - Counting Date
    ...
    Column L - Bin Accuracy (either True or False)
    ...
    Column O - Is the bin correct? (either Yes or No, and to fill this column I'm using formula =IF(L2="TRUE";"Yes";"No")
    Column Q - Business Unit (either O, S or A)

    Sheet Results Summary contains (among other columns):
    Column DP - Counting Date

    Formula =COUNTIFS('Raw Data'!$A:$A,'Results Summary'!DP$1,'Raw Data'!$Q:$Q,"O") is working.

    Formula =COUNTIFS('Raw Data'!$A:$A,'Results Summary'!DP$1,'Raw Data'!$Q:$Q,"O",'Raw data'!$L:$L,"FALSE") is not.

    I had to use formula =COUNTIFS('Raw Data'!$A:$A,'Results Summary'!DP$1,'Raw Data'!$Q:$Q,"O",'Raw data'!$O:$O,"NO") for it to work.

    I thought it could have something to do with the cell format, but I can't seem to find a solution. I already tried changing it to Text, General, but nothing works.

    Can you please advise?

    Thank you

    1. Hello!
      Column L contains boolean values TRUE or FALSE. In your formula, you compare them to the text values "TRUE" or "FALSE". This is not true.
      Use
      ’Raw data’!$L:$L,FALSE and L2=TRUE
      Read more about comparing boolean values in this article.

  6. I am using this formula to look in a range and find (match) all instances of the text in "N44", and on the next 7 rows, "N44" becomes "N45", "N46" and so forth, for a list of 8 instances. (i.e., looking for the word "won", "lost", "waiting word".
    = COUNTIF('2022'!$K$3:$K$300,N44)
    My problem is that I am getting a wrong count. If I personally count in my spreadsheet the instances of "N44", I count one less than what the formula is returning.
    The weird part is that not all rows are coming up with the wrong values.

    Thank you for your help.

    1. Hi!
      I don't have your data, but I'm sure the function is correct. I don't quite understand what "wrong values" means. Perhaps this is the problem.

  7. I have a countifs formula to be able to count the total amount of a selection made in 3 seperate drop down menus. I am not however, able to have the count on all 3 columns of the drop down menus at once (which would be what I need to do).

    EX: =COUNTIFS('Juin 2022'!M:M,E2,'Juin 2022'!G:G,C3)

    M representing the column of 1 of the drop downs, but I would need N and O also.

    Thank you!

    1. Hello!
      Have you tried the ways described in this blog post? Pay attention to the following paragraph of the article above - Count cells with multiple criteria (OR logic). If it doesn’t work for you, then please describe your task in detail, I’ll try to suggest a solution.

  8. Hi- Hoping you can help me.

    I have two columns of dates: Event Date, and Action Date. There are more Action Dates than Event dates.

    These dates are on different worksheets.

    I want to find out have many actions happened within 30 days of all of the Event dates
    ie, if an event happened on 1/15/22, how many action occurred between 1/15/22 and 2/14/22?

    thanks!

    1. Hi!
      If you read the last paragraph of this article carefully, you will easily find the answer there.

      =COUNTIFS(Sheet1!A1:A10," > ="&DATE(2022,1,15),Sheet1!A1:A10," < ="&(DATE(2022,1,15)+30))

  9. I have a Problem with counting the multiple numbers with "50". Is there a formula to compute how many "50" combining with "today()" formula? Because I want to count all "50" for today only not the whole data set. Hope you can help.

    Thank you.

    1. Hi!
      I’m sorry but your description doesn’t give me a complete understanding of your task. I'm assuming you want to count the number of values given two conditions. The COUNTIFS function can help you with this. If that's not enough, then explain the issue in more detail.

  10. Hi,

    Great tips!

    I have a question, do you know how to do the COUNTIFS formula to exclude a word?

    So for example, I want two different types of formulas, the first one, I wanna include "word", I did this formula:

    =COUNTIFS(Links!J:J,APRIL!E58,Links!M:M,"*word*")

    The second one, I want to exclude "word". Is this possible?

    Thanks!

    1. Hello!
      To exclude “word”, you can subtract its amount from the total number of values.

      =COUNTA(Links!M:M) - COUNTIFS(Links!J:J,APRIL!E58,Links!M:M,”*word*”)

      I do not recommend using a reference to the entire column in the formula, as this can significantly slow down the calculation.

  11. =SUM(COUNTIF(B2:G2,{"TWG","DEA","FBI","Audit"})*{1,2,3,4})

    I am using this formula to assign # values to each text option. So TWG=1, DEA=2, etc. These are trips my company does and the amount of hours each trip is. I am attempting to track how many total hours each colleague has done.

    So when I plug in any of those text options in mu table tracking each person's trips, it assigns it a # value and adds up those values in the last column to give me the person's total hours. It works easily, but I don't want to have to keep updating the formula when adding new trip/hour combo (text/# value) .

    Is there a way I can put a range of cell values for the criteria and the # values in the above formula? This way I can have a separate table and every time I add a row containing a new trip/hour combo (text/#value) it updates the formula.

    1. Hello!
      Write your trips in column A. In columns B and C, write down all the possible travel options and the corresponding number of hours for each of them.
      Enter the following formula in cell D1 and then copy it down along the column:

      =COUNTIF($A$1:$A$200,B1)*C1

      I hope it’ll be helpful.

  12. I'm have a table with as follows:
    Item No. --- Sales Order
    12345 --- ABCD
    54321 --- ABCD
    12345 --- EFGH
    54321 --- IJKL

    What I'm trying to accomplish is COUNTIFS Item No. where Sales Orders Match.
    In this case it would be 2, lines 1,2. It's a pretty huge dataset so I was trying to utilize a matrix array of item no x item no and populate. Any thoughts on how this can be accomplished?

  13. Hello Team,

    Have an interesting problem that we require some help with. We have a daily delivery schedule sheet that comprises of multiple texts with quantity in a single cell. Is there a way to do COUNTIF formula to extract these data? Some of these data do consist of strikethrough data that shouldn't be taken into account.

    Also, is there a way to send screenshots so that you will be able to understand the question?

    Thank you in advance!

    1. Hi!
      Excel formulas cannot determine the format of individual characters in a cell (such as strikethrough characters).
      To do mathematical operations with numbers, these numbers must be extracted from text into separate cells.
      Please have a look at this articles: How to extract number from string in Excel and
      Extract number from string using regular expressions (Regex).
      I hope I answered your question. If something is still unclear, please feel free to ask.

  14. Hi all,

    Could you please help me to find a formula to count the number of unique values only in one column with a criteria in a another column. Example: There is a column with ID numbers for birds but there are some duplicates (these records must stay in the sheet) and there is a column with a year for when the bird census was done. We need to calculate how many birds with unique id (excluding duplicates) were recorded in Year1, then in Year2 and so on.

    Grateful for your assistance.

  15. I have a data set where respondents are allowed to select multiple options (A, B, C, D, E .. etc)

    My formula "=countifs($F$2:$F$120, "A", $C$2:$C$120, "Yes")" only shows respondents who only choose "A", but what I want to count are respondents who chose "A" and other options as well.

    Would greatly appreciate your help!

    1. Hi!
      If all selected options are written in one cell, then you can use the SUMPRODUCT function:

      =SUMPRODUCT(--(C1:C120="Yes"), --(ISNUMBER(SEARCH("A",F1:F120))))

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

  16. I have a workbook with two tables (A,B). The table I am working in, (A), has descriptions in Column A (Discrepancies found) like:
    "1.06. The instrument has been preset"
    Table B has headings of Team and several Section x columns. Under each heading is a team name and multiple selections for each Section x for each row. So the Section comment may have more than one entry in each row. I also need to strip the first 6 characters of what is in Column A table A. I use:
    =COUNTIFS(Tbl_B[[Team]:[Section 6 Comment]],"*"&MID([@[Discrepancies found]],6,80)&"*") which finds and counts the comment in any of the Section columns for each row of Table fine.
    But, I need to count the number of times "The instrument has been preset" occur in each row for those Section columns and Team = "Outgoing". When I try:
    =COUNTIFS(Tbl_B[[Team]:[Section 6 Comment]],{"*"&MID([@[Discrepancies found]],6,80)&"*","Outgoing"})
    I get an formula error which highlights the second quotation mark from the first asterisk {"*"&MID([@[Discrepancies found]],6,80)&"*" ...}
    I have also tried to look across the Sections and Team, but it returns a #Value error:
    =COUNTIFS(Tbl_B[[Section 1: Checking Instrument / Customer Settings]:[Section 6 Comment]],"*"&MID([@[Discrepancies found]],6,80)&"*",Tbl_B[Team],"Outgoing")

    1. Hi!
      It is very difficult to understand a formula that contains unique references to your workbook worksheets. I can't check the formula that contains unique references to your workbook worksheets, sorry.
      Give a simpler explanation of your problem. Give an example of the source data and the desired result.

    2. Figured this out. Thanks.

    3. Figured this out. You can not combine multiple columns with a single column in the Countifs statement. Narrowed to each column and now I can look up multiple items per column. But I loose searching the whole sheet, so I split Table A for each section.

  17. Hi, fisrt I have to say that this posts are SO helpful!

    I have a question in the example "Formula 2. SUM COUNTIFS with an array constant" how could I have the count of two different values (apples and oranges) e.g. =SUM(COUNTIFS($A$2:$A$11,"apples","oranges",$C$2:$C$11,{"cancelled","pending","in transit"}))

    Thank you!

  18. Hello! I have read through this article a few times and can't figure this out. In my purchases report, say we have the month (ignore the year part) in one column and the item we purchased in another column. Each row is say, a purchase. So I want to know how many keyboards purchased in the month of June. I need a formula that will bring in that information. It will count how many keyboards from one column match up with June in the month column to bring me a count. Can you please assist? I have been working on this one for a while! I have a feeling I have to have multiple commands in the same formula but have come up short.

    Thanks!

    1. Hi!
      Have you tried the ways described in this blog post? Use the COUNTIFS function with two criteria: month number and product name.

  19. Thanks this has helped keep up the great work.

    I was wondering if there was a way to do what I'm trying with one formula instead of multiple?

    I am formatting one cell "A1" to indicate if I have any one of the specific items listed more than once in a range.

    I have used the below and it does work just wanted to know if there is an easier way with one formula?

    The range will have items that are similar like apple or apples2 I'm not interested in those just the ones below and need to know there is more than 1.

    formatting rule1
    =COUNTIF(range,"apples1")>1

    formatting rule2
    =COUNTIF(range,"apples3")>1

    formatting rule3
    =COUNTIF(range,"apples4")>1

    List example 1
    apples1
    apples3
    apple
    apple
    apples4
    so nothing of interest is = >1
    Do not highlight A1

    List example 2
    apples1
    apples3
    apples2
    apples2
    apples2
    apples1
    apples4
    so
    something of interest apples1+apples1= >1
    Highlight A1

    1. Hello!
      If I understand the problem correctly, you can use an IF function with multiple conditions.

      =IF(OR(COUNTIF(range,”apples1″)>1,COUNTIF(range,”apples3″)>1, COUNTIF(range,”apples4”)>1),TRUE,FALSE)

      or

      =(COUNTIF(range,”apples1″)>1)+(COUNTIF(range,”apples3″)>1)+ (COUNTIF(range,”apples4”)>1)

      I hope my advice will help you solve your task.

  20. Hi Team,

    Hope you are well.

    Kindly advise how to do reverse count? I have data set eg 123,123,123 so when I use countifs, it gives me 3,2,1 but I want 1,2,3 please see the example below. Kindly advise how to solve it?

    Number Count I want
    123 7 1
    123 6 2
    123 5 3
    123 4 4
    123 3 5
    123 2 6
    123 1 7
    124 3 1
    124 2 2
    124 1 3
    125 4 1
    125 3 2
    125 2 3
    125 1 4

    COUNTIFS(A2:$A$15,A2)

    Thanks

    Razib

  21. thank you for the Tips what the furmula if I want to says count if The date on Cell A-the date on Cell B> 00 and the cell <0

  22. Hello Team

    I have a query regarding CountIfs function for multiple criteria Selection

    Here University Name & Session came from a another tab,
    When I select the university name as Surrey and Select Session as FA22 so the result will be "2"

    Using this Formulla: =sum(COUNTIFS(SFK!$O$8:$O$500,$M$5,SFK!$J$8:$J$500,{$N$4}))
    (Sheet Name=SFK , University Name Range=O8:O500 , University Name Selection=M5, Session Range= J8:J500 , Session Selection= N4)

    Example
    University Name FA22
    Surrey 2

    Or
    When I select the university name as Surrey and Select Session as SP23 so the result will be "1"
    University Name SP23
    Surrey 1

    These two examples are OK for me but the query is " When I select University Name and want all session as a result will be "3" How can I formulate this? I want to Select All Session to get total result also.

    Thanks in Advance

    1. Hello!
      If I understood you correctly, then the second criterion can be excluded from the formula.

      =COUNTIFS(SFK!$O$8:$O$500,$M$5)

  23. We use a monthly schedule to record tasks performed by person. The schedule is a basic grid that has the day of each month in row 1, the task abbreviation in column A and the applicable persons ID is listed in cells B2:AF39.
    The second spreadsheet has the full description of each task listed in column A and the person's ID listed in row 1.
    I need to count the number of times the ID is listed per task aligning with the ID in cell B1 continuing for all rows/columns.
    The formula is in a tab labeled "TasksbyPerson"
    =COUNTIFS('MonthlySchedule'!$A:$A,"SMMC 3",'MonthlySchedule'!B:K39,B1)

    1. Hello!
      Range B:K39 is not possible. In the COUNTIF and COUNTIFS functions, all ranges must be the same size. These functions cannot solve your problem. Use something like this formula with the SUMPRODUCT function.

      =SUMPRODUCT(--((B2:K39="persons ID")*(A2:A39="SMMC 3")))

      I hope my advice will help you solve your task.

  24. =COUNTIF(Table3[DATABASE_ROLE],"Primary")-[@[Month Completed]]

    What is the purpose of the "@" in this subtraction formula?

  25. Thank you for the tutorial. I have made my school mark sheet through this.

  26. Hello Ablebits team,

    I wonder if you could help me. I have a table showing who attended each of our monthly meetings.

    I am new to COUNTIF and COUNTIFS and well as fairly new to using tables but would like to use them as the formulas seems to be a little more clearer to read once I get the hang of the syntax. I am not sure if COUNTIF and COUNTIFS can be used in a table

    I am counting the number attending and the number of apologies for each meeting. Those I can do with a simple i.e.

    Num Present uses "=COUNTIF(Table1[Jun-20],"y")"
    Number Apologies (and on leave) uses "=COUNTIF(Table1[Jun-20],"A") +COUNTIF(Table1[Jun-20],"L")"

    For the latter I tried to combine the criteria using COUNTIFS i.e.
    "=COUNTIFS(Table1[Jun-20],"=A", Table1[Jun-20],"=L")" but that didn't work.

    My main problem is that I want to count the number of people eligible to attend any particular meeting.
    The reason for that is that over time some people may have been employed after the date for that month's record or may have left their job before that meeting.

    I tried to do this by comparing a start date and end date with the date of the meeting. I had a problem because I was using the meeting date as a column heading and realised that I can't compare date values to a column heading text. I overcame that by putting the month date in a separate row above the table headings.

    I would appreciate it if you could provide some guidance on how to create functional formula to do this.

    My table structure is as follows (which you can paste into a text file and open it as CSV.
    The table is between rows 5 and 14, with row 5 as the heading.

    Attendance at monthly meetings,,Total Available,0,
    ,,Present,3,
    ,,Apologies/Leave,2,
    Put Date in this row and label in the one below so we can use it in formulas,,,12-May-20,
    Person,Start Month,End Month,May-20,
    Person 1,21-Jan-18,,y,
    Person 2,21-Mar-18,29-Jul-19,,
    Person 3,1-Feb-20,,y,
    Person 4,1-Mar-18,,L,
    Person 5,1-Apr-21,1-Jun-20,,
    Person 6,1-Feb-20,1-Jun-20,A,
    Person 7,1-Mar-20,,y,
    Person 8,1-Jul-20,,,
    Person 9,6-Jul-20,,,

  27. I want to count a column of criteria where V=1 and v=.5 and the total would be the # of Vs and v's combined, but can't figure out how to make the formula have v=.5 instead of 1, as the countifs function counts the numberof cells not the value of the cell data.

    Is there a function that will essentially add up all the V's and v's in a column for a combined total ( eg: there are 4 Vs and 2vs for a total of 5. I want to basically do a sum where V=1 and v=.5

    1. Hello!
      Multiply the number of found values 0.5 by 0.5 and get their sum. I hope I understood the problem correctly.

  28. Greetings: my organization uses a scheduling calendar that can export information to Excel such that calendar dates are populated along the x-axis and individual names are on the Y-axis. Each cell will be assigned a text value that represents the shift assignment for the day for the individual designated on the Y-axis.

    I’m trying to create a count of days for an entire year, for each individual, which correlates the assignment designated “A” with any number of assignments, call them “B,C,D,E” that occurs the calendar day immediately BEFORE assignment “A”. Only one assignment for the preceding day “B, C, D OR E) would need to be found to increase the count. How could I write an appropriate formula which would count the cells where assignment (B,C,D OR E) is followed by assignment “A” ? Would it be easier if the data was transposed such that the individual populate the X axis and dates the Y axis?

    Thank you for your assistance.

    1. Hello!
      If the data for a person is recorded in the range B2:N2, then the count of the cells according to your conditions can be calculated using the formula

      =SUM(((TRANSPOSE(B2:N2)="B")+ (TRANSPOSE(B2:N2)="С")+ (TRANSPOSE(B2:N2)="D")+ (TRANSPOSE(B2:N2)="E"))* (TRANSPOSE(C2:O2)="A"))

      I hope my advice will help you solve your task.

  29. I want to count the number of specific values in a column (F:F) that fall between two dates (the start and finish of the month) contained in another column (H:H).

    The values in F:F are one of 29 specificvalues and column H:H contains dates from 01/01/22-
    31/12/22(updated daily)
    I want to be able to count how many of the specific values F:F appear in any given month.

    I can count each specific value F;F with the formula =COUNTIF('2022'!F:F,"*51/1 assault*")

    I can count the total number of values F:F appearing between two dates with the formula =COUNTIFS('2022'!H:H,">="&DATE(2022,2,1),'2022'!H:H,"<="&DATE(2022,2,28))

    But I just can't work out how to count a particular value in any given month.

    Can you help me?

    1. Hi!
      Try to merge formulas:

      =COUNTIFS(‘2022′!H:H,”>=”&DATE(2022,2,1),’2022’!H:H,”<="&DATE(2022,2,28),‘2022’!F:F,”*51/1 assault*”)

  30. Kindly I need your help

    My manager asked me about the excel sheet if we can fix .

    the vacant bed which highlighted in green color in the excel sheet it is the result of difference of night shift census (J25) minus Total bed capacity bed(C25) minus total blocked bed (T25) . however he need if the night shift not filled the result will be day shift census minus Total bed capacity bed(C25) minus total blocked bed (T25) . If both them filled will be calculated only the night shift census (J25) minus Total bed capacity bed(C25) minus total blocked bed (T25) .

    How we can do that in excel sheet

    Hoping for your help in this matter .

    Thank you very much

    Best Regards

    1. Hi!
      Your description doesn’t give me a complete understanding of your task. You did not provide the addresses of all the cells, but the formula could be something like this:

      =IF(J25<>"",J25-C25-T25,A25-C25-T25)

      I recommend that you carefully study the article - How to use IF function in Excel

    2. Hello!
      Unfortunately, I could not understand your conditions for counting. Could you please describe it in more detail? Give an example of the source data and the expected result.

  31. In process of creating a 'master sheet' with sheet one including the formulas, and sheet 3 being the sheet where the data exported will be pasted into. Then sheet 1 will display the results as a summary so I'm pulling the data from sheet 3 onto sheet 1 based on certain criteria.

    D Contains the location - hall, court, room, upper, lower etc..
    E Contains the age - 6,7,8,9, etc...
    I Contains a range of various activities in the one field - rugby club, football club, handball, tennis club, dance club..etc...

    I want to pull one age group (6) from every location except two only (Hall and Court) only IF if I contains certain activities (Football, Tennis or Rugby) from sheet 3, into sheet 1. I enter the below formula in the cell I want the data in sheet one, and it returns zero. Zero is incorrect as when filtered there IS fields that are age 6, location other than Hall or Court that have done either football tennis or rugby.

    =SUM(COUNTIFS(Sheet3!$E:$E,"6",Sheet3!D:D,"*Hall*",Sheet3!D:D,"*Court*",Sheet3!I:I,{"*football*","*tennis*","*rugby*"}))

    1. Hello!
      Without seeing your data it is difficult to give you any advice. Perhaps the age in column E is written as a number. Replace the text "6" with the number 6 (without quotes).

  32. Hi. My data range (A1:B300) has reference numbers in A, and text lines in B. In C5, I type a word, and I want to see in D5 the row(s) from the range having the word. COUNTIF tells me the number of times the word occurs in the range. Is there a formula I can use in D5, so that I can avoid having to use data filter on the range. Thanks.

    1. Hello!
      To get conditionally from a range of rows, you can use the FILTER function. You can find instructions and examples in this article.
      I hope it’ll be helpful. If something is still unclear, please feel free to ask.

  33. Hi - I need help with creating a tally based on date and time frames. I am trying to calculate how many flights are within a specific day in a column, but within each day, I need it broken up in intervals of time. For instance, I need every hour of each day. Let's say I am looking at 300 flight itineraries (all arriving within a 3 day period 4/2/2022, 4/3/2022, and 4/4/2022). I need to look at each day specifically and be able to break down how many people arrive at for example, 1 - 1:59 pm, 2 - 2:59 pm, 3 - 3:59 pm and so forth. I understand how to do the count ifs for a time frame, but how is there a way to include the conditional for the date.

    1. Hello!
      If the cell contains the date and time in the mm-dd-yyyy hh:mm:ss format, then you can write the condition something like this:

      ">="&(DATE(2022,4,2)+TIME(13,0,0))"

      Please check out this article to learn how to insert time using the Excel TIME function.

  34. Hello, I'm trying to figure out how to find matches between a cell containing multiple comma separated numbers and another cell containing multiple comma separated numbers.

    Here is my example, cell 1 contains 12345, 12346, 12347, 12348,
    cell 2 contains 54321, 12345, 65432, 23456, 12347

    I want to do two things -
    1. provide a true/false 1/0 answer in the cell if any number in cell 1 shows up in cell 2
    2. in another cell count the number of matches between cell 1 and cell 2

    I have had to break out the imported data and separate it out by commas manually, and it is time consuming. I figured I would reach out to people who are much smarter than me to get some insights.

    Thanks for your time,

    Jeremy

    1. Hello!
      You can split text by rows using the Split Text tool. Then compare 2 columns and determine the number of duplicates as described in this tutorial.
      Unfortunately, this problem cannot be solved by ordinary Excel formulas. It is possible to write a custom VBA macro

  35. Hi,

    I'm trying to count data in an entire table based on a date, then return the total of this. This table has multiple rows for data from 01/2/3/4 of January and will continue.

    The formula works whenever I change the date however, I want to count of data from another column, based on each [date].

    Note these are all in the same table with rows appended each day.

    For clarification I want to return the total of [Date] + return me total of [Status] on [Date]

  36. Hi,
    I was working on some calculations but unable to find the solution.
    I want to count the number of days on which the minimum balance is maintained

    For Example

    On 1.12.21 on 2.12.21 on 3.12.21 Minimum Balance Remarks - Formula required
    75 70 50 60 (Min balance maintained - 2 days)
    50 60 45 70 (Min balance maintained - 0 days)
    45 20 35 10 (Min balance maintained - 3 days)

    1. Hello!
      Based on your description, it is hard to completely understand your task. However, I’ll try to guess and offer you the following formula:

      =COUNTIF(A1:C1,">"&D1)

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

  37. Greeting,
    I have datasheet i want to count the Age categories, related local and female.
    Mean how many local female we have above 19 years to 48 years. below formula can't working.
    =COUNTIFS('Datasheet'!E36:E139,"female",'Datasheet'!G36:G139,"19-48",'Datasheet'!H36:H139,"local")

    1. Hi!
      Instead of G36:G139,"19-48", use two conditions: G36:G139,">19", G36:G139,"<48"
      I'm not seeing your data, but I think that will be helpful.

  38. Hi

    I am creating a spreadsheet for a sales tracker. I have a weekly tab (x13) and I have multiple drop down options (Current account, saver, mortgage etc) in one column and the next over the date the account was opened. I am trying to total up in another tab the total number of say current accounts keyed but only once the week number has been added else it doesnt count. So the other tab has a list of all the product options with number opened for a total of 13 weeks (quarterly total). Help please! So stuck!

    1. Hello!
      Unfortunately, without seeing your data it is difficult to give you any advice. You need to use COUNTIFS as recommended in this article. The criteria are the invoice date in the date range (there is an example above) and the product code.

  39. I have a CSV file downloaded with info about orders. I want Excel to somehow count the number of orders of each type per person.
    i.e. Sherry ordered 3 Chicken pies, and 2 Butter Tarts,
    Joanne ordered 2 Butter Tarts,
    Marie ordered 2 Beef pies and 2 Butter tarts
    and Bill ordered 3 Beef Pies, 3 Chicken etc.

    Currently it looks like this: (I didn't know how to attach a screen shot so I just separated the column info by /

    Order number 1/Sherry/chicken/address/phone #
    Order number 2/Sherry/chicken/address/phone #
    Order number 3/Sherry/chicken/address/phone #
    Order number 4/Sherry/butter tart/address/phone #
    Order number 5/Sherry/butter tart/address/phone #
    Order number 6/Joanne/butter tart/address/phone #
    Order number 7/Joanne/butter tart/address/phone #
    Order number 8/Marie/beef/address/phone #
    Order number 9/Marie/beef/address/phone #
    Order number 10/Marie/butter tart/address/phone #
    Order number 11/Marie/butter tart/address/phone #
    Order number 12/Bill/beef/address/phone #
    Order number 13/Bill/beef/address/phone #
    Order number 14/Bill/beef/address/phone #
    Order number 15/Bill/chicken/address/phone #
    Order number 16/Bill/chicken/address/phone #
    Order number 13/Bill/chicken/address/phone #

    The way that the Excel sheet works now, I have to count the number of items of each kind per person... Too much work when there are many items (sometimes we have up to 50) and too big a margin for error (If we miscount or count someone else's order by accident.)

    Any ideas how I can make this work? (I'd be ok if each item that they ordered had it's own line beside the name.

    1. Hello!
      You can get a list of orders for an individual person using the FILTER function.
      To count orders of each type per person, I recommend using a pivot table.
      I hope this will help, otherwise please do not hesitate to contact me anytime.

  40. Alexander,

    Sorry for the additional email. My formula below worked, but when I applied to all months in the year, it wasn’t counting correctly for each month. When I applied the correction below (and adjusted the date range for each month), it counted correctly.

    =SUM(COUNTIFS(daterange,">=02/01/2021",daterange,"<03/01/2021",schoolrange,{"school 1","school 1","school 2", "school 2","school 3","school 3"},subjectrange,"Art",projectstatusrange,{"finished","nearly finished","finished","nearly finished","finished","nearly finished"}))

  41. Alexander
    Thank you for your help. Prior to requesting, I did look through the prior chats before requesting advice. Thank you for the formula provided. Initially the formula was not picking up any values, but was returning a 0. I tried substituting named ranges for the cell ranges in the provided formula and that did the trick.

    =SUM(COUNTIFS(daterange, ">=01/01/2021",daterange, "<02/01/2021",schoolrange,{"school 1","school 2"},subjectrange,"art",projectstatusrange,{"finished","nearly finished"}))

    Where daterange is the specified cell range for the dates, schoolrange is the specified cell range for school numbers, subjectrange is the cell range for the various subjects, and projectstatusrange is the cell range for the various project status’.

    I appreciate your expertise and help. I use and reference your blog and find it to be one of the better and more responsive blogs.
    Best regards-

  42. Good day,
    I’m struggling with a Countifs formula and could use your help.
    I have two tabs-formula is in tab/sheet 1, data table is in tab/sheet 2.
    I’m trying to determine the number of times one of two project status appear based on certain conditions:
    On tab/sheet 2, the data is set up as follows:
    Column 1 is School 1, School 2, School 3
    Column 2 are the subjects: Art, math, science, language, etc…
    Column 3 is the project status: not started, started, in process, nearly finished, finished
    Column 4 is the date of the entry/status update
    I am trying to write the a formula that accomplishes the following:
    The number of projects between date range >=01/01/2021 to <02/01/2021 for just the the art classes from either school 1 or school 2 that are in either a “nearly finished” or “finished” status

    I’ve tried using if(and combined with a count if, but I continue to get #value errors.
    Any help is greatly appreciated.

    1. Hi!
      Have you tried the ways described in this blog post? I hope you have studied the recommendations in the tutorial above. It contains answers to your question.
      Something like this formula:

      =SUM(COUNTIFS(D2:D9, ">=01/01/2021", D2:D9, "<02/01/2021",A2:A9,{"school 1","school 2"},B2:B9,"art",C2:C9,{"finished","nearly finished"}))

  43. I have to calculate child spaces for a month. I used S as sick. We allow 5 sick days per child per month to be counted towards compensation, anything over 5 days is not counted. The formula I used to count days for present was =COUNTIF($B11:$AF12,"P"). But I cant figure out the S days to minus the 5 allowable days. Any help would be greatly apprecied

    1. Hi!
      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:

      IF(COUNTIF($B11:$AF12,”S”)>5,5,COUNTIF($B11:$AF12,”S”))

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

  44. Hey there,

    I have a data sheet with columns indicating characteristics that are labelled with numbers to indicate which characteristic. 1: Black 2: Yellow 3: Brown 4: White 1: Cat 2: Dog

    I would like to find out which cells in the spreadsheet have the two matching characteristics.
    eg. "black" "dog" So, the end goal is to have 1 number added to the answer box for each person in the survey who owns a dog that is black.

    =countif(Data!R1:R99, "2", Data!Q1:Q99, "1")

    Would you care to tell me what is wrong about my formula?

    1. Hello!
      To count on multiple conditions, use the COUNTIFS function. Please read the above article carefully.

      1. Thank you so much!

        The different between plural and non plural is what was holding me back.
        This has helped me immensely and I am happy that you responded promptly.

  45. Hello There,

    I have multiple columns, example:
    Code ; Environment; value
    xyz; Dev;1
    xyz; SIT;1
    xyz; PAT;1
    ABC;DEV;1
    PQR;PROD;1

    Now, i need to take only values which has Dev and either SIT or PROD or PAT, flag them True. if it is just Dev only they flag them False.

    Need your guidance. thank you

  46. Hi,
    When using dates as the criteria arguments, do you have always specify in US date numerical format rather than UK equivalent?
    I live in the UK and so the convention we use to convert 1st June 2015 to numerical format is "01/06/2015". In the USA this would be 06/01/2015.

    Does excel functions only work with the later?

  47. Thank you so much for this!

  48. Hi, please help! I have 2 columns, Column A "Date" and B is status if "Passed/In Progress".
    I need to count the number of "Passed" using a date range provided in a cell. Here's a sample:

    COLUMN A. Column B. Column C. Column D Column E
    10/1/2021 Passed 10/1/2021 10/30/2021 2
    10/5/2021 In-Progress
    10/10/2021. Passed
    11/01/2021 Passed

    1. Hello!
      Please re-check the article above since it covers your task.
      Here is one more article that may be helpful to you: COUNTIF formulas for dates.
      I hope I answered your question. If something is still unclear, please feel free to ask.

    2. My sample seems wrong didn't know spaces will be deleted after posting.

      Column A "Date", Column B "Passed/InProgress", Column C and D "Date Range", Column E "Count Passed"

      I need to know what formula am I going to use on Column E. Thank you so much!

      1. I just found out the answer it's:

        =COUNTIFS($B$2:$B$6,">="&$C$2,$B$2:$B$6,"<="&$D$2,$A$2:$A$6,"Passed")

        Thanks!

  49. Hi, I'm not sure how to put this in the formula and not even sure what function I need to use, can someone help me, please?

    I have 2 sheets named and with column names below

    Sheet 1 Name: Est Sheet (with data)
    Column A: Facility Name (with data)
    Column B: Department (with data)
    Column C: Est Asset (with data)
    Column D: Actual Asset (data needs to come from Sheet 2)

    Sheet 2 Name: Asset Located
    Column A: Asset Name
    Column B: Facility Name
    Column C: Department

    I would like to pull out the total numbers of asset per facility and department from Sheet 2 and show it on Column D of Sheet 1.

    How do I count the number of assets on each facility and department and pull out the sum to Column D of Sheet 1?

    Help, please. Thank you!

    1. Hello!
      I kindly ask you to have a closer look at the article above.
      Counting values according to two conditions:

      =COUNTIFS(Sheet2!B2:B100,Sheet1!A2,Sheet2!C2:C100,Sheet1!B2)

  50. can someone help me to get below result, count # of material based on two conditions.
    detail
    work order Date material
    100 12-Oct ab
    200 13-Oct cd
    100 12-Oct ef
    result
    work order Date material
    100 12-Oct 2

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