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
by Svetlana Cheusheva, updated on
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 46. Total comments: 2055
Outlet type: A, B, C, D
Expected Product range by outlet type
A - 20g,30g,170g,410g,400g tin,400g pouch,uht fc,uht lf
B - 20g,30g,170g,410g,400g tin,400g pouch
C - 20g,30g,170g,410g
D - 20g,30g,170g
Product presence report (Yes means available while No means not available)
Peak 170g - No
peak 410g - Yes
peak 30g - Yes
peak 20g - Yes
peak 400g Tin - No
Peak 400g P - No
Peak 900g - No
Peak uht fc - No
Peak uht lc - No
Hi Svetlana, i have above merchandizing report data. Based on the outlet type and the lists of products expected there and the product presence report, i want a formula that will count and return the number of products present in the outlet by considering the type of outlet (A,B,C,D). Thanks
Dear Svetlana,
Still waiting please, i believe you are working on my request. Thanks
i have got data of employees for a mining company. i want to count those that appear on the breakfast, lunch and dinner differently. how can i do that?
thanks
Hi Abraham,
If you can provide more details about your data structure, we will try to make a formula.
hi,
i have got a big data of employees working for a mining comapany, i want to know the number of employees that come for breakfast, lunch and dinner differently. how can i do that?
thanks
Hello. I’m trying to count unique text values in column A that meet date criteria in column G as determined by one cell (H158160) that contains a drop down list of dates selected by users. The intention is for them to be able to select the date from the list and see the count of account numbers, the sum of units sold, and the sum of revenue. I’ve got all of the formulas working except for the count of account numbers, because I’m having trouble with the COUNTIFS formula. I’ve been able to count unique values using the array formula {=SUM(1/COUNTIF(A2:A796,A2:A796)}, but I don’t know how to set these multiple criteria. Hopefully you can help. Thanks in advance!
I am trying to count the number of people who have done an intervention by the place from which they come from. I am taking this information from another sheet. The thing is they have done up to four interventions and the intervention columns are not in direct order of one another. So I am trying to count the number of people say playing football which could be in four columns by the place the live.
I have tried =COUNTIFS('USER SHEET'!AC2:AC10000,Intervention!D3,'USER SHEET'!B2:B10000,Intervention!C4,('USER SHEET'!AF2:AF10000,Intervention!D3,'USER SHEET'!B2:B10000,Intervention!C4,('USER SHEET'!AI2:AI10000,Intervention!D3,'USER SHEET'!B2:B10000,Intervention!C4,('USER SHEET'!AL2:AL10000,Intervention!D3,'USER SHEET'!B2:B10000,Intervention!C4))))
How chose two fromm three number the best.
Excample:
A: 30
B: 20
C: 10
Two the best 30+20=50
I am trying to use a count function, but struggling to get the formula to work.
I have an area that will be filled in with different dates. On a separate sheet I have a running date column. I want to count how many boxes have a certain date in it.
=COUNTIF(Sheet3!$C$23:$EF$34,"=14/8")
This is the formula I'm currently using, which works fine, but I cant drag it down. I've tried doing the alternative:
=COUNTIF(Sheet3!$C$23:$EF$34,"=B8")
(B8 is where the 14th August is located). This does not work.
Please help.
Thanks
Craig
JUST REMOVE THE $ SIGN AND DRAG DOWN
Good Morning,
I am so thankful I found this site.
I am looking for a simple formula to find all 4s in column b, that has a code of X3,Z1, and Y9 in column E, PLUS all 5s in column B, that have blanks in column D, with codes of X3, Z1 and Y9 in column E.
Can this be done? If not, thats fine, I will complete it the same as always.
I appreciate all your help.
Rick
A B C D E
5659 4 91B 91B2 Z1
2935 4 68C 68C2 Z1
6572 4 92W 92W2 Z1
8675 4 91D 91D2 Z1
7627 5 12B 12B2 Z1
7450 5 19D 19D2 X3
9171 5 36B 36B2 Z1
3503 5 11B 11B2 Z1
5759 5 36B 36B2 X3
5062 5 15D 15D2 Z1
9088 4 91E Y9
1665 4 68W 68W2 x1
7212 4 68W 68W2 x1
4539 4 15U 15U2 Z1
2579 4 74D 74D2 Z1
8052 5 14H X3
2423 5 15U X3
5228 5 12P Z1
9080 5 19D Z1
9076 5 11B x1
691 5 74D x1
3504 5 31D x1
8594 5 14E x1
919 5 11B x1
4518 5 11B X3
Hi!
I have two columns (all text). The first column is a list of names (could be repeated) and the second column is a list of factors (i.e. "ontime", "late", etc.). I want to know how many times a certain name (from the first column) hits each factor from the second column. Hopefully this is clear.
Thank you!
Hi Again,
Please disregard. I used a SUMPRODUCT formula which worked like a charm!
Hi Melissa. How did you get this to work?
Hi I am trying to use a countifs formula for the following situation:
I have multiple staff and I want to get a tally of how many times each staff puts in overtime for each reason for overtime.
I have been successful with this but I want to take it to the next level and find out the total amount of time corresponding to each reason for each staff member. So the formula is referring to a separate tab in excel and basically saying that if B4:B30 says "X" and c4:c30 says "Y" I want the value of D4:D30 that corresponds to this condition to show in the cell. Is this possible?
Hi Kim,
Let me check if my understanding of the task is correct. so, if B4 says "x" and C4 says "y", you want to pull the value from D4. If so, you can enter the following formula in row 4 and then copy it down to other cells in the column:
=IF(AND(B4="x", C4="y"), D4, "")
If you want to sum the numbers in D4:D30 that correspond to those conditions, then you can use the following SUMIFS formula:
=SUMIFS(D4:D30, B4:B30, "x", C4:C30, "y")
Hi,
Do the different parts of the countif formula all have to be contained within the same worksheet?
I have created a report which has data on one tab, and a query form on a second tab. The countif formula is looking at concatenated fields which I want it to return a value of the number of occurrences of a selected concatenated value (such as contract number and month). I am getting a zero when using the countif formula which uses the data as the first part of the countif, but the second part of the countif formula is from a cell in my query form.
If I do a countif where both table and criteria are on the same tab, I get the value I'm expecting.
Thanks,
Paul
Hi,
I need to use the COUNTIFS to count ID#’s that are between specific dates (for example: 6/22/2015 -6/28/2015; 6/29/2015-7/5/15; 7/6/15-7/12/15) but I have more than one entry for the same ID# and I don’t want to count duplicate ID#s.
Thanks
ID# Dates
UTIC05019_000 7/14/2015
UTIC05019_000 7/14/2015
UTIC05019_000 7/14/2015
UTIC05019_000 7/14/2015
UTIC05021_000 6/24/2015
UTIC05021_000 6/24/2015
UTIC05021_000 6/24/2015
UTIC05022_000 6/27/2015
UTIC05022_000 6/27/2015
UTIC05023_000 6/28/2015
UTIC05023_000 6/28/2015
UTIC05027_000 6/28/2015
UTIC05027_000 6/28/2015
UTIC05030_000 6/26/2015
UTIC05030_000 6/29/2015
UTIC05030_000 6/29/2015
UTIC05030_000 6/29/2015
UTIC05030_000 7/1/2015
UTIC05032_000 7/8/2015
UTIC05032_000 7/8/2015
UTIC05032_000 7/8/2015
Hi,
I have a table to do with letting of properties, table has following info 'property' 'type of property''applicant names' 'type of applicant, UOCC, HGR, FTA, TRA, MTA' and also the date that a property has been let.
I would need to count per calendar month, how many properties were let per applicant type?
Your help is much appreciated.
Thank you
Hello Svetlana,
the following formula is giving me some sintax error in the last field. I am trying to create a criteria ">=" that refers to another spreadsheet.
=COUNTIFS('Sheet1'!D1:D10,'Sheet2'!C5,'Sheet1'!I1:I10,'Sheet2'!">="&'Sheet2'!G3)
What would be the right expression? Thanks a lot,
Jose
Hi Jose,
The criteria can be expressed as follows:
=COUNTIFS(Sheet1!D1:D10,Sheet2!C5,Sheet1!I1:I10,">="&Sheet2!G3)
Is this what you are looking for?
Hello Svetlana,
I'm creating an wedding invite spreadsheet. I have four columns: NAME, GUESTS, RESPONSE, AMT ATTENDING. I would like to to create a conditional cell (AMT ATTENDING) on each row that will determine how many are attending. So, if the RESPONSE cell has 'N', the AMT ATTENDING cell on that should equal 0. If the RESPONSE cell equals 'Y', the ATTENDING cell should equal the GUESTS cell on the same row.
Is this possible? Thank you so much!
Hi!
Of course, you can do this by copying the following IF formula in AMT ATTENDING column beginning in row 2:
=IF(C2="N", 0, IF(C2="Y", B2, ""))
Where C is RESPONSE and B is GUESTS.
Works perfectly! Thank you!!
Hello,
I want to use the countifs formula when the value in cell E2 is present in the list PROSPECT AND when the value in cell L2 is in the list REGULAR.
I use the formule :
=COUNTIFS(PROSPECT;E2;REGULAR;L2)
However it returns #VALUE!
It works perfectly when I use a single countif formula : =COUNTIF(PROSPECT;E2)
Can you help please?
Hi Bea,
The first thing that comes to mind is checking if PROSPECT and REGULAR lists are of the same size, since the syntax of COUNTIFS requires that all the ranges have the same number of rows and columns. Is this the case?
Hi Svetlana,
they are 2 columns in a separate sheet. 1 containing 10 values, the other only 3.
Is that what you mean?
Hi Bea,
Exactly. For the COUNTIFS formula to work, both lists must have the same number of rows.
Hi,
I have a countif function that is working:
=COUNTIF('Sheet1'!C:C,"<=10/07/2015")
but I want to swap the date out for a cell reference e.g $AI$1 (will still contain the same date format). I cannot seem to get this to work.
Please help!
Hi Rachel,
The following formula seems to be the one you are looking for:
=COUNTIF('Sheet1'!C:C,"<="&$AI$1)
Dear Svetlana,
I want to count the numbers when Cell value of Column A is less than Cell value of Column B of same row. Also want to apply the same logic for continuous 10-12 rows.
Kindly suggest
Shubham,
Because your task requires comparing 2 ranges, you need an array formula like this:
=SUM((A1:A12<B1:B12) * 1)
Due to it being an array formula, you must press Ctrl+Shift+Enter to enter the formula correctly.
hello, I really need help with this.
I have two sheets- the first one has an option to put in a date range as seen below:
Start Date End Date
14/07/2015 22/07/2015
in the second sheet i have a yearly schedule for all my staff, but the way i have it laid out is the number of staff that will be in the office in the first column and the date will be in the second column, like below:
staffed Date
20 13/07/2015
21 14/07/2015
22 15/07/2015
20 16/07/2015
19 17/07/2015
What i need the formula to do is check the date range in the first sheet against the numbers and dates in the second one and return a value.
Example- i put a start and end date of my holidays into it, it checks the sheet and if i have less than 20 staffed on any of the dates specified it will say rejected. put if there is 20 or more staffed each day it will say approved.
Hi,
I am working on a spreadsheet that has some strings in columns A2:K2.
In a separate sheet I have in rows A2:A15 some strings (PP1, PP2, PP3...PP15)
In cell L2 I want to be able to put a formula to count how many time any of the strings in A2:A15 appear in A2:K2.
Thank you any help in greatly appreciated.
Matt
Hi.
I hope to get help from you.
I have in one sheet a serial number of products. In another sheet, it shows the dates to when customers called and complained about a product. What I would like to achieve is that I would like to know how many complaints a specific product received in a 7 days, 30 days and 90 days period using the product serial number as reference.
Thank You for any response.
Hi Svetlana,
I can't seem to get a simple formula to work:
I have a grid spanning 31 columns wide and 5 rows deep. In any one of the cells I can have either, "M", "H", "S", "P" or nothing.
The 5th row has to total up how many times in each of the 31 columns how many of each of the letters are shown and add them up. I'm currently trying to use this one in row 5 of column c for example:
=COUNTIFS(C5:C9,"P",C5:C9,"h",C5:C9,"s",C5:C9,"m")
The box just returns 0 even when there are matching values.
Can you help?!
I literally solved it straight after posting this - typical! Took me two hours to admit defeat and post this question, then solved it almost immediately afterwards!
I used this to fix it (I wasn't adding the values together!):
=COUNTIFS(B5:B9,"P") + COUNTIFS(B5:B9,"h") + COUNTIFS(B5:B9,"s") + COUNTIFS(B5:B9,"m")
Thanks for providing the inspiration to sort it!
Thank you
Good afternoon,
If using =COUNTIF(C5:C21,"X")/ROWS(C5:C21) to get the percentage of what X equals.
How do I edit this formula to know the percentage of what X equals if I need to add multiple columns and rows together?
Columns C & D, Rows C5:C21 & D5:D21
Columns C & E, Rows C5:C21 & E5:E21
Columns D & E, Rows D5:D21 & E5:E21
Thank you,
Kelly
Kelly,
Did you ever figure out this formula? I am trying to do the exact same thing and I cannot get it.
If you did and could share it I would be much appreciative.
Thanks!
m from a hospital background, i do need to use excel a lot to complete ma audits and various reports. m having a problem with my audit data. there are around 18 columns and about 500 rows, data validation has been applied, which gives me 3 options for each cell (yes no and NA). It is similar to your example of "COUNTIFS for text values:: counting who passed all the subjects. but in ma sheet there are three options, out of these i want to count yes and NA together and neglect no. i tried number of formulas but couldnt get the right one. atlast i counted number of "no" first in a row then subtracting it from total which gives me the value of number of "yes and NA" in same. But i was wondering if there is a possibility of counting two texts together in a single row.
Hi JOLLY,
You can add up the results of 2 COUNTIF functions, like this:
=COUNTIF(A1:F500, "yes") + COUNTIF(A1:F500, "na")
Countifs with multiple criteria as is not showing correct input
Countifs(A:A,"Jan",B:B,"User1",B:B,"User2")
result showing as 0
dear mam,
i have the following data in sheet
A B C D E
1 SL RM RM/SL JY/RM SL
2 JY SL SL RM/SL RM
3 RM RM/SL JY/RM JY SL
i want to count "SL" or any other string combine with other. which countif cirteria should i use?
Hi TEJASWINI,
You can use a usual COUNTIF formula like this:
=COUNTIF(A2:E4, "SL")
Thanks the countifs definition and example really helped me resolve a calculation issue in one of the formulas I was using.
Having a problem figuring out why a countifs formula doesn't work. I have a file that has several types of status closings in it - Verified; Verified-Paid; Verified Denied; Canceled; Taken; Assigned.
Based on the client I want to count the number of any trip status that is {Verified* or Taken* or Assigned*}
And further has the Level of Service that is any of . . .
=SUM(COUNTIFS(Table1[Broker Client],"VA Client Health",Table1[Status],{"verifi*","Taken*","assign*"},Table1[Trip Level of Service],{"ambu*","Lodg*","Meal*","special*","Mass*"}))
What am I missing with the Wildcards and {}. It's a 145000 + row file
I have a formula that is working to get my answer, but the problem is I need to use that answer in another formula and that isn't working. Any help on that?
1st Formula: =IF(COUNTIF(F:F,"*Corr*"),"1",)
2nd Formula that need to be able to count the "1" in the first formula. : =SUMPRODUCT(--('Raw Data'!C:C=C4),--('Raw Data'!H:H=1))
Hi,
I am trying to count how many consecutive days each employee works in a given date range. Here is how my spreadsheet is set up:
A1 = Title Name
A2 to A100 = Employee Names (an employee name may be lkisted 20 or more times in a row and then the next employee's name - in alphabetical order)
C1 = Date Worked Title
C2 to C100 = Dates (consecutive dates)
H1 = Hours Worked Title
H2 to H100 = Hours worked each day
So, I am trying to find for each employee, what is the maximum days in a row (consecutive days) each employee worked.
Thanks in advance.
Good Morning!
This tutorial was very helpful. I am having an issue with some dates in the formula:
=COUNTIFS(tblEvents[Date of Request],">=6/15/2015",tblEvents[Date of Request],"=J1",tblEvents[Date of Request],"<=J2")
Thank you! Tanya
Howdy,
I’m trying to figure out how (or) if I can apply countifs to my spreadsheet. What I have going:
In Column “I” I have Panel ID i.e. C3D
In Column “J” I have # of panels (“1” per line item currently)
Column “L” I have panel ID again
And “M” I have QTY
My thought process behind this so far, is when I receive a trucking invoice, I receive, i.e. 20 panels of C3D. Well, currently I have to enter C3D 20 times with a “1” next to each in # of panels to get the QTY in “M” to count it. What I want to do here is be able to enter “20” in # of panels in “J” for ID C3D in “I” and have it say, on row 9 in column J is C3D, and for that entry is 20 of them and count 20 for C3D. Say tomorrow I can 3 more C3D. Next row in row 10, C3D with 3 and the countifs not stop at the first one with just 20, but keep going and say, hey, 3 more for a total of 23.
Any help would be greatly appreciated!
No accident type A B C R
1 A Total-... ... ... ...
2 B
3 B
4 R
5 B
6 A
7 C
accident type can filter.I want to get the total for each accident type for long data sheet. Thanx a lot for this service
Hi,
15-Jun MDM
16-Jun PTP
17-Jun DTDE
18-Jun MDM
19-Jun PTP
20-Jun QTC
15-Jun RTR
Above is the one which is there in my excel.
Am using formula as to find between dates from 15th to 19th
=COUNTIF(H2:H9,">=6/15/2015")-COUNTIF(H2:H9,">6/19/2015")
Along with this, I would like to add condition which Matches I column too, say if I need to see between the date rang what are all there as "MDM", in this example it should return a count as 2.
Kindly let me now how to add the condition.
hi Murugesh, you might want to try this. was having the same problem but manage to solve it like this. reason for using DATE() was because, they are comparing date serial with text before. but since you converted your dateText to the same comparing format, it would works. hope it works for you too! :)
=COUNTIFS(H2:H9,">="&DATE(2015,6,15),H2:H9,"<="&DATE(2015,6,19),I2:I9,"MDM")
Hi,
I want a formula that counts 2 or more rows like AND gate logic.
Example:
one row is having "pens" and another row having "RED color".
I want how many red color pens are there.
Thanks in advvance for ur assistance
Hi!
Supposing that Column a is "pens" and column B is color, you can use the following COUNTIFS function:
=COUNTIFS(A1:A100, "pens", B1:B100, "red")
How to Solve this.
In cell B5, use the COUNT function to calculate the total number of students in the class.
where A17:A52 contains student IDs.e.g,393-411-8,393-440-4
etc
you dont have to ise COUNTA,COUNTIF,COUNTBLANK etc functions.only use COUNT function
Hi, I'm trying to count the number of items between two dates which meet a criteria (A3). So far i have got this, which seems to be only giving the results which are greater than 1 May as opposed to between 1 May and 31 May:
=COUNTIFS('DRAFT AUDIT RESULTS REGISTER'!$B$3:$B$100,A3,'DRAFT AUDIT RESULTS REGISTER'!$A$3:$A$100,">=1/05/2015")*AND(COUNTIF('DRAFT AUDIT RESULTS REGISTER'!$A$3:$A$100,"<=31/05/2015"))
How do i count a row based on specific column data. Like count the number of cells with numbers and exclude Fridays from the column.
well simple way is this =COUNT(E22:AI22)-COUNT(I22,P22,W22,AD22)
but i want it more automated where the COUNT(I22,P22,W22,AD22)are the Fridays and COUNT(E22:AI22) is the cells with numbers
Hi Svetlana,
Hoping you can help with my data comparison.
I have two sets of timesheet data (3 cols - project, person and hours) and i have managed to find ones where all three match between the sets. what i am trying to find out is where the Project and person match but the hours have changed... i want to find out by how much the hours have changed
So if in Set A - person x has done y hrs against Project 1
But in Set B - Person x has done Z hrs against project 1.
i would like the formula to tell me that Person X's hours against project 1 has changed by (y-z)hrs
thank you ... this would save me hours of manual work!
thanks
meena
Hi Svetlana.
I have a table and the rows contain either "TRUE" or "FALSE" in each cell.
Is it possible to count how many times have "True" happened 3 in a row on each roll? e.g TRUE TRUE TRUE
So at the following example, "True True True" happens 1 time only:
FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE
and what if I have 4 True happened in a row:
FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE
Will Excel read "True True True True" as 2 times?
Thank you!
thanks a lot Svetlana, it is really very helpful
Hi,
I have a table in excel with dates, times and list of random names for each day at different times.
I would like to be able to count how many times all the different names appear. It is very much like an attendance sheet (only I'm trying to count non attendances), with session starting every 30 minutes. Ideally, I would also like to know times and dates with most non attendances.
Thank you very much for your help.
Hi.
I wanted to know how to write a formula in Excel for the following:
Suppose there are variable names available in individual cells in a column in one sheet. Excel needs to count (and subsequently sum up) the number of times those names appear in a column in another sheet and display the answer in a cell in another sheet.
Greatly appreciate your assistance on this.
Regards,
Ken
Hi Ken,
Your Countif formula may look similar to this:
=COUNTIF(Sheet2!A2:A100, Sheet1!A2)
Where column A in sheet2 is where all the different names appear, and A2 in sheet1 is an individual cell with a variable name you want to count.
Hi,
i want to know how can i count in given below table there is final result is latest revision.
No. Rev.00 Rev.01 Rev.02
1 C D B
2 C B B
3 D C B
4 D B A
Time Criteria using counti if
=countif(A1:A100,"<="&TIME(10,0,0))
I want to know how many people arrived before 10 AM from that column.
Excel is not giving the output.
Would b great if anyone could help
Hi Sourav,
Try this one:
=COUNTIF(A1:A100,"<="&TIMEVALUE("10:00 AM"))
Hi Svetlana,
I am working on date range and I want to get the weekly counts with inclusive dates. Can you pls. help me how to figure out the cell reference with variable dates?
Thanks in advance,
Jose
Thanks Svetlana for helping me and resolve all my statistic issues.
hi i want to use cell as a criteria by counti formula,
and i could not find out solution. is it possible?
if possible how i can do it
Hi Kerem,
Of course, you can use a cell reference as a criteria. In this case, you enclose the operator in quotation marks and add an ampersand (&) before the cell. For example:
=COUNTIFS(A2:A10,">"&$D$3)
Hello,
Thank you for your helpful tips however I have a scenario non-applicable to the ones you have provided. I'd greatly appreciate if you could help me create a formula for the following scenario:
I need to get a count of Employee Names that do not have an assignment to an Employee Group. For Example:
Column A
Employee Names
Column B
Employee Group
I need a count of cells to be counted only when there is text in Column A and no text in Column B.
Currently I am using the following syntax: =Countifs(A2:A1000,"*",B2:B1000,"")
This syntax is returning a sum of cells with formulas minus those cells with data populated.
How can I fix this?
Hi Sarah,
Try this one:
=COUNTIFS(A2:A1000,"<>"&"",B2:B1000,"")
Hi Svetlana, I would really appreciate any help you can give me with the following:
I have 2 columns of data like this
Column 1 Column 2
Beer 1
Wine 2
Beer 1
Beer 2
Wine 3
and so on,is there a way to calculate the data to get the total amount from column 2 per item from column 1?
Thanks in advance,
Hi Kel,
You can use a SUMIF formula similar to this:
=SUMIF(A1:A5, "Beer", B1:B5) where column A is the product name and column B is qty.