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 4. Total comments: 599
This Fomula is giving me a Spill error.
=FILTER(A2:A500>="9/1", A2:A500<="9/30")*(COUNTIFS($E$2:$E$500,"*ER*",$I$2:$I$500,"EOU"))
What I am trying to do is in Colum A I have Sept, Oct and Nov dates, which is our Quarter1. Then I have other columns which have drop downs in them (column E and I). So what I need to do is be able to filter these 2 COUNT IFS criteria, by month. And break it out my months within the Quarter 1 spreadsheet tab.
Any assistance would be greatly appreciated!
Hello!
The #SPILL! error occurs when a formula cannot return an array of values to a worksheet. It is possible that the cells already have some values. For more information, please read: Excel #SPILL! error - causes and fixes. I hope I answered your question. If something is still unclear, please feel free to ask.
Hello, I've been struggling with this for some time. I have two sheets.
One sheet has: Sheet two:
COL A|COL B |COL C COL A| COL B| COL C
Player|Week|Points and the other has Name|Name|Both
Objective is to match names in COL A and B from sheet two to COL A in sheet 1.
However the criteria must be-
COL C(Points) must be greater than 26 for the name in COL A( sheet 2)
COL C(Points) must be greater than 20 for the name in COL B(sheet 2)
Both of the above criteria must have been met on the same date.
Any help would be greatly appreciated. the current formula i was trying is:
=COUNTIFS(Table2[FDPoints],">=26",Table2[Player],B75,Table2[Week],10/10/2021)/2+COUNTIFS(Table2[FDPoints],">=20",Table2[Player],F75,Table2[Week],10/10/2021)/2
Hello!
The following tutorial should help: Using Excel COUNTIF function with dates.
I think there is an error in your formula.
Thank you.
So this formula will give me almost what I am looking for:
=COUNTIFS(Table2[Player],[@QB2],Table2[FDPoints],">=26",Table2[Week],"=9/11/2022")+COUNTIFS(Table2[Player],[@RB],Table2[FDPoints],">=20",Table2[Week],"=9/11/2022")
However if one name meets the criteria, it still adds the value. How can I made it add nothing if both names do not match there set criteria.
Example:
1 player has 26 points or over, the other player has 20 points or over. If both are not met, then it does not add.
Currently, if player[QB2] has over 26 points, and player 2[RB] has less than 20, it will return: 1
If both players meet criteria, it returns 2.
I would like for it to be counted as 1 if both criteria is met, but not to count if both are not.
Thank you!
Hi!
If I understand correctly, try to use IF AND function.
=IF(AND(COUNTIFS(Table2[Player],[@QB2], Table2[FDPoints],">=26",Table2[Week],"=9/11/2022")>0, COUNTIFS(Table2[Player],[@RB], Table2[FDPoints],">=20",Table2[Week],"=9/11/2022")>0),1,0)
For more information, please visit: IF AND in Excel: nested formula, multiple statements, and more.
That works perfectly. Now my data contains 18 different dates. Any way to add them up without making a long formula as it will freeze excel if over so many characters?
=IF(AND(COUNTIFS(Table2[Player],[@QB2], Table2[FDPoints],">=26",Table2[Week],"=9/11/2022")>0, COUNTIFS(Table2[Player],[@RB], Table2[FDPoints],">=20",Table2[Week],"=9/11/2022")>0),1,0)+IF(AND(COUNTIFS(Table2[Player],[@QB2], Table2[FDPoints],">=26",Table2[Week],"=1/9/2022")>0, COUNTIFS(Table2[Player],[@RB], Table2[FDPoints],">=20",Table2[Week],"=1/9/2022")>0),1,0)+IF(AND(COUNTIFS(Table2[Player],[@QB2], Table2[FDPoints],">=26",Table2[Week],"=1/2/2022")>0, COUNTIFS(Table2[Player],[@RB], Table2[FDPoints],">=20",Table2[Week],"=1/2/2022")>0),1,0)
etc.
Thanks again
It is actually working great. Thanks for your help!
we have data in column like
AOHO001
AOHO002
AOU1003
AOU2004
AOU3005
AOU1006
AOU2007
AOHO008
we have to count how many no. are AOHO
Hello!
To search for a group of characters in text, use the SEARCH function. Use the ISNUMBER function to determine the cells in which the search was successful.
Please check the formula below, it should work for you:
=SUM(--(ISNUMBER(SEARCH("AOHO",A1:A10))))
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.
Hello!
To get a sequence of numbers, use the SEQUENCE function.
You can use this formula:
=CEILING(SEQUENCE(10000,1,1,1)/59,1)+999
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
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.
OK. Great thanks.
So there isn't any way to have an array of criteria ranges being checked against a single Criteria?
Hello!
Try SUMPRODUCT function with multiple criteria that can work with arrays.
For example,
=SUMPRODUCT((N:P>0.0137)*(N:P<0.0432)*(A2=$C:$C))
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?
Hi!
You do not need to use the & operator in the COUNTIFS formula. Try this formula:
=COUNTIFS($K$2:$K$5541,"Smith, Mary (56123)",$H$2:$H$5541,"BHA")
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
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.
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!
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))
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!
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.
=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.
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.
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?
Hello!
The answer to your question can be found in this article: Count the total number of duplicates in a column.
This should solve your task.
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!
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.
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.
Hello!
You can find the examples and detailed instructions here: Count unique values with criteria.
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,B2:B10=E1))), 0)
E1 -- year
I hope this will help.
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!
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.
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")
Figured this out. Thanks.
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.
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
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.
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
Hello!
If I understood you correctly, then the second criterion can be excluded from the formula.
=COUNTIFS(SFK!$O$8:$O$500,$M$5)
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)
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.
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.
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.
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?
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*”)
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.
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.
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.
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.
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
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
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]
Hello!
As I understand the problem, then you should use the SUMIFS function. You can learn how the SUMIFS function works with dates in Excel in this article on our blog.
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")
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.
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?
Hello!
To count on multiple conditions, use the COUNTIFS function. Please read the above article carefully.
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.
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
Hello!
You can use the IF function with multiple conditions. I cannot offer you a formula, since your conditions are incomprehensible to me. On the first line, both TRUE and FALSE are true. If not, give an example of the result you want.
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
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!
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!
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
Hi!
You can use the formula
=COUNTIFS(A2:A100,100,B2:B100,DATE(2021,10,12))
If you need to calculate the unique values of materials, then I recommend the article: How to count unique values in Excel with criteria.
I hope my advice will help you solve your task.
Hey,
I'm trying to use COUNTIF to look at 2 different collums and if both of the values are true to count, this is my formula but it is not working;
=COUNTIF('2021 Requests'!C6:C440, "Granted",'2021 Requests'!D4:D440,"07/01/2022")
Any help would be appreciated.
Needs to be COUNTFS not COUNTIF
also the range of C should be the same size as the range of D
so EX.
=COUNTIFS('2021 Requests'!C4:C440, "Granted",'2021 Requests'!D4:D440,"07/01/2022")
I have three colms
A B C
Loss amnt reason
Yes 100 Retrun
i have tried countifs( B1:B10,"<100",C1:C10,"return") but actual picture will be on the basis of Loss ( Yes or No). what is the formula for that.
Hi!
If you want to calculate the amount of losses, then use the SUMIFS function.
=SUM(COUNTIFS(D24,"*P*"),(COUNTIFS(D55,"*P*")),(COUNTIFS(D104,"*P*")))
I'M TRYING TO GET THE SUM OF DIFFERENT CELLS IN SAME COLUMN THAT IS MY SAMPLE FORMULA HOW CAN I SHORTEN IT IF I HAVE MORE THAN 20 LIST.. FOR THE FORMULA ABOVE THAT IS FOR MY FOREMAN THEY ARE "P" BECAUSE THEY ARE PRESENT I WANT TO COUNT THE PRESENT NO NEED FOR THE ABSENTS BUT MY HELPER IS 20 AND MORE I WANT TO TRY AND SHORTEN IT . I ALSO HAVE A FORMULA FOR MY 11 CARPENTERS
=SUM(COUNTIFS(D30,"*P*"),(COUNTIFS(D35,"*P*")),(COUNTIFS(D39,"*P*")),(COUNTIFS(D40,"*P*")),(COUNTIFS(D67,"*P*")),(COUNTIFS(D68,"*P*")),(COUNTIFS(D70,"*P*")),(COUNTIFS(D75,"*P*")),(COUNTIFS(D76,"*P*")),(COUNTIFS(D85,"*P*")),(COUNTIFS(D106,"*P*")))
IF YOU CAN HELP ME THAT WOULD BE A BIG HELP
TIA
Hello!
If your data is written in separate cells, you need to specify each cell separately. To reduce the formulas, you need to change the data table.
I did it by reading your article word by word haha thank you !
Thank you ! I did it by using countifs with multiple criteria
ANW I ALREADY GOT THE ANSWER TYVM <3
=COUNTIFS(D21:D118,"P",C21:C118,"CARPENTER")
Hello! I'm in need of a bit of help please :)
In my worksheet, I have a drop down list in row G10:CK10 for "Completed", "Ongoing", "Cancelled".
In the column G17:Y50, I have names of speakers, some of which are repeating names.
I would like to count the number of "Completed" events for each speaker. I have tried the COUNTIFS function, but unfortunately using the formula below it keeps returning as a VALUE error:
=COUNTIFs(G10:CK10, "Complete", G17:Y50, "Linda").
I would if you would be able to help?
Many thanks!
Hello!
You have different range sizes for the criterion and for the count, so the COUNTIFS function cannot be used.
If I got you right, the formula below will help you with your task:
=SUM(($B$10:$J$10="Complete")*($B17:$J50="Linda"))
I hope it’ll be helpful.
This is absolutely perfect! Thank you very much for your help!!
Hello, I've searched multiple threads and cannot find a combination that might help my scenario. I'm using COUNTIFS successfully. Ex. =COUNTIFS(A:A,"employee",C:C,"product") But how can I add a third criteria that counts ''repair order" only once if it is replicated? I think the correct term is 'Distinct'.
Here is a small sample where the result = 6
However Repair Order 206189150 is duplicated so the desired result is = 5
employee repair order product
318 206188973 ABLAST
318 206189055 ABLAST
318 206189150 ABLAST
318 206189150 ABLAST
318 206189160 ABLAST
318 206189188 ABLAST
I hope this is clear and I'm sorry about formatting.
Thanks in advance! - Craig
Hello!
I recommend reading this guides: Count unique rows in Excel and How to count unique values in Excel with criteria. Use a formula like this:
=ROWS(UNIQUE(FILTER(A1:C6,A1:A6=318)))
I hope it’ll be helpful.
Hi there,
second day in a row, sorry about that.
Is there a way to search across multiple sheets (i know that is a VLOOKUP) but to return values from the search?
In this case I have data from various cities, (all sheets are the same layout) and i want to look up the Sector (coloum D) for say "Construction" and return the total cost across all sheets (column F)
Hello!
If the “Construction” value is written in different positions on each sheet, then I recommend using the Consolidate Sheets tool.
You can use the SUMIF function for each sheet and then summarize the results.
Hi there, Im trying to return a result if one 'phrase' is met, and then one do have a difference result if one of 5 others.
I had a try but seem to have failed miserably with the second criteria/calculation
please help
IF(SUM(COUNTIF(E3,{"*In work as a result of LVP*"})),B3,""),(SUM(COUNTIF(E3,{"*In work through other means*","*Awaiting a start date*", "*Out of work*", "*Health Condition*", "*Other*"})),(B3-(B3*2)),"")
Hi,
if I understood the problem correctly, try this formula:
=IF(SUM(--ISNUMBER(SEARCH("In work as a result of LVP",E3))),B3, IF(SUM(--ISNUMBER(SEARCH({"In work through other means","Awaiting a start date", "Out of work","Health Condition","Other"},E3))), (B3-(B3*2)),""))
Hi there,, Thankyou SSOOO much, thats amazing
I am trying to use the Countifs to count the number of cells that fall within a specific date range and are between two values.
Example: If I want to know how many cells are between 40 and 60 (Cell E) and between the dates of 3/1/21 and 3/31/21 (Column A)
Formula I have been trying to get to work is
=COUNTIFS($A$4:$A$1000000, ">="&G5, $A$4:$A$1000000, "<="&H5,$E$4:$E$1000000, "&=40")
however, its returning over 27K as the count. I know I only have 1365 cells in this date range.
Any help would be appreciate.
Thanks
Hi!
Please use the following formula:
=COUNTIFS($A$4:$A$1000000, “>=”&G5, $A$4:$A$1000000, "<="&H5,$E$4:$E$1000000, ">="&40,$E$4:$E$1000000, "<="&60)
I have a need for a 3rd criteria. Using your example I would want it to countif Susan has a project, with a start date, but no end date. The example I am looking at is under "How to use COUNTIFS with wildcard characters".
Hi Bryan,
Simply, use 3 range/criteria pairs:
=COUNTIFS(B2:B10, "susan", C2:C10, "<>"&"", D2:D10,"")
Could you please help me
If in One Column I have Y 2,Y 1,Y 6, N3 is there a way that i can sum the Numbers only
Hello!
If I understand your task correctly, the following formula should work for you:
=SUM((IF(ISNUMBER(--MID(CONCATENATE(A1,A2,A3,A4),ROW($1:$100),1)),--MID(CONCATENATE(A1,A2,A3,A4),ROW($1:$100),1),"")))
or
=SUM((IF(ISNUMBER(--MID(CONCAT(A1:A4),ROW($1:$100),1)),--MID(CONCAT(A1:A4),ROW($1:$100),1),"")))
I hope it’ll be helpful.
Hi,
I've been spending days on getting the formula right, but still uncertain how to get the right info.
I've got two columns with different dates: Start Date (A) & Resignation Date (B).
Currently using =COUNTIFS(A3:A143, "=",B3:B143,"=>1-90" but doesn't seem to give the right answer.
I would like to calculate how many people are resigning within 3 months, between 3-6 months, between 6-12 months. Any idea how the formula will look like?
Thanks.
Hello!
To calculate how many people are resigning within 90 days, use the formula
=SUMPRODUCT(((B1:B15-A1:A15)<90)*((B1:B15-A1:A15)>0))
I hope it’ll be helpful.
Hi Alexander,
Thank you so much, this is definitely working!! :)
Regards,
Cindy
How can I use CountIFs function while counting the data of specific individual for a specific range of dates. Example, I have list of names in column A (from A2 to A20), their daily working hours is between column C2 to AF20 (31 days). Now I want to calculate number of days each individual did less than 5 hours shift, number of days an individual was not present in that month, total working days etc. I know I can do all these calculations for each individual at the end of the last column but I am pulling this data at another sheet and the names may not be in same order.
Is there any other way other than CountIFs? Any help would be appreciated.
Hello!
To calculate the number of days with more than 5 working hours, you can use the formula
=SUMPRODUCT((Sheet1!$A$2:$A$20=$A$2)*(Sheet1!$C$2:$AF$20>5))
where cell A2 -- Name.
Please have a look at this article - Excel SUMPRODUCT function with formula examples
I have a spreadsheet that i want to return a count across a row if two conditions are met.
please whats the best way to write this code =if(AC3="Reject", AF3="vendor", Count(f3:Y3))
when i wrote this code, i noticed the ones that met the condition only returned "True" instead of counting across the row, see below.
Number of Rejects Due Supplier
1
TRUE
5
TRUE
TRUE
Hi!
If I understand your task correctly, the following formula should work for you:
=IF(AND(AC3="Reject", AF3="vendor"), COUNT(F3:Y3))
I hope it’ll be helpful.
Hello Alexander,
Yes this was helpful, but i like to have 0 for the once that didnt meet the condition instead of "false"
Actual expected
false 0
3 3
False 0
4 4
1 1
Hi!
I recommend reading how the IF function works and correcting the formula. It’s very simple.
Hi , i am looking formula to rid of all the duplicates & the originals in comparision data . some duplicates starts with "."
Just example
Existing:
a123.com
.a123.com
Comparing with
a123.com
I need to remove all "a123.com" . i have sheet of of 10000+ in existing & comparing have "2000+" .
how to remove the duplicates even it have "." in starting .
i am using the formula of -=IF(COUNTIF(A:A,A2)=1,0,1). it detecting the exact duplicates but not catching any thing with "." in starting.
Hello!
If you need a partial text match, I recommend using this instruction: How to count cells with certain text (partial match).
I hope I answered your question. If you have any other questions, please don’t hesitate to ask.
Hi Alexander,
I'm trying to create a formula for this scenario. I have two columns, in each column there are only two texts that can be selected from a drop down (I'll call them "Text123" and TextABC"). I would like to create a formula that counts the total results for each for both columns, however, if "TEXT123" was selected in row 1 for both columns 1 & 2, I would only need to count it as one, not 2. How do I create a formula telling excel to count it only once per row, but for two columns total.
Thanks so much in advance.
Hello!
If I got you right, the formula below will help you with your task:
=SUM(--(A1:B10="TextABC"))+SUM(--(A1:B10="Text123"))-SUM(--(A1:A10&B1:B10="Text123Text123"))
Hi Alexander,
My spreadsheet is quite simple, it has 3 columns.
Column one has type of activity. (for ease of use, we can say Walk, Run & Swim)
Column 2 has only 2 options "1st Pass" or "Not 1st Pass".
Column 3 has a date.
I need to have a count depending on the month & year.
I can get each activity & whether its 1st pass or not 1st pass. Input is from Row 3 downwards.
My problem is when I am trying to choose month = 8 & year = 2021.
Formula just on basic Walk * 1st pass is =COUNTIFS(Applications!$A$3:$A$974,"Walk",Applications!$B$3:$B$974,"1st pass")
I have a table which splits each activity (rows) and months (columns). I would like to return the count of 1st pass walks in each month & year? I have used Month & Year function with SUMPRODUCT, but they seem to cause issues with COUNTIFS.
I was trying (year I am wanting to use is in C1 so I can change review previous years- in below formula looking for August in the year provided in cell C3):
=COUNTIFS(Applications!$A$3:$A$974,"Walk",Applications!$B$3:$B$974,"1st pass",Applications!$C$3:$C$974,MONTH(Applications!$C3:$C974)=8,Applications!$C$3:$C$974,YEAR(Applications!$C3:$C974)=$C$1)
Hello!
If I understand your task correctly, the following formula should work for you:
=SUMPRODUCT(--(A1:A10="Walk"),--(B1:B10="1st Pass"),--( YEAR(C1:C10)=2021),--( MONTH(C1:C10)=8))
If this is not what you wanted, please describe the problem in more detail.
Thanks Alexander,
I am looking to be able to return a result through countifs while searching for specific month & date within the range.
Just say date values fill up cells A1:A10.
How would I write a countifs formula searching for the month 8 (Aug) and year 2021?
Thank you for your review.
Hi!
The COUNTIFS function compares each value in a range against a criterion. You are comparing a date with a month number. Therefore, your COUNTIFS formula will not work.
Messed up down the bottom:
I was trying (year I am wanting to use is in C1 so I can change review previous years- in below formula looking for August in the year provided in cell C1):
Hello ,
Can u help me to set the below formula
=IF(B4:B30,"Purchase Invoice",COUNTIFS(K3:K30,"1-20"))
Thanks in advance
Hello!
The IF function does not work with ranges. Please describe your problem in more detail. It’ll help me understand it better and find a solution for you.
- C1 C2 C3 C4
R1 Apr-21 Apple 10 Delivered
R2 Apr-21 Bannana 15 Pending
R3 Apr-21 Oranges 23 Delivered
R4 May-21 Apple 12 Pending
R5 May-21 Apple 45 Delivered
R6 May-21 Bannana 27 Cancelled
R7 May-21 Oranges 24 Pending
R8 Jun-21 Apple 11 Cancelled
R9 Jun-21 Apple 10 in Transit
R10 Jun-21 Bannana 26 Cancelled
need to filter in c1 ( apr, june), then c2 (oranges, apple), then c4 (delivered, pending); the answer should be 2
I need countifs in single formula for above; please advise
Hello!
I believe the following formula will help you solve your task:
=SUMPRODUCT(--(MONTH(A1:A10)=4)+(--(MONTH(A1:A10)=6)),(--(B1:B10="Apple")+(--(B1:B10="Oranges"))),--(D1:D10="Delivered")+(--(D1:D10="Pending")))
You can learn more about SUMPRODUCT function in Excel in this article on our blog.
Hi, I need to work out a formula for the following:
I have 5 rows with different info...
A1 = date, A2 = name, A3 = description, A4 = shop, A5 = amount.
Now I have to add the total spent for each name and for different expenses.
For instance, Sam has spent P500 on employment cost, P200 on production cost and P3000 on capital investment
Sarah has spent P1000 on employment cost, P200 on production cost and P3000 on capital investment.
Now I have to calculate only employment cost and production cost for Sarah and then seperately for Sam as well.
How do I go about? Please help.....
Regards
Hi!
Use the SUMIFS function. Here is the article that may be helpful to you: Excel SUMIFS and SUMIF with multiple criteria
I hope this will help.
Hi, I am trying to use the COUNTIFS function as below...
Column A "start date", I want it to count all dates before 01/04/2021 but then also count in Column B "end date" all dates after 01/04/2021, there are 5 in my test sheet but it's only pulling two when I use this formula =COUNTIFS(Participants!A:A, ""&"1/4/2021")
I need it to first count those who started before 1st April 2021 then out of those how many finished after 1st April 2021 - please help!
Hello!
If I understand your task correctly, the following formula should work for you:
=COUNTIFS(A1:A6,">"&"1/4/2021",B1:B6,"<"&"1/4/2021")
If this is not what you wanted, please describe the problem in more detail.
I have Yes/No in a column. I want to count all "No" till it encounters the first "Yes".Please help
Hello!
If the records in the column start at row 1, then try the formula
=MATCH("Yes",D1:D1000,0)-1
You can learn more about MATCH function in Excel in this article on our blog.