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 5. Total comments: 2051
I want to compare multiple dates for Planning dates vs. Actual dates; it seems that in planning dates there are several activities inclusion same with actual dates. I need to compare it 1 by 1 activity date and the true values will determine the condition of green, amber and red.
Hi! Please clarify your specific problem or provide additional information to understand what you need. Give an example of the source data and the expected result.
Any way please to get the function criteria at countifs from a cell with multiple values into a criteria like {"A,", "B", "C") automatically?
A B D E
Item1 London PART DEPOT
Item1 London Item1 Frankfurt
Item2 London Item2 Hong Kong
Item1 Heathrow Item1 London
Item2 Manchester Item1 London, Manchester
Item1 Sandwell Item2 London, Manchester, Glasgow
Item1 Glasgow
Item2 Glasgow
Item3 Frankfurt
For example I need a =sum(countifs(A:A,D6,B:B, {"London", "Manchester","Glasgow"}) next to E6.
E6 is London, Manchester, Glasgow separated by comma.
any quick way to write the function so I can reference this cell but in a way it turns into {"London", "Manchester","Glasgow"} within the function instead of me typing it out?
Unfortunately, the COUNTIFS function does not work with array formulas. You can write an array of values directly in a formula, but you cannot pass an array of values to a COUNTIFS formula using another function.
Can we use countifs in MS Excel with in different online sheets...
Hi! If I understand your task correctly, this article may be helpful: Excel reference to another sheet or workbook (external reference).
Hello,
I have tried using one of your formulas but I might have an incorrect understanding of it.
I am trying to count multiple criteria (frequency of the word "CVD" tagged to "Antipolo DC")
I try to use this formula =COUNTIFS(N3:N2028,"Antipolo DC",Y3:Y1048576,"CVD") but the results show #Value!
May I kindly check what I am possibly doing wrong?
Please note that Antipolo DC is a location (there are 20 other locations in the list) and CVD is an option (there are 5 other options in the list)
Hi! I have said many times on this blog that the sizes of all ranges (that is, the number of rows and columns) in the COUNTIFS and SUMIFS functions should be the same.
Hi,
I am wanting to know if there is a formula on excel that would give me employees working at a given period per day. For example - there is a total of 20 people working at the facility but they all start and finish at different times. I want to know how many people are working from 9am to 10am etc etc. hope this makes sense.
Thanks
Hi! The answer to your question can be found in this paragraph of the article above: How to count numbers between 2 specified numbers. Count the number of values greater than the start time and less than the end time. I can't offer you a formula as I don't have your data.
Hello, I cannot figure out what formula to use for this problem. Referring to the data set below... Let's say column A is an employee number and I need to count all of the Ns for that employee, how would I write that formula? The other issue is the number of rows for each employee will not always be the same. For example, employee 1260 may have 7 rows, employee 1266 may have 12 rows, employee 1279 may have 15 rows.... so the range will always be different. The next issue is that the spreadsheet has 115311 rows so I cannot individualize each formula with the employee number or range. The formula would need to find each unique employee, establish the range and then count the number of Ns or Ps or whatever within that range. I was trying the =countifs formula trying to get it to use whatever number is in A1 as Criteria1, then giving the next range and asking it to count the Ns. =COUNTIFS($A2:$A115311,"=A2", C2:I27,"N") ..... this formula did not work. LOL
Not picky if it is displayed on a separate sheet. If its easier, it could put the report on a separate sheet which would list the unique employee number followed by how many Ns, Ps, 7s, As, etc.
1260 4/2/2023 N N N N 7 N N
1260 4/9/2023 N 7 N P N N N
1260 4/16/2023 N N N N N A Q
1260 4/23/2023 A P N N N A N
1260 4/30/2023 7 N N A A A Q
1266 5/7/2023 N N A N N N N
1266 5/14/2023 N N A A P 7 N
1266 5/21/2023 N P N A A A Q
1266 5/28/2023 N N N N N N N
1266 6/4/2023 N N N A A Q N
Thank you for any help you could offer!
Hi! Read the instructions above carefully. Also note that all ranges in the COUNTIFS function must have the same size, i.e. the same number of rows and columns.
A need Help for All Apples count and only show Delivered Percentage
if i use this code "=COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Delivered")" its show (Apples Delivered 3) . if i had total 10 Apples and Delivered only 3 it will show Apples Delivered 30 %.
Hi! You can learn how to correctly calculate the percentage in this article: How to calculate percentage in Excel.
Please check the formula below, it should work for you:
=COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Delivered")/COUNTIFS($A$2:$A$11, "Apples")
Thanks for the information.
I would like to count the number of unique value based on a set of "OR" & "AND" criteria.
Given the following,
A 3366 1 0
A 3329 1 1
B 2282 1 1
B 2282 1 1
B 2282 0 1
B 3409 1 0
To count the number of unique value of column B with following criteria: column A = "B" AND column C = 1, I could get the answer with
={SUM(IF((A1:A6="B")*(C1:C6=1),1/COUNTIFS(A1:A6,"B",C1:C6,1,B1:B6,B1:B6)))}
How to add an "OR" condition to the criteria for this?
say I would like to count the number of unique value of column B with the following criteria: column A = "B" AND ((column C = 1) or (column D = 1))
of course apart from generating a new column E to do the logic.
Thank you.
Hi! We have special tutorials that can help to solve your problem: How to count unique values in Excel and Count unique values with criteria. I hope it’ll be helpful.
I'm wondering if it's possible to count selected cell with conditional formatting with a date. counting the following
A5 + A8 +A10
each cell draws information using lookup formulas and conditional formatting
A5 = date (01/05/24)
A8 = date (26/09/22)
A10 = Txt (not trained)
= number of cells greater then TODAY()
this example = 1
Hi! I recommend reading this guide: COUNTIF formulas for dates.
Or try to use this formula:
=(A5>TODAY())+(A8>TODAY())
Hello all, this is a fantastic site, I've learned so much, can't tell you! OK, I can't seem to figure out how to do this, it seems simple, I must be missing something.
I want to count cells that have certain text strings within the cell that has a whole bunch of words in it. So let's say I've got a whole bunch of cells that contain sentences like this:
Mary went to the store to get apples
James went to the store to get oranges
James went to the store to get apples
etc., etc.
I want a formula that will count how many cells contain both "Mary" and "apples". I've tried the following, but they don't work:
=COUNTIFS($A$1:$A$10,*Mary*,$A$1:$A$10,*apples*)
=COUNTIFS($A$1:$A$10,"Mary",$A$1:$A$10,"apples")
Do I need to use the AND statement? Or maybe there's an issue searching for the words in the cell?
Thanks all.
Tom
Add quotation marks to the text string. Try this formula:
=COUNTIFS($A$1:$A$10,"*Mary*",$A$1:$A$10,"*apples*")
Please have a look at this guide: How to find substring in Excel. For example:
=SUMPRODUCT(ISNUMBER(SEARCH("apple",A1:A10)) * ISNUMBER(SEARCH("mary",A1:A10)))
I hope it’ll be helpful.
This is perfect, thank you so much for replying, much appreciated!
Tom
This formula counts 5 occurrences of 'X' or more than 5 'X' as 1 and it also does not count lower case 'x' and it is good. But, how can I modify this so that it will not count interrupted appearance of 'X' in a row but only unbroken 5 'X' or XXXXX? Broken and interrupted is like this ( XXXX X, XXX__XX and others) =SUM(IF(MMULT(--(EXACT(F8:AK39, "X")), TRANSPOSE(COLUMN(F8:AK39)^0)) >= 5, 1, 0))
Hi! Your formula is not working for me. If I understand the problem correctly, try this formula:
=SUM(--ISNUMBER(FIND("XXXXX",F8:AK39)))
For more information, please visit: How to find substring in Excel
=COUNTIFS('Sheet1'!$C$2:$C$29586,">="&'Safety Event'!C$1,'Sheet1'!$E$2:$E$29586,"=Near Miss*",'Sheet1'!$BP$2:$BP$29586,"SSS 05:00*",'Sheet1'!$C$2:$C$29586,"<="&'Safety Event'!C$2)
Can you add more on top of "SSS 05:00*"? I have to add more 6 items to count. or can we just slot a table range instead?
To count lets say from July 2, 2023 (C1) to July 8, 2023 (C2) to count ---- if Column E2:E9586 is showing a text Near Miss* miss and column BP is showing the text SSS 05:00* ( I want to add more shift aside from SSS 05:00)
Not really a comment although I loved the info and was able to use it in a spreadsheet I keep active with a group of 9 golfers and therein lies my question...
I have been trying for over a month now to auto copy data in a column of cells to another column, next to it. The data in the first column changes frequently, sometimes 4-5 times a week. What I need to do is copy the data in the first column into the second column before the first column is overwritten by the data entered on any given day. It's a small table that tracks a golfers drives (distance on each hole). I am trying to keep track of their last 5 rounds but can't figure out how to shift everything over 1 column before the new data overwrites in the first column. HELP!!!!
Hi, Needed help using the COUNTIFS formula with conditions, essentially I want to be able to count the number of times any initials from the data below features in the data set below, based on the region, month and if it is H&S/Commercial. I.e I want to be able to count the number of times text appears in May for H&S, for the North Planned region and similarly the number of times text appears in May-23 for Commercial. The list of names that will appear is roughly 11-12 (I can use a wildcard for the total times text appears for that particular month but can't get it to work when trying to get it for just H&S/Commercial:
May-23
Week Commencing 01-May-23 08-May-23 15-May-23 22-May-23 29-May-23
H&S Commercial H&S Commercial H&S Commercial H&S Commercial H&S Commercial
Region Contract
North Planned Guinness - PM LH
Wrexham - Voids SR
Wakefield - External Works PCSA Stage
Sheffield City Council - Sheffield Adaptations
Leeds CC - Back to Backs
St Leger - Towers
Oldham - PFI
St Leger - New Capital Framework
Kirklees Lot 1
Sheffield High Rise
FCHO
Guinness SHDF
Incommunities
Guinness SHDF Wave 2
Places for People
Together Housing
SCC Acquisitions
Hi! Unfortunately, based on your description, I can't understand what you want to count. To calculate values for multiple criteria, you can use the COUNTIFS function as described in the article above. You can also use the SUMPRODUCT function and these instructions: Conditionally count / sum / average cells with multiple criteria.
Or explain the problem in more detail.
Last attempt at this.
Sorry for the spam, but this message system is posting stuff I'm not typing and not posting stuff I am.
I have a datasheet and then a stats sheet, I'm trying to populate the Stats sheet automatically from data entered into the data sheets based on a monthly period.
Jan, Feb, Mar etc.
My formula is a COUNTIFs which first checks outcome column for the word "Positive NR" then it checks the Date Column for dates ">=" and "="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"<="&Data!A2)
Yeah its done it again. Cannot send you my formula, but believe me the ones which are working and the ones which doesn't are identical other than the "Positive" and "Positive NR", so cannot work it out.
Hi! Study carefully the last paragraph in the article above. Here is an example of the formula:
=COUNTIFS($I:$I,"Positive",$A:$A,">="&A1) - COUNTIFS($I:$I,"Positive", $A:$A,">="&A2)
Hi,
I'm trying to create a spreadsheet for work which will calculate the statistics for each month throughout the year based on another spreadsheet we use to hold all the data.
So we have a column with received date, a column with District and another column with an outcome.
What I'm trying to do with limited success is Check "Date Received" column for any dates within each month, then check another column with those dates which matches 1 of 5 words added to that column.
Example 1:
Column A - Check for all Cells with Dates between and including 01/01/2023 to 31/01/2023.
Column C - Check for all Cells with Text containing exactly "POSITIVE".
Below my Formula (I have a separate datasheet hidden on the workbook which contains all my month dates).
=COUNTIFS('[SS Stats 2023.xlsx]2023'!$I:$I,"Positive",'[SS Stats 2023.xlsx]2023'!$A:$A,">="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A23,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"<="&Data!A2)
Any assistance on this would be great, as its driving me up the wall right now, it should work and I cant see why it doesn't :(
Hi! Pay attention to the last paragraph of the article above: Count dates with multiple criteria. Count the values where the dates are greater than the start date, subtract the values where the dates are greater than the end date.
Welp same issue again.
=COUNTIFS('[SS Stats 2023.xlsx]2023'!$I:$I,"Positive",'[SS Stats 2023.xlsx]2023'!$A:$A,">="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A23,'[SS Stats 2023.xlsx]2023'!$A:$A,"="&Data!A1,'[SS Stats 2023.xlsx]2023'!$A:$A,"<="&Data!A2)
Ok I give up, it wont let me post my message or any variation of it, and all it does is make it look like my formula is massively wrong when the above formula has some "=" statements inbetween the ">=" and "<=" statements. I dont know how to fix it.
I'm trying to do =COUNTIF(B:B, C:C-9) and it's not working.
How do i get around this?
Hi! I don't really understand what you want to calculate. But the arguments to the COUNTIF and COUNTIFS functions cannot be formulas. They can only be values or cell references. Read the article above carefully.
Hi
I am trying to write a count if formula to count between two dollar figures...which appear
C4-DB4 is a run of varying $ amounts
DE4 is the max value (FORMULA)
DD4 is 10% less than max value (FORMULA)
=COUNTIFS(C4:DB4,">=DE4", C4:DB4,"<=DD4")
The above forumla wont count the number of $ values between max and 10% discount. Please help!
Hi! If I understand your task correctly, try the following formula:
=SUMPRODUCT((C4:DB4>=DE4*0.9)*(C4:DB4<=DE4))
For more information, read Excel SUMPRODUCT function with multiple criteria.
Hello,
I'm trying to write a formula that uses data from different cells based on where today's date falls within a date range. This is what I have:
=IF((AND(TODAY()>=DATE(2023,6,1),TODAY()0,CPEP!A9),"")
Obviously, this isn't working. Any ideas?
Hi! Your formula is not written down completely. You may find this article helpful: Excel IF between two dates.
If this is not what you need, explain the problem in more detail.
=IF((AND(TODAY()>=DATE(2023,6,1),TODAY()0,CPEP!A9),"")
I don't think it is showing the full formula.
Thanks for the information it helped me a lot, I Tried to combine cells as a cross criteria search.
=COUNTIFS(D$1:D$94,D101,J$1:J$94,"X")
The " X " Mark means was punched on a different Day (Monday,Tuesday, etc) for Example if Cell J1 has mark and Value D101 is in the range criteria, it will count, but only if both met the criteria ( values and X mark).
Hi,
Is it possible to tag a progress with each cell containing different data?
The information will be tagged as "complete" if either "email", "mobile no.", or "address" is provided. It does not necessarily need to have all the information (at least one of the 3 should be fine)
Thank you!
Steve
Hello! To find a partial match of text in a cell, use these instructions: How to find substring in Excel
If a single match is sufficient, use the logical OR function. For example:
=IF(OR(ISNUMBER(SEARCH("address", A2)), ISNUMBER(SEARCH("email", A2))),"complete","")
Hi Alex... Im suffering here...
I need to count how many F there are in multiple colums
If I count the "F" in one column, works great:
=COUNTIFS(A:A,"JUNE",B:B,"F")
but what i really need is to count the "F" in multiple columns:
=COUNTIFS(A:A;"JUNE",B:K,"F")
and it doesnt work, what am I doing wrong? is there a way I can do this?
any help, will be appreciated.
thank you! claudia
Hello! All the ranges you use in the COUNTIFS function must be the same size. That's why your formula doesn't work. I recommend reading this article: Excel COUNTIF and COUNTIFS with OR logic.
Here's an example of the formula:
=COUNTIFS(A:A,"JUNE",B:B,"F") + COUNTIFS(A:A,"JUNE",C:C,"F") + COUNTIFS(A:A,"JUNE",D:D,"F")
oh... got it..that is what i was afraid of... i didnt want to make the formula too long...
thank you so much, let me check that part of the article again!
thank you, Alex!!
I have list of trainings in rows and completion status in columns against the resource. How can I use COUNTIF formula to see number of resources who have completed / in progress for each training? Kindly help
If the formulas and examples in the article above don't work for you, give an example of the source data and the desired result.
is something like this possible?
IF(COUNTIFS(R2,"value1*",S2,"status1"),"aaa","bbb"),IF(COUNTIF(R6,"value2*"),"aaa","bbb")
or
IF(COUNTIFS(R2,"value1*" OR "value2",S2,"status1" OR "status2" or "status3"),"aaa","bbb")
Thanks
Your formulas cannot work. Please study the examples in the article above, and also these manuals: COUNTIF function in Excel - count if not blank, greater than, duplicate or unique and Excel COUNTIF and COUNTIFS with OR logic.
Why do I get an error message with th3 following excel formula?
=IF( COUNT(B90:C90)=2,MOD(C90-B90,1)*24,0)
The error message only shows up after the date is added in Column A. Start time is column B and end time is column C.
Thank you!
Hi! I can't check your formula because I don't have your data. An error is possible if the cells contain text but not time. Also, I can't guess which error message you see. Note that there is no reference to column A in the formula.
Hello Dear Team,
I have an question that is possible to count three or four things with a single formula against every value as shown in the data:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 P H A L s/l
P P P P P H P P P P P P H P L L P P P H P a a P P P H S/L S/L P P 21 4 2 2 2
Hi! Unfortunately, this information is not enough to understand what you need.
i want to count total no. of P,H,A,L and s/l with a single formula from the given data.
Hi! If I understand the question correctly, the formula might look something like this:
=SUM(COUNTIF(A1:T1,{"P","H"}))
Thanks a lot Sir,
Actually I want to count all P in column "P"
Count of all H in column H at the end and all L,S/l in their respective column simultaneously with a single formula
e,g: total P=24
Total H=5
Total L-3
Total S/l=2
Hi! If I understand your task correctly, use a separate COUNTIF function for each column. For example,
=COUNTIF(H1:H100,"H")+COUNTIF(P1:P100,"P")
Thank you so much, I coundn't remember how to use more then one formula on the same cell and somehow this was the only post that used the + to help me count more then one different word into the same cell.
Hi alexander,
I have two column of products and I need to find out if a certain brand of a retailer is offered at the other retailer in the other column. Offered by 'retailer ' 'yes' = 1, if not offered then = 0
is it possible to find out if a brand is offered in the other column without using a specific wildcard? otherwise the wildcard will have to be changed per product and this would not be possible.
Hi! We have several instructions on how to identify duplicates in two columns: VLOOKUP to compare two columns in Excel for common values and How to compare two columns in Excel for matches and differences. I hope this will help, otherwise don't hesitate to ask.
Hi, I got small problem.
I cannot find a way to formulate a suitable formula. I hope you can help me.
I have to count how many of the people who worked on the DON project were between the 16 and 24 years, male, from China. I need to include all of this as of 12/31/2015. Most important is fact that some of people quit work before that date so I need to exclude them.
Start of contract is between C3 to C100, end of contract D3 to D100, Birth date E3 to E100, country of residence is F3 to F100, project name is G3 to G100, gender I3 to I100.
I made it as per the formula below, but I don't know how to count the age bracket correctly (between 16 and 24 years) and eliminate people who finished work before this date (12/31/2015).
=COUNTIFS(C3:C100, "<=12/31/2015", F3:F100, "China", G3:G100, "DON", I3:I100, "M", )
TIA John
Hello!
The COUNTIFS function cannot use other functions or formulas as arguments. Therefore, I recommend using the SUMPRODUCT function.
=SUMPRODUCT(--(C3:C100<=DATE(2015,12,31)), --(F3:F100="China"), --(G3:G100="DON"),--(I3:I100="M"), --(DATEDIF(E3:E100,TODAY(),"y")>=16), --(DATEDIF(E3:E100,TODAY(),"y")<=24))
You can also find useful information in this article: How to calculate age in Excel.
Hi Alexander,
Im a new user, how do I express eg that the Yes must relate to the occurrences of LS rather than any Yes that appears in the column.
=COUNTIF('Action Log'!G23:G83,"LS")-COUNTIFS('Action Log'!I23:I83,"Yes")
TIA Karen
Hi! If both of your conditions must be met simultaneously, use the COUNTIFS function to calculate the quantity of values. Read this article above.
Try this formula:
=COUNTIFS('Action Log'!G23:G83,"LS",'Action Log'!I23:I83,"Yes")
I am trying to incorporate wildcards into a COUNTIFS with three criteria because the data is coming from a sharepoint and sometimes includes date and time and sometimes only date and I need to look only at dates. So far this is what I have.
=COUNTIFS('WT Outflow Import'!B:B,$B$4,'WT Outflow Import'!A:A,C18,'WT Outflow Import'!C:C,$B$6)
B6 is the cell containing the date.
The above formula returns what I need if there is no time present with the date in the cell. Otherwise it returns nothing as expected. I need the value matches regardless of whether there is date/time or just date. This is a sharepoint connection, so I don't have the luxury of just changing the data.
I tried using a wildcard and it also returns nothing.
=COUNTIFS('WT Outflow Import'!B:B,$B$4,'WT Outflow Import'!A:A,C18,'WT Outflow Import'!C:C,$B$6&"*")
Any idea where I am going wrong here?
Hi! To use only the date and ignore the time, round up the date and time to a integer number. For example, using the INT function: as INT($B$6)
Is it because the column where I am parsing using the wildcard is a date (number)?
Hi there, I am trying to program a workbook to pull data from different sheets and am hitting a roadblock in trying to program my COUNTIFS formula with multiple criteria.
I am pulling survey data and am looking at the number of compliments per city. In this instance, I have it programmed to pull the comment number that are compliments and from the city, but where I am running into trouble is that the city field comes back to me and can reflect the city of North Fort Myers as "NORTH FORT M" and "N FORT MYERS".
I am trying to figure out how I can program it so both of these are picked up for the same total number. I currently have my formula as =COUNTIFS(Test!O:O,List!W2,Test!D:D,List!C2). But for the data in column D, I want it to be pulled if it reflects the info from cells C2 and D2.
Hoping this is clear and you can help! Thanks.
Hi! Unfortunately, the COUNTIFS function cannot calculate approximate matches. To use the formulas, correct the typos. You can use the Find Fuzzy Duplicates tool to do this. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
Hi Alexander,
I'm trying to use Countifs with Text.
I have a column with Girls attending classes. In that column I write yes or No.
I then would like to calculate or create a formula in a separate column, that if that specific cell says "Yes" it would allow the formula to occur if it says "No" it would just appear as £0.
Hoping you can help me.
Thanks
Hello! I don't really understand what result you want to get. If you want to count the quantity "Yes", use the COUNTIF function: COUNTIF(B2:B10,"Yes")
If you want to calculate a formula by condition, use the IF function.
Is this also possible to occur with a Dropdown with either yes or no? And How would I allow the formula to occur or have it cancel it out if it say no.
Thanks
Hi Alexander,
What would be the formula for the following example:
Column A has three entries "house", "bungalow" or "flat". Column B has the 'area' of the building. I want to calculate the total area when Column A has either "house" or "bungalow" entered.
I hope this makes sense!
Thanks :)
Hi! The following tutorial should help: Excel SUMIFS and SUMIF with multiple criteria – formula examples.
For example,
=SUMIFS(B1:B10,A1:A10,"house") + SUMIFS(B1:B10,A1:A10,"bungalow")
Hi, I am trying to total how many times a participant has attended a class over a 6 week period. I have Column A containing the names of participants, column B containing the date attended. These participants names listed in column A are repeated in alot of cases as they might attend multiple times over this period. I am wanting to lookup column A, find the exact same names/search criteria and return a total "number" for the sum of how many times their name appears over this period. This would then tell me that "Joe Blow" attended this class 20 times over a 6 week period. Thank you. Ruth :-)
Hi! I hope you have studied the recommendations in the tutorial above. It contains answers to your question. Here is an example formula for your case:
=COUNTIFS(A1:A100,"Joe Blow", B1:B100,"<"&TODAY(), B1:B100,">"&(TODAY()-42))
Hi,
I have 2 columns. Column A shows the time and Column B indicates if a button is pushed with 1='button pushed' and 0='button not pushed'. i need to measure the time between every button push (or the number of cells between each '1' because each cell is equal to 1 minute) but the data spans over 2 weeks (=20 000++ cells). is there a way to make a list of the duration for every "downtime" (time between every button push) without doing them one by one?
for example, collumn B would look something like this:
0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,....
so the first downtime is 22 minutes, second downtime is 6 minutes, third downtime is 18 minutes and so on.
thanks in advance!
Hi! If I understand your task correctly, the following formula should work for you:
=SEARCH("#",SUBSTITUTE(CONCAT($B$1:$B$3000),"1","#",ROW(A2))) - SEARCH("#",SUBSTITUTE(CONCAT($B$1:$B$3000),"1","#",ROW(A1)))-1
Copy this formula down along the column. I hope this will help.
Thank you so much! it works wonderfully!
I changed the '3000' in '$B$3000' to the number of the final cell.
why do we need to use ROW(A1)? I substituted it with 1,2,3,.... and it work just fine, but your method also work. what is the difference?
If you copy the formula down along the column, the value of ROW(A1) will automatically change and return 1,2,3...
Ok everything is clear now! thanks again!
I need help in my file as per below sample.
I have multiple items, some are with same "PCA P/N" and some are not same and it has different date reject each PCA P/N recorded.
Then, what I need is to count the specific PCA P/N which still "OPEN" status and with less than 30days from now.
Another column and formula is for less than 60 days, and next is less than 90days from now.
For example the Date Reject is at column A:A, PCA P/N is at column B:B and the status is at column C:C.
Date Reject PCA P/N STATUS
5-Aug-22 AEM5300-66402 open
Hope you guys understand my statement.
Hi! If I understand your task correctly, try the following formula:
=SUM(((TODAY()-A1:A20)<30)*(B1:B20="AEM5300-66402")*(C1:C20="open"))
or
=SUMPRODUCT(--((TODAY()-A1:A20)<30),--(B1:B20="AEM5300-66402"),--(C1:C20="open"))
For more information, please visit: Excel SUMPRODUCT function with multiple criteria - formula examples.
Thanks for your response. But after I've tried, this is the results.
for this one -> =SUM(((TODAY()-A1:A20)<30)*(B1:B20="AEM5300-66402")*(C1:C20="open")) results shows "0".
and for the 2nd formula shows #VALUE!.
I'll check on your link provided for more other info.
Thanks again.
I wrote this formula based on the description you provided in your original comment. I can't see your data and can't know what dates you are comparing. Also check the dates in column A. If it's text and not dates, the formula doesn't work. Please note that if you’d provided me with the precise and detailed description of your task from the very beginning, I’d have created a different formula that would have worked for your case.
Hi Sir,
Appreciated your response and thank you.
Actually the output should be like this.
Model <30 days <60 days <90 days 120 days
M5300-66401 8 3 1 0 3
Everyday it will count those within 30 days from today, those within 60days from today and so on.
Those status still "open", and yes the column A is formatted as date.
By right your formula will work but i don't get it also why having error.
Hi! Your answer does not contain any new data that would help give you advice. Check column A. I think it contains text that is formatted as a date. Pay attention to the following article: How to convert text to date in Excel.
I'm checking the error and evaluate the formula shows the date is "45072-A1:A20".What do i need to change or format?
Hi, Please help with the below formula.
The top performer's indication with a yes or no is in column "L". Country is in column X. Now I would like to understand the % of top performers in the United Kingdom and Ireland countries. Used the below formulae but couldn't get the correct %. Please help.
=COUNTIFS('Successors List'!L:L,"Yes",'Successors List'!X:X,"United Kingdom","Ireland")/COUNTIF('Successors List'!L:L,"Yes")
Hi! Pay attention to the following paragraph of the article above: How to count cells with multiple criteria (OR logic).
It covers your case completely.
COUNTIFS('Successors List'!L:L,"Yes",'Successors List'!X:X,"United Kingdom") + COUNTIFS('Successors List'!L:L,"Yes",'Successors List'!X:X,"Ireland")
Hi, Many many thanks for responding. I've used the formula already. However, it shows 3000% which is weird. Do you know why is it not giving the right %?
I can't check your formula because I don't have your data.
* To clarify, the "Successors list" is the top performers list in the Excel file.
Hi!
Would love some formula help here, if possible.
Sheet 1: Customer email (column A), Survey completion date (column B)
Sheet 2: Customer email (column A), Order date (column B), Unique order # (column C)
On Sheet 1 in column C, would like a formula to count quantity of unique orders on Sheet 2 by customer email BEFORE OR ON the survey completion date
Is this something you could help me with?
Hello!
If I understand your task correctly, the following formula should work for you:
=SUM((COUNTIFS('1'!A1:A10,'2'!A1:A10,'1'!B1:B10,">="&'2'!B1:B10)))
Hi Alexander,
I follow your topics and website. You are genius of solving the problems. And you help me many times here.
My question is:
I have one cell A1. Every week in this cell is entering one of this letters ("A", "B", "C","D") from another sheet. . I want to count this letter and multiply by different number.
For Example: countif(A1,"A")*13.75 ........... countif(A1,"D")*2.75 ............ countif(A1,"C")*5.5 ............... countif(A1,"B")*8.25
I want to put this in one formula.
Thank you
Hi! You can get a number depending on the value of the cell using the IFS function.
IFS(A1="A",13.75,A1="B",2.75,A1="C",5.5,A1="D",8.25)
But I'm not understood what result you want to get and why you should use COUNTIF in the one cell.
I thought that I have to use countifs, because i have multiple criterias. Also think about IF with OR. But couldn't put together.
Thank you for quick response.
Result is based on £. For example: if in that cell A1 is D, then I want to be multiplied by 2.75£. People are receiving bonuses for their hard work.
I make setup with your formula IFS and this solve my problem.
Thank you very much.
how can i count total number of unstanding payment for one registration number ( different pay rate) from different worksheet( one worksheet for one month) for the whole year.
Hi! Create a COUNTIFS formula for each sheet separately, and then sum them up.
Maybe this article will be helpful: Excel reference to another sheet or workbook (external reference)
Hi,
Could you please help to solve below problem?
I just need to get the result with count of text from two columns in a particular range whether the values are same for both cells or different in both cells, the values shall be counted as one only.
Example:
A B
Apple Orange
Orange Mango
Apple Orange
Apple 2
Orange 3
Mango 1
Hi! To count the number of values by condition, use COUNTIF function and this guide: COUNTIF function in Excel - count if not blank, greater than, duplicate or unique.
For example:
=COUNTIF(A1:B6,"apple")
Sorry, a change in example:
A B
Apple Apple
Orange Mango
Apple Orange
Apple 2
Orange 2
Mango 1
=SUM(COUNTIFS($A$2:$A$11,"apples",$C$2:$C$11,{"cancelled","pending","in transit"}))
how we write like this
=SUM(COUNTIFS($A$2:$A$11,"apples",$C$2:$C$11,{"="&H1(Like),"="&H2(Like), "="&H3(Like),"="&H4(Like)}))
Hi! Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Hi
I'm looking at calculating the count of employees who belong to the United Kingdom and Ireland. But I need to calculate just within 4 cells and not more.
The country is in the AF column, and I need to look at the formula calculating no. of employees who are in the UK and Ireland in 2 different time frames.
Used the below formula but is not working. AF52:AF53 is one time frame and AF57:AF58 is another timeframe.
=COUNTIFS(AF52:AF53,"United Kingdom",AF57:AF58,"United Kingdom") + COUNTIFS(AF52:AF53,"Ireland",AF57:AF58,"Ireland")
Please help!!!
This may help.
=COUNTIFS(AF52:AF53,{"United Kingdom","Ireland"})+COUNTIFS(AF57:AF58,{"United Kingdom","Ireland"})
Hi! I can't check your formula because I don't have your data. Note, however, that the COUNTIFS function only counts when, for example, AF52=AF57="United Kingdom"
Hi,
How do copy the formula to another cell with skipping AZ-BA (2 Columns) of data.
=COUNTIFS(AV$6:AV$75,"12x12",AW$6:AW$75,"Prep")+COUNTIFS(AV$6:AV$75,"12x12",AX$6:AX$75,"Prep-c")+COUNTIFS(AV$6:AV$75,"12x12",AY$6:AY$75,"Prep")
into
=COUNTIFS(BB$6:BB$75,"12x12",BC$6:BC$75,"prep")+COUNTIFS(BB$6:BB$75,"12x12",BD$6:BD$75,"Prep")+COUNTIFS(BB$6:BB$75,"12x12",BE$6:BE$75,"prep")
Hi!
I recommend reading this guide: How to copy formula in Excel with or without changing references.
Hi,
I have this table with list of names and 3 columns for the status. The reference is from another sheet. i used countifs with 2 conditions and working except for 2 names, that returns the value of 0. I checked the reference and they should value greater than 0. I tried it also in google sheet and got the same result. Also, tried changing the format but no changes. Hope you can help. Thank you.
The formula is like this
=COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,B1)
Hope you can help. Thank you.
Can anyone
Hi! I can't check your formula because I don't have your data. It is possible that your values have extra spaces, unprintable characters, or decimals that are hidden by the number formatting.
Hi! I would like to ask about, what formula is the best for this situation:-
COLOUMN A : Name of officer
COLOUMN B : Name of officer
COLOUMN C : Numbers of day taken to complete the task
Reason why there are two column is the task need to 2 officers to be completed. So the question is, how do I want to count if the officer (e.g Lisa) has completed her task less than 7 days.
Thank you.
Hi! You can use the COUNTIFS function to calculate an sum for several conditions. Use this guide: How to use Excel COUNTIFS and COUNTIF with multiple criteria.
It is not possible to give more detailed advice since you have not provided any data.
I need some help! I am an OB provider and in the last 6 years, my male-to-female fetus ratio is 2:1 (which is wild). I am trying to see if the sex discrepancy is the strongest based on specific indications (such as mothers over 35 or patients I saw due to sonogram anomalies). I have my indications (the reason they saw me) in one column and male or female in another column. I use this [COUNTIF(F:F, "(u/s)*")] to indicate patients that were seen due to sonogram anomalies and [COUNTIF(I:I,"*male*")] to indicate all male fetuses.
Can I combine the two and see whether the indication changes the sex ratio?
Hi Alexander!
Thanks for your blog, it's very useful. I had a question, I hope you can help me. I would like to count how many cells in a column contain simultaneously certain words (not just one word, as CTRL+F would be enough). Let me explain better.
I'm doing a list of magazine articles that talk about several topics, I'm classifying them. For example, let's say I have 50 articles, one listed under the other (in 50 rows), and categorized through 4 criteria (columns): theme of the Article (column A), Author (column B), Title (column C), Editor (column D).
The important one is Column A, where I list the topics each of the articles talks about. So in each cell of Column A, for each article, I put certain keywords separated by commas. Example:
column A (Topics present in the article) column B (author) column C (title) column D (editor)
Row/article 1: food, travel, social media, money XXXXX XXXXX XXXXX
Row/article 2: food, money, tourism XXXXX XXXXXX XXXXX
Row/article 3: travel, food, sustainability
Row/article 4: social media, money, travel
Row/article 5: sustainability, food, social media
QUESTION: How many cells of column A contain both "food" and "travel"? Or both "travel" AND "money" AND "food"?
I would like to know many articles talk about several topics at the same time, so how many times certain keywords are mentioned simultaneously within the same cell. For example, how many articles talk about both food and travel (how many cells of column A contain both "food" and "travel")? How many articles talk about both money and social media (how many cells of column A contain both "money" and "social media")? And even three topics simultaneously.
Thanks in advance for your help!
Take care,
Hi,
I wonder if you could help me. I have table need to find the correct formula to use,
i want to count the duplicate with multiple creteria.
example :
time date customer Flavour number invoice
2:43 am 07/04/2023 linda jitsu 123
2:44 am 07/04/2023 linda Belt 456
2:45 am 07/04/2023 Henry Belt 789
2:45 am 07/04/2023 Henry Belt 897
2:45 am 07/04/2023 Henry jitsu 456
2:46 am 07/04/2023 Henry Belt 789
how we use countif for flavour Jitsu will show duplicate if more than 1 time entry and for flovour Belt will show duplicate if more than 3 times entry?
Hoping for your help in this matter .
Thank you very much
Best Regards