The article explains Excel COUNTIF function, provides a number of examples and warns about possible quirks when using COUNTIF with multiple criteria and specific types of cells. Continue reading
by Svetlana Cheusheva, updated on
The article explains Excel COUNTIF function, provides a number of examples and warns about possible quirks when using COUNTIF with multiple criteria and specific types of cells. Continue reading
Comments page 13. Total comments: 1067
How can I use COUNTIF to check for duplicated entries in excel?
For example, if I have this the file below, how can CountIF show where the same STAN duplicates.
STAN Output
1234
2345
1234
5678
890
5678
6930
Edozie:
Where the STAN data is in A2:A8 the formula is:
=COUNTIF($A$2:$A$8,A2)>1 then copy it down the column.
Hi All,
=COUNTIFS(G:G, "12345",F:F, "Entry",E:E, "=500")
This formula counts well for the occurrence of the number 12345 with respect to the matching value in column E and F as mentioned in the formula.
But to make the formula worked for the next number below 12345, how will I point the next cell in this formula for the column G.
Basically I need mention the cell (G) instead of number in this formula. Tried many ways.. cudnt win.
Please help.
How to compare a condition between two table using COUNTIF function?
I mean suppose I have a column containing 'responsible party' name and another one 'rectification status'. How can I search for a condition between them using COUNTIF function?
I would like to make count of repeats in a column where another cell is blank.
Example
Number of times orange repeating where price of orange is $0.5
Another example
Number of times persons visited Dubai from Japan
Name Visited to from which country
ABC1 Dubai Japan
ABC2 Paris Japan
ABC3 Dubai China
ABC4 London Japan
ABC5 Dubai Japan
Here the answer is 2
Hey would anyone know how to use COUNTIF to compare two columns of data - dates, only counting IF the first column date is proir to the second? 30,000 data points so I cannot do it manually
Nick:
I think this is what you're looking for:
=COUNTIF(E6,">"&D6)
Where the dates are in columns E and D beginning in row 6 enter this in column F.
IFEOLUWA AKINNLO W/D ENGINEER
RAWLINGS U UWUIM BRC OPERATOR
JIMOH ISHMAEL AD W/D OPERATOR
AKANDU OKECHUKWU ELE Electrician
HENRY EYO DAVIS ELE Electrician
JOHN ETIM W/D OPERATOR
FRANKLIN IGHOROD ELE HOD
LASISI OLADIPUPO ELE D.G OP
ALEX ADEWOLE W/D OPERATOR
JIMOH RASAQ W/D OPERATOR
ADELEKE KAZEEM BRC OPERATOR
I WANT TO COUNT HOW MANY OPERATOR PRESENT DATE WISE. USING COUNTIF FUNCTION.
Dillip:
If the data is in the range A2:C27 the formula in D2 looks like:
=COUNTIF(A2:C27,"Operator")
For some reason the COUNTIF formula with dates isn't working on my spreadsheet. Say I have a list of dates in M/DD/YYYY format across multiple rows and columns. I want to use a formula to count how many of those dates fall into a particular week.
A B C D
1 4/26/2018 5/08/2018 5/15/2018 5/17/2018
2 4/26/2018
3 4/24/2018
4 4/26/2018 5/15/2018
5 4/24/2018
6 4/30/2018 5/16/2018
7 4/23/2018 4/30/2018 5/17/2018 5/14/2018
=COUNTIFS(A1:D7,">=&4/20/2018",A1:D7,"<&4/30/2018")
It should return 7, right? So why is it returning 13? I use the "&" because otherwise the value returns a 0. I'd appreciate the help.
Jon:
Does your Excel version support COUNTIFS? I use COUNTIFS for this and got the correct number which is 6.
=COUNTIFS(O23:R29,">=4/20/18",O23:R29,"<4/30/18")
When I changed the second criteria to be "<=4/30/18" the result is 8.
I'm working on a project and need to use greather or lesser than in the same Countif statement, can anyone help me can't seem to get it right.
Hi,
I'm trying to count if there was growth in a period and how much time the growth has sustained. So I need to start my count in a values greater than 0 to determine the length of time. My problem is, starting a count on the first negative number in a column determined by time, not counting every positive number in the same time series.
So I was wondering if and how you can set the criteria of COUNTIF so that one row equals another? Meaning I want to count B2:B100 if it equals A2:A100, in other words counting how many times column B equals column A in the same row.
In column C, I would add an if statement.
if(A2=B2,1,0) then AutoSum (or countif) column C.
Just found a better (quicker) way!!!
=SUMPRODUCT(0+(A2:A15=B2:B15))
Thanks, Barry! https://superuser.com/a/846065
I'm having trouble with a formula. I have =IF(COUNTIF(C2:C6,C2)=5,"YES","NO") and it works beautifully, except that I also need the result cell to remain blank if any of the cells C2:C6 are left blank. Help?
Hello
"If you want to count cells that contain an actual operator as part of the cell's contents, i.e. the characters ">", "<" or "=", then use a wildcard character with the operator in the criteria." It saved my life. Thank you
I'm trying to be able to take a column and count unique values (non-duplicates) and not count blanks. Haven't found the formula yet.
Ex. We assign ID numbers to each rqst submitted. I keep track on a spreadsheet. Each # may be used for multiple locations so they can appear more than once. I want to know how many unique ID#s I have and not count the blank cells (that are holding for new data to be entered).
Hi Can you assist,
I am using a countif formula and want to include indirect to count the number of "P" between 2 dates. I have this formula working but cant seem to get to work using indirect as get #value I want to use indirect as I have several similar sheets and just want 1 summary page.
Working formula not using indirect
=COUNTIFS(Sample!6:6,">="&B5,Sample!6:6,"="&B5),(INDIRECT("'"&$G$2&"'!"&$C6,"<="&C5),(INDIRECT("'"&$G$2&"'!"&$C8),I$7)))
G2=Sheetname which one is called sample
C6=6:6
C8=8:8
B5=From date
B6=To date
I7=P
Thanks
Matt
how do I get countif to count the value in a cell, i.e. if the cell references another cell or is a formula, "=H40" countif will not count the value in the cell, but only what is written in the cell. How do I work around this???
will yes counties does work on some formulas but not the one I am interested in
=COUNTIFS($H$50:$L$50,"=10")
will not count the output of
=TEXTJOIN("",TRUE,IFERROR(MID(H49,ROW(INDIRECT("1:100")),1)+0,""))
there are values in the cells that countif just does not see and all I get is zero.
found the problem numbers were being stored as text
Hi,
Need to count the days in Excel between two values in the same column.
For EX: How to count the value between less than 15 and greater than 30 days
please help... my professor asked as to count the name of anne so we make the formula =countif(A1:A12,"*anne*") but we need to make the string color green when the excel counts the name anne... what formula should we use? please i need answer in this confusing activity
Hi Paula,
To color cells or entire rows based on a cell value, you need to create a conditional formatting rule with a formula. In your case, the formula is as follows:
=SEARCH("anne", $A1)>0
The detailed steps to create a rule can be found here:
How to create a conditional formatting based on formula
i want to fine a value for a cell based on database
number value need ?
5 1 5 what is value
8 2
2 3
Hello, Sameer,
It looks like the VLOOKUP function will work for you.
Please find more information about VLOOKUP in this article.
Helllo - Please can you assist.
I am currently using the following formula and when there is nothing to display it shows a 0 how do I change the formula to show blank instead of 0
=COUNTIF(Table1113[@[CCN1]:[Plant & Appliances in Non Domestic Premises]],">"&TODAY())
many thanks
I would use the following to hide 0 results:
=if(COUNTIF(Table1113[@[CCN1]:[Plant & Appliances in Non Domestic Premises]],">"&TODAY())=0,"",COUNTIF(Table1113[@[CCN1]:[Plant & Appliances in Non Domestic Premises]],">"&TODAY()))
I am sure there are better answers than this, but it works for me.
Please help with my formula. I'm trying to get a total number in a cell based on text in a cell range (2 different parameters). My formula is as follows: =IF(COUNTIF(G3:G30, "Complete") < 1,(G3:G30, "Terminated") < 1,0, COUNTIF(G3:G30, "Complete")(G3:G30, "Terminated")) It is not working correctly. Any idea what I'm doing wrong? Thank you.
HELP PLS! I have a list of dates in Coulmn L and then a list of dates in Cloumn M. I want to be able calculate network days between L:L and M:M and if the difference is 3 don’t count. I then want to sum all the 1’s! I would like to do this all in one formula and without a helper column if possible. I have over the 1000 dates in column L and the same in coulmn M. Is this possible?
how can i use wild cards for numbers
I have 2 columns of data. Column A contains a date. Column B contains a temperature. Temperature measurements are made several times each day, so several rows will have the same date. I'm trying to determine how many unique days a specific temperature is reached. So, if a temperature is reached several times during the same day, it should only count as "1" occurrence.
Hi Steve! I have the exact same problem! Did you ever figure out how to do it?
Hello!
Please check out the following article on our blog, it’ll be sure to help you with your task: Count unique values with criteria and How to find unique values in Excel 2019, 2016 and earlier and How to count unique values in a column
If you have other questions, don't hesitate to ask.
I'm trying to set formula to keep track of wire by feet. B2 does not have a figure but will have one and B2 will change as wire is depleted. I want B2 to subtract entries in cells B3:B27 and show the balance of feet on hand in B2. I've put in formulas for subtracting but I can't put a formula in B2 while keeping the balance of wire in that same cell B2. HELP!
i want count for example how many (+) in an excel function in a cell
A1=4+5+6+7
so the count will be 3
is there a a function for that ?
or to count how many characters will be calculated
for the same example it will be 4
PLEASE PLEASE HELP!
If I want to count or sum a COLUMN, I can do =sum(F:F) for column F
Let's say cell A1 has F in it,
How can I reference A1 to do sum (so I can change that cell to do different columns like G, H, I, J).
I tried like =sum(&A1&:&A1&) but that doesn't help - I was hoping that would calculate as = sum(F:F)
Thanks!!!!
Hello,
Please try the following formula:
=SUM(INDIRECT(A1&":"&A1))
Hope it will help you.
Hello,
could you please help to fix my formula? something is not working here
=COUNTIFS($K$20:$K$734,"????????",$D$20:$D$734,"*.08.*")
where i have a table for date in text format (.08.), and another column where added some text. basically i need count how many cases in column K from the 8th month
Hello,
Actually, your formula for is correct, if it doesn't work, most likely there's something wrong in your table.
If you still require our assistance, please send us your workbook with the data and the result you expect to get to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.
Don't forget to include the link to this comment into your email.
We'll look into your task and try to help.
I would like to count non-empty cells, but using the count if formula, it also counts the empty ones because they have a formula that return a value of nothing/blank/empty. How to make excel not to count these formulated empty cells?
Hello,
Please try the following formula:
=SUMPRODUCT(--(A:A<>""))
Hope it will help you.
Need Help
Data
1 2 3 4
Alpha 1 Alpha 3 ? ? ?
Beta 1 Beta ? ? ? ?
Gama 1 Gama ? ? ? ?
Beta 2
Gama 3
Gama 4 Formullae required How "3" Comes In Alpha 1
Alpha 1
Beta 2
Gama 1
Beta 4
Gama 4
Beta 3
Beta 4
Gama 1
Gama 2
Alpha 1
Beta 1
Hello,
For me to understand the problem better, please send me a small sample workbook with your source data and the result you expect to get to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.
Please also don't forget to include the link to this comment into your email.
I'll look into your task and try to help.
81150001% is not available at the moment ?
Hello, I want to count qualifications. Column A has the number of days a qualification is good for, Column B has the date the qualification was completed. I want to take today's date - date qualification completed and count if it is less than the day value in Column B. Can you help?
Hello,
For me to understand the problem better, please send me a small sample workbook with your source data and the result you expect to get to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.
Please also don't forget to include the link to this comment into your email.
I'll look into your task and try to help.
I need a formula with 3 conditions
count if column AS = "sold", column B = "x" and column J = "y"
Hi!
You can count the number of values that match the three criteria with the COUNTIFS function. Read this article: How to use Excel COUNTIFS and COUNTIF with multiple criteria. I hope my advice will help you solve your task.
Hi,
I have made a few unsuccessful attempts at making a formula to count pairs of cells based on specific criteria. I need to make a formula that will count how many pairs of cells meet the criteria. For example, if A1=2 and A34=1, then it will count that as 1 pair. Upwards of 12 pairs of cells will need to be accounted for, and I cannot select a range of cells because cell pairs are far apart.
Thanks for your help
Hello,
For me to understand the problem better, please send me a small sample workbook with your source data and the result you expect to get to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.
Please also don't forget to include the link to this comment into your email.
I'll look into your task and try to help.
Hi,
I have a problem to find the proper formula for a sheet that trying to create.
In column A, I want the user to type the code of a customer.
That i have sorted with a data validation where only one entry is allowed.
However, only one entry per day. So the next day, the code should again be used.
CODE Date TIME
100 18/11/2017 14:55:36
100 18/11/2017 14:55:36
As you can see here, the code 100 can be used twice but that is what i would like to avoid.
The code 100 can only be used 1 time per day.
The sheet is for marketing purpose where the transportation expenses of a visiting customer is paid back. But only one time per day of course.
Is there a way, if possible with a data validation where i can enter a code to have a validation based upon a one time per day entry ?
Or one time 100 per day entry but the following day 100 is again usable but also then only 1 time.
I have been struggling with this issue now for 2 days and i simply can not find it.
Thanks ever so much for the support.
Eric
Hello,
Please create a custom Data Validation rule for column A using this formula:
=COUNTIFS(A:A,A1,B:B,B1)<=1
Hope it will help you.
Olá!
Gostaria fazer a contagem de células preenchidas (AI:AW), porém apenas das linhas indicadas por um critério (coluna I). É possível?
Muito obrigada!
Hello, Maria Pessoa,
Please try to use one of the following formulas:
=SUMPRODUCT(((I:I)="critério")*NOT(ISBLANK(AI:AW)))
Or
=COUNTIFS(I:I,"critério",AI:AI,"<>"&"")+COUNTIFS(I:I,"critério",AJ:AJ,"<>"&"")+COUNTIFS(I:I,"critério",AK:AK,"<>"&"")+COUNTIFS(I:I,"critério",AL:AL,"<>"&"")+COUNTIFS(I:I,"critério",AM:AM,"<>"&"")+COUNTIFS(I:I,"critério",AN:AN,"<>"&"")+COUNTIFS(I:I,"critério",AO:AO,"<>"&"")+COUNTIFS(I:I,"critério",AP:AP,"<>"&"")+COUNTIFS(I:I,"critério",AQ:AQ,"<>"&"")+COUNTIFS(I:I,"critério",AR:AR,"<>"&"")+COUNTIFS(I:I,"critério",AS:AS,"<>"&"")+COUNTIFS(I:I,"critério",AT:AT,"<>"&"")+COUNTIFS(I:I,"critério",AU:AU,"<>"&"")+COUNTIFS(I:I,"critério",AV:AV,"<>"&"")+COUNTIFS(I:I,"critério",AW:AW,"<>"&"")
Hope it will help you.
Attempting to use Countif to determine month, however data range has date stamps
data example:
Row A1 "01/11/2017 08:25:44"
Row A2 "31/10/2017 12:42:16"
attempted countif:
=COUNTIF(A1:A2,"nov") produces no result???
please advise
Hello, Rich,
Please try the following formula:
=SUMPRODUCT((MONTH(A1:A2)=11)*1)
Hope it will help you.
How do I create a formula that can work as a criteria range?
Here is an example.
COUNTIFS("T"&MATCH(W23,W:W,0)&":"&T23,T23,U$18:U23,U23,V$18:V23,V23,W$18:W23,W23)
Using countif i want count time 25:00:00 to 35:00:00. can tell me the formula to solve this???
I am trying to count the numbers that not equal in one column. for example
1
2
3
3
3
5
5
I am using count if but it's not working.
Hello, Sam,
if I understand your task correctly, this formula may help:
=SUM($A$1:$A$7*($A$1:$A$7<>OFFSET($A$1:$A$7,1,0))+IF($A$7=OFFSET($A$7,1,0),$A$7,0))
If it won't, and you need to exclude any number that appears more than once, feel free to try our Duplicate Remover add-in first, and then SUM function to sum the results.
Otherwise, you will need VBA code or a macro, but I'm afraid we won't be able to help you with those.
I realize this post is old and I might not get a response now, but I figure it's worth a shot since the original article helped me a lot.
I had started with the formula
=SUMPRODUCT((COUNTIF(F12:V2015,'Actividad (2) de LiCS'!C15:C2020)>0)*('Actividad (2) de LiCS'!C15:C2020""))
to count the number of unique names in a list that also occur in a list on another worksheet. I also wanted to know the number of such names associated with a particular date range, so I edited to
=SUMPRODUCT((COUNTIFS(D12:D2015,">"&(DATE(D10,1,1)),D12:D2015,"0)*('Actividad (2) de LiCS'!C15:C2020""))
and it worked great. But then I realized I also wanted to count the total number of names - even repeats - that occurred in both lists. I used the formula
{=SUMPRODUCT((COUNTIF('Actividad (2) de LiCS'!C15:C2020,F12:F2020)>0)*(F12:F2020""))}
to do so, and also worked great. But when I try to make similar "countifs" edits to specify date ranges, it returns a #VALUE! error. The edited formula I'm getting the error on is
{=SUMPRODUCT((COUNTIFS(D12:D2020,">"&(DATE(D10,7,1)),D12:D2020,"0)*(F12:F2020""))}
Any advice?
Thanks in advance!
~Marissa
Hi, Please see the following chart.
A B C D E
HOUSE 4 4 - HOUSE 4 4 - HOUSE
HOUSE 4 4 - HOUSE 3 - BOX
TOY 1 1 - TOY 1 2 - SHOE
HOUSE 4 4 - HOUSE 1 - TOY
SHOE 2 2 - SHOE 2
SHOE 2 2 - SHOE
SOCK 1 1 - SOCK
HOUSE 4 4 - HOUSE
BOX 3 3 - BOX 3
BOX 3 3 - BOX
BOX 3 3 - BOX
Column A is the item, column B is the count for each reoccurrence in column A, column C is =CONCATENATE(B1," - ",A1), column D counts and removes duplicates =IF(COUNTIF($B$1:B1,B1)=1,B1,"") and column E sorts and shows how many of each. The problem I am having is it only seems to count an item with a count of "1", only once so if there is more than 1 item with one occurrence, it only counts the first one. Can you tell me what I'm doing wrong?
My formulas are as follows:
Column A (no formula)
Column B =COUNTIF($A$1:$A$11,A1)
Column C =CONCATENATE(B1," - ",A1)
Column D =IF(COUNTIF($B$1:B1,B1)=1,B1,"")
Column E =IF(ROW(A1)>COUNT($D$1:$D$11),"",INDEX($C$1:$C$11,MATCH(LARGE($D$1:$D$11,ROW(A1)),$D$1:$D$11,0)))
Thanks!
Scott
Svetlana,
I am trying to use COUNTIF to count the output of a formula, e.g. a cell that contains a formula. The formula is a nested =IF() function.
COUNTIF however doesn't seem to see the output. For example, if other cells meet certain criteria, the output is "D". When I then use COUNTIF to count the "D"s it returns 0.
I'm familiar with COUNTIFS but I am using COUNTIF in this way to measure time and create a Gantt chart that doesn't overlap processes. If one process is going on, the cell returns "D" (for delay) and I can count that delay, via COUNTIF.
So, can I count formula outputs via COUNTIF, or is there another way to count formula outputs and/or display them differently?
Thanks!!
Lucas
Hello, Lucas,
COUNTIF should work in your case perfectly, I'm afraid the problem lies in something else. Perhaps, it is the spaces around "D". We could suggest you better, if you sent us your file with the formula to support@ablebits.com. Don't forget to include the link to this comment in your email.
Please don't worry if you have confidential information in your document, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.
I am trying to count certain text in a range of cells from another tab. I need to count "status" and "status date" as separate formulas for counts. I tried this but didn't work: =COUNTIF('690-JHC3 Ven 600-699'!F4:F10001,"*STATUS*")and the other =COUNTIF('690-JHC3 Ven 600-699'!F4:F10001,"*STATUS DATE*")
Appreciate the help - thanks
Hi Kim,
Try this
=COUNTIF('690-JHC3 Ven 600-699'!F4:F10001,"*"&"STATUS"&"*")
This should ensure that STATUS is counted no matter what is before or after the word.
HI THERE ,
I WANT TO CALCULATE NO OF UNIQUE ALPHANUMERIC CHARACTER(EXMP.I-INKOL17000522 OR IN17000523) MONTH WISE REMOVING DUPLICATE .NEED TO USE ONE DROP DOWN LIST OF MOTHS TO GET MONTH WISE TOTAL NO OF OCCURRENCE.
PLS HELP
Hi, Sammie,
I'm sorry, it's difficult to help you with a formula since we don't know how your data is stored.
However, If I understand your task correctly, first of all you need to sum unique values. You can do that by following the instructions from this article.
And then, using these results, you create a drop-down list.
Hope you'll find this information helpful!
Hello Svetlana,
I have been reading through your website and can't see the answer to what I thought would be a fairly common question. Can you please help?
I have a created a spreadsheet of people from 10 different work teams. The team names are in column E. Columns J through AG are a range of competencies people are required to complete.
For each person’s row, where they have completed the competencies matching the column heading I would like to record the date they completed that particular competency.
For example:
. A B C D
1 Name Team Competency 1 Competency 2
2 John Red 10/08/17 16/07/17
3 James Red 16/07/17
4 Bob Red 16/07/17
5 Sara Blue 16/07/17
6 Gale Blue 11/07/17
7 Alice Blue
8 Dave Blue 16/07/17
9 Jane Green 11/07/17
10 Blair Green
What I cannot work out is how to create a formula to count the number of people from the Blue team (or any specific team) who have completed Competency 1.
Ideally the results of these formulas will be used to create a table similar to this:
Team Com 1 completed Com 2 completed
Red 2 2
Blue 3
Green 1
Thank you for your assistance.
CS
Hi,
I want to know from you that how can I count the two cell data at a time like:
colA
OC TC
OC SC
OC SC
OC EC
OC TC
OC ST
R1 SC
R1 TC
R1 SC
R1 TC
I want to know for OC how many TC of SC and for R1 how many TC or SC Like ------------
TANK YOU.
BR,
Achira
Hi there , I have a simple table I did not set it up as pivot table. First row are dates and under each date there are columns with stock symbols( 10-50 symbols under each date average ). I am using a count if formula in conditional formatting to determine how many times each stock symbol appears in my table =COUNTIF($A$2:$Z$100,A2)=5 it is a relative reference and I ask a certain color for cells that meet criteria . I set up the range to be same as in formula A2:Z100 Every day I add up symbols and some times I delete columns that are dated more than 2 months ago. The problem is that every day after I add up a new column the range that formula apply to is changing so I have to manually set it up ( conditional formatting/manage rule /this worksheet/applies to )
How can I overcome this problem ? Basically I was looking to add up every day a column and symbols that meet criteria of countif formula to be highlighted let say green
Hello,
I am trying to write a formula to count the number of calls for the first meeting from two separate spreadsheets. I was able to count the total calls for all the meeting but I can figure out how many calls for the first meeting and 2nd meeting and so on.
My first Spreadsheet is the meeting sheet and I have customer column, created date. the second sheet is the phone call sheet with customer name and the date (each call create one date)
I used countif formula to count if the customer exist in the phone list then count the number of call but this formula only gave me the total then I added additional count if formula to say if the phone call date less than the meeting created date then count those number but all I got an error value. Can you help?
Thank you,
LE
Hello,
Please I want to group items but want to write a function so that all those who qualify are assigned 1 and those who do not qualify are assigned 0. Please help
Does Countif work with Frequency? I've found an example to count how many different values there are in a large array as the following
= SUM( --(FREQUENCY(A1:A1000,A1:A1000)>0))
so I thought that COUNTIF should work to
= COUNTIF(FREQUENCY(A1:A1000,A1:A1000),">0")
However, the formula is not accepted. Do you know if there is a limitation in the type of argument?
Is it possible to use countif function in whitch criteria is text in comment attached to the cell?