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 2. Total comments: 599
In trying to calculate prorated salary based from 2 other columns "daily rate" x "# of days" between 2 date ranges, but only want them to be calculated if the Status = In Progress, On Hold or Not Started.
I am trying to calculate using =SUM([@[daily Rate calculation ]]*[@['# of days]],(COUNTIFS([Status],{"In Progress","On Hold","Not Started"}))), however it is picking up all other statuses also.
Hello Monique!
To find the sum based on multiple conditions, use SUMPRODUCT function. You can find the examples and detailed instructions here: Excel SUMPRODUCT function with multiple criteria. For example:
=SUMPRODUCT(A1:A10*B1:B10*((C1:C10="In Progress")+(C1:C10="On Hold")+(C1:C10="Not Started")))
Hi
I am trying to countifs between hours and minutes (00:00:00) but my formula is not bringing back all results when checked manually. I'm not sure where it is going wrong.
1st count between dates, 2nd count matching data in a colum, 3rd count counting between hours and minutes. It's bringing back some of the data but not all.
=COUNTIFS(Sheet1!$M:$M,">="&DATE(2024, 5, 1),Sheet1!$M:$M,"=00:00:00", Sheet3!$R:$R, "="&DATE(2024, 5, 1),Sheet1!$M:$M,"=00:15:00", Sheet3!$R:$R, "<=00:29:59")
1st row brings back all results(12), 2nd row brings back 0 results. When checked manually there should be 10 results.
Thanks
Craig
Hello Craig!
To extract the time from the date, use the MINUTE function. Read more about it here: How to calculate time in Excel. Но вы не можете использовать это в формуле COUNTIFS. Therefore, to calculate values by condition, I recommend using the SUMPRODUCT formula with multiple criteria. For example:
=SUMPRODUCT((Sheet1!$M:$M>=DATE(2024,5,1)) * (MINUTE(Sheet1!$M:$M)=0)*(Sheet3!$R:$R=DATE(2024,5,1)) * (MINUTE(Sheet1!$M:$M)=15) * (MINUTE(Sheet3!$R:$R)<30))
Seems like line of formula hasn't shown up properly.
=COUNTIFS(Sheet1!$M:$M,">="&DATE(2024, 5, 1),Sheet1!$M:$M,"=00:15:00", Sheet3!$R:$R, "<00:29:59")
This same line is used to count 0 - 15mins, 15 - 30mins, 30 - 45mins, 45 - 60mins, etc
Thanks,
shift department
Angulo, Ingrid N F2 Pick
Anon, Kobon Jean Francois S2 Pack
Badey, Spenser R F2 Pick
Baez, Jasmarie L S2 Pick
Bah, Houleymatou W2 Pick
Hi there!
Im trying to do the countif to return a value with how many people with specific shift are in certain department. For example, how many people with F2 shift are in pick department.
Hi! I hope you have studied the recommendations in the tutorial above. It contains answers to your question. Use the COUNTIFS function to calculate the number of records that meet the two conditions.
I've been scratching my head at this for awhile now. I'm using the SUMIFS formula to add data based on 3 criteria; start date, end date, and a name. I have the formula working but im searching multiple columns for the name resulting in adding 15 identical SUMIFS formulas just to check different columns.
Example:
=COUNTIFS(Table1[[Date]:[Date]],">="&$F$2,Table1[[Date]:[Date]],"="&$F$2,Table1[[Date]:[Date]],"="&$F$2,Table1[[Date]:[Date]],"="&$F$2,Table1[[Date]:
[Date]],"="&$C$3,Table1[[Date]:[Date]],"<="&$D$3, Table1[[SL]:[SD]],$B6)
I have a similar issue for another cell which is identical with the SUMIFS function. Another challenge is that I have to stay in base excel formulas and can't go into MBA due to job security.
I've never posted on a forum before so you know I'm on my last leg trying to figure this out.
Hi! If I understand your task correctly, the formula could be as follows:
=SUMPRODUCT((D2:G6=H1) * (B2:B6<I1) * (C2:C6>I1))
Column B - start date
Column C - end date
I1 - date
H1 - name
You can find the examples and detailed instructions here: Excel SUMPRODUCT function with multiple criteria.
That worked for counting how many times the name shows up between two dates. It helped shorten some other code, but not the original challenge.
I want to count the data in the blue columns
if the date(green) is within a range(pink)
and if a name(yellow) is in any of the orange columns.
.
I was able to do this with:
SUMIFS()+SUMIFS()+SUMIFS()+SUMIFS()+SUMIFS()... -- one for each of the POS columns.
.
I want to be able to write:
=SUMIFS(Table[AC], Table[Date], >date, Table[Date], date, Table[Date], date, Table[Date], date, Table[Date], date, Table[Date], date, Table[Date], <date, ***Table[POS5], Name***)
Important data in-between ***
I hope this helps. I haven't been able to find a solution for months.
Hi! If you study the SUMPRODUCT function manual carefully, you can modify the formula suggested to you. Based on the information provided, the formula could look like this:
=SUMPRODUCT((F2:I5=C10) * (B2:B5>=C8) * (B2:B5<=C9)*D2:D5)
=SUMPRODUCT((F2:I5=C10) * (B2:B5>=C8) * (B2:B5<=C9)*E2:E5)
Seems some of my comment is missing. Im basically trying to make this function work to clean up code:
=COUNTIFS(Table1[[Date]:[Date]],">="&$C$3,Table1[[Date]:[Date]],"<="&$D$3, Table1[[SL]:[SD]],$B6)
I want the data in column A added if column B is within the date range and if the name is in ANY of the columns Table1[[SL]:[SD]]
Hi Alexander - thank you so much for your great article and explanations!
I've successfully navigated the use of countifs for 3 criteria.... =COUNTIFS('Objectives'!$Q:$Q,$A$1,'Objectives'!$R:$R,B$1,'Objectives'!$M:$M,"Yes")
But to collect the next subset of data I'm wanting to add criteria 4 which counts if the value in a cell in one column is the same as the value in a cell in another column on the same row - is that possible? i.e. count if the value in column A = the value in column B
Hello! To count the number of values for multiple criteria, you can use the SUMPRODUCT function. For example:
=SUMPRODUCT((Q1:Q10=$A$1) * (R1:R10=$B$1) * (Q1:Q10=S1:S10))
You can find the examples and detailed instructions here: Excel SUMPRODUCT function with multiple criteria.
Hi, i have data related to my job which i cannot provide. So , lets take a example with same scenario.
In the below data, i want the output as Yes, whenever the serial number is same for Mobile and Torch.
Items Serial number
Mobile 1234
Earphone 4567
Torch 4567
Charger 6789
Bottle 1234
Torch 6789
Charger 7894
Earphone 6789
Mobile 4567
Charger 1597
Bottle 7894
Torch 1234
Charger 7564
Hi! If I understand your task correctly, the following IF formula should work for you:
=IF(((A1="Mobile")+(A1="Torch")) * (COUNTIFS($A$1:$A$13,"Mobile",$B$1:$B$13,B1) + COUNTIFS($A$1:$A$13,"Torch",$B$1:$B$13,B1))>1,"Yes","")
Wow, that works. Thank you very much Alex
Hello- I am trying to use the COUNTIFS function to see if there is a multiple cell match in a separate data set. This data set is referenced as "1" in the below formula.
This is the formula I'm using: =IF(COUNTIFS([1.xls]Sheet1!$C$4:$C$39923, "=C4", [1.xls]Sheet1!$F$4:$F$39923, "=F4"), "TRUE", "FALSE")
It returns me with a "FALSE" tag on every single row even when I know it should be "TRUE". How can I fix this?
Thank you!
Hi! Please read the above article carefully. If you want to find matching values in cells, don't write references to those cells as text. Instead of "=C4", use C4.
Excel A B C D
1 Team Day 1 Day 2 Day 3
2 A Present Present Present
3 A Present Present Present
4 B Present Absent Present
5 B Present Present Present
6 C Present Present Present
7 C Present Present Absent
Question :
If want to calculate the number of days Team A present from Day 1 to Day 3
=COUNTIFS ( A2:A7,"A", B2:D7,"Present" ) Excel is not reading B2:D7 it only reads B2:B7 - I do not want to add multiple formulas because the number of days I have in the report is 50+
Hi! In the COUNTIFS formula, all ranges must be the same size. Therefore, to calculate the number of values by condition in a range of multiple rows and columns, try SUMPRODUCT formula. For example:
=SUMPRODUCT((B2:D7="Present")*(A2:A7="A"))
Thank you so much for this! This is helpful!
(CF2=3 or 4) OR (CF3=3 or 4) this is the condition i have to count 1 which formula will be appropriate
Hi! If you want to check a value in two cells, use the IF and OR function. Look for the example formulas here: Excel IF OR statement with formula examples.
Based on the information provided, the formula could look like this:
=IF(OR(OR(CF2=3,CF2=4),OR(CF3=3,CF3=4)),1,0)
I am trying to count rows were either column E -OR- F meet a criteria. Example.. Column A is a Truck, Column B is Trailer, I want to have a count of "1" if either the truck or trailer is red, same if both the truck and trailer are red. I only want to count if either column A -OR- Column B, but don't want to count a RED truck and RED trailer as 2. The full goal of this would be to count how many instances of each state had either a Red Truck or Trailer. Using the small subset below. I would be looking for the answer of the formula to show that CA=2 (not 3), AZ=1, etc. using the subset below:
STATE TRUCK TRAILER
---------- ---------- -----------
CA Red Blue
CA Red Red
AZ Blue Red
AZ Blue Green
I currently have a formula similar to this, but it is counting the RED Truck and the RED Trailer as 2.
=COUNTIFS(B4:B14,B2,E4:E14,"RED")+COUNTIFS(B4:B14,B2,F4:F14,"RED") get count of 1 which is correct
=COUNTIFS(B4:B14,B3,E4:E14,"RED")+COUNTIFS(B4:B14,B3,F4:F14,"RED") get count of 3 which is incorrect
I have also tried
=SUM(COUNTIFS(B4:B14,B2,E4:E14,"RED")+COUNTIFS(B4:B14,B2,F4:F14,"RED")) get count of 1 which is correct
=SUM(COUNTIFS(B4:B14,B3,E4:E14,"RED")+COUNTIFS(B4:B14,B3,F4:F14,"RED")) get count of 3 which is incorrect
B1:B14 would be the row of states, B2 is AZ, B3 is CA in the formula above.
Thanks,
WK
Hello! To avoid duplicate counts, you can use three different conditions and find the sum of the three COUNTIFS formulas:
=COUNTIFS(B4:B14,B2,E4:E14,"RED",F4:F14,"<>RED") + COUNTIFS(B4:B14,B2,E4:E14,"<>RED",F4:F14,"RED") + COUNTIFS(B4:B14,B2,E4:E14,"RED",F4:F14,"RED")
You can also use the SUMPRODUCT formula:
=SUMPRODUCT((B4:B14=B2) * (((E4:E14="red")+(F4:F14="red"))>0))
I hope it’ll be helpful.
I have in name manager a list_of_cells =$H6;$Q6;$U6;$V6.
The result of =COUNTIF(list_of_cells ;">=3") is #VALUE!
Haw can i count haw many of values in that discontinue range are greater than or equal to 3?
Hi! The COUNTIF function can only count values in a continuous range. Just count them:
=(H6>=3)+(Q6>=3)+(U6>=3)+(V6>=3)
Ty for replay,
Yes, meanwhile I used the formula =SUM($H6>=3;$Q6>=3;$U6>=3;$V6>=3).
Problem solved!
I have the following table
Platform Ticket Number Ticket Details Weight Agent
Platform1 093uf session issues 5 Agent1
Platform2 35654 session issues 5 Agent2
Platform2 768566 session issues 3 Agent1
I need the following table to be filled from the 1st table
Agent Weight Platform1 Platform2
Agent1 sum all weight of Agent1 sum all weight of platform1 for Agent1 sum all weight of platform2 for Agent1
Agent2 sum all weight of Agent2 sum all weight of platform1 for Agent2 sum all weight of platform2 for Agent2
=SUM(COUNTIFS(Calendar!D:D, A8, Calendar!C:C, "*2025*"), COUNTIFS(Calendar!E:E, A8, Calendar!C:C, "*2025*"), COUNTIFS(Calendar!F:F, A8, Calendar!C:C, "*2025*") )
please can someone help me with this countif formula? im not sure why it isnt working.
I need a formula that reads a names located on "COUNT - senior" tab in cell A8, then find that name on "Calendar" tab Cells D, E & F, then finds the date in Col C and only counts dates with 2025 in that is feed back to tab COUNT tab
Hi! If you have dates written in column C, I recommend studying these instructions: Using Excel COUNTIF function with dates. The formula might look like this:
=SUM(COUNTIFS(Calendar!D:D,A8,Calendar!C:C,">=1/1/2025",Calendar!C:C,"<1/1/2026"), COUNTIFS(Calendar!E:E,A8,Calendar!C:C,">=1/1/2025",Calendar!C:C,"<1/1/2026"), COUNTIFS(Calendar!F:F,A8,Calendar!C:C,">=1/1/2025",Calendar!C:C,"<1/1/2026"))
You can also get the year number using the YEAR function and count the number of values by condition using the SUMPRODUCT function. For example:
=SUMPRODUCT(((Calendar!D:D=A8)+(Calendar!E:E=A8)+(Calendar!F:F=A8)) * (YEAR(Calendar!C:C)=2025))
Hi,
can you do a countif if I have 2 columns where the result and be positive in either column?
So for example, I have a list of 100 blood donors and 2 columns of interest. One column is blood group collected on the day of donation and one where blood group was already available. The answer in either column is yes or no. I want to know the number of people who either had blood group collected on the day or it was already available. So if either column answers yes I want them to be counted but the total should not be the number of the first column plus the second it should be if the positive factor is present in either column.
I hope that makes sense, thank you for your help!
Hi! Based on the information provided, the formula could look like this:
=SUMPRODUCT(--(((C1:C20="yes") + (D1:D20="yes"))>0))
To convert TRUE and FALSE to 1 or 0, use mathematical operations (e.g., double minus --). For more information, please visit: Excel SUMPRODUCT function with multiple criteria.
Further to my earlier post, I should have said that I enter the names of Goalscorers into a single cell.
You cannot do value counting on a part of a text string. Split text into separate cells. Read more: Split string by delimiter or pattern, separate text and numbers.
COUNTIFS counts every name in a text string within a cell, and does this over every row within the column, but if a name is entered twice within the same cell, it only recognises the name once in the count.
Hi, I have a football league table, and in one column, over 38 rows, I enter the names of each Goalscorer. I want to produce a list detailing how many goals each player has scored.
The COUNTIFS function works… except if a player has scored more than one goal in a game, it does not count the true total each player has scored.
Can you help?
Hi! If I understand your task correctly, try to use SUMIF or SUMIFS functions.
is there a way to add multiple words in countif function for same range row ?
Hi! To count by multiple criteria, follow the instructions above: How to use COUNTIFS and COUNTIF with multiple criteria. Or describe the problem in more detail.
Hi! I have a large amount of data with various titles, and I am trying to count the number of titles that contain certain words, while the status also being open. The original equation I had used, using OR logic: =SUM(COUNTIFS(($B:$B", {"*pile*","*extraction*","*refusal*"}, $C:$C, "Open"), seemed to work at first, but if two of the words were used in the same title, it would count it as 2. I then proceeded to just subtract all of the possible combinations using AND logic and got the following equation:
=SUM(COUNTIFS($B:$B, {"*pile*","*extraction*","*refusal*"},$C:$C, "Open")) - SUM(COUNTIFS($B:$B, "*pile*", $B:$B, "*extraction*", $C:$C, "Open")) - SUM(COUNTIFS($B:$B, "*pile*", $B:$B, "*refusal*", $C:$C, "Open")) - SUM(COUNTIFS($B:$B, "*extraction*", $B:$B, "*refusal*", $C:$C, "Open")) - SUM(COUNTIFS($B:$B, "*pile*", $B:$B, "*extraction*", $B:$B, "*refusal*", $C:$C, "Open"))
This equation works, but if I wish to add more "key words" to look for, the formula just gets very large and confusing.
So my first question is: is there a way to count with a bunch of key words, while preventing them from double counting the ones that remain in the same cell. - Within the data each line contains a unique ID number, I thought perhaps this could be used to prevent double counting, but I wasn't sure how to implement it.
Secondly, I was wondering how I would format the equation if I wanted each of the words (pile, refusal, extraction), to be referenced from a cell. I have tried using ampersands and many quotation marks to format it, but I can't seem to get it to work.
Please let me know!
Hi! If I understand your task correctly, the following formula should work for you:
=SUMPRODUCT(--((ISNUMBER(SEARCH("pile",B1:B10)) + ISNUMBER(SEARCH("extraction",B1:B10)) + ISNUMBER(SEARCH("refusal",B1:B10)))>0))
For more information, please read: How to find substring in Excel
Can I put the results of 2 Countifs in the same Cell? I'll try to show what I'm lookin for. I've tried 2 Countif equations in the cell, each by itself works. But both together, but together do not. I'm sure I'm messing up the separator between the 2. This is my Countifs =COUNTIF($H3:$H50,"Blue")& " Blue". Then another for Red.
2 Blue, 1 Red (This line in 1 Cell as a result of 2 Countifs)
Blue
Yellow
Blue
Green
Red
Hope this is enough info. Thank you.
Hi! You can combine the results of multiple formulas into a single text string using the & operator or CONCATENATE function.
=COUNTIF($H3:$H50,"Blue")& " Blue "&COUNTIF($H3:$H50,"Red")& " Red"
Read more: CONCATENATE in Excel: combine text strings, cells and columns.
Brilliant, thank you. Worked like a charm. I feel dumb because I think I used every symbol except the most obvious one.
CL 8 JH 6 YYY 7 BM 4 AA 3
CL 8 JH 6 YYY 7 BM 4 YYY 3
LC 6 GB 8 AA 7 BM 4 YYY 3
LC 6 GB 8 AA 7 BM 4 GW 3
LC 6 GB 8 AA 7 BM 4 GW 3
LC 6 GB 8 YYY 7 BM 4 GW 3
how do i calculate sum of"CL" periods
Hi! You can calculate the sum by condition using the SUMIF function. Read more: How to use SUMIF function in Excel with formula examples.
Thank you for the detailed tutorial. It was very helpful in understanding how these formulas function.
Regarding this example:
Formula 2. COUNTIFS formula with two criteria
When you want to count items with identical criteria, you still need to supply each criteria_range / criteria pair individually.
For example, here's the right formula to count items that have 0 both in column B and column C:
=COUNTIFS($B$2:$B$7,"=0", $C$2:$C$7,"=0")
This COUNTIFS formula returns 1 because only "Grapes" have "0" value in both columns.
How would I be able to apply this if I need to count blanks?
I tried using the following formula, but it did not work and appears to have given me ALL the blanks instead of the blanks that meet the first countifs criteria.
=COUNTIFS ($D:$D,$B5,$U:$U,$F$2) + COUNTBLANK ($S:$S) <-- this version gave me a ridiculous number, assuming it went to infinity.
So then I went to go see what my current row count was and changed it to $S1:$S855, but it still returned the incorrect count.
Is there a way to get it to countifs, then based off of those matches, if column S has blanks, to spit out a total?
Is there a way to do it without having to input row count each time?
Thank you for your help!
Hi! If I understand your task correctly, try the following formula:
=COUNTIFS($D:$D,$B5,$U:$U,$F$2,$S:$S,"")
Hi
I want to select my source from a different worksheet for my countifs formula, it is not working. It works well when I do it in the same worksheet.
How do I go about it?
Hi! If I understand your task correctly, the following tutorial should help: Excel reference to another sheet or workbook (external reference).
is there a way to count multiple ranges (a variety from three different columns) for two criteria's?
Hi! The COUNTIF function counts values in only one range. To calculate values in several data ranges, look at the SUMPRODUCT function. Read more: Excel SUMPRODUCT function with multiple criteria.
Kindly help with formula to count only visible cells with values greater than zero
Hi! The COUNTIF function counts all cells. It does not matter if they are hidden or visible. You can use the Excel filter to hide cells less than zero. Then count the visible cells in the column using the AGGREGATE function. For example:
=AGGREGATE(2,5,C:C)
Is there anyway to use wildcard along with Cell references?
for eg.
Column A has the base words like A1 = 'Rice", A2 ="Noodle" etc and I want to find the number of cells in Column B which has data like fried rice, brown rice, flat noodles, noodle soup etc.
something like COUNTIF(B:B,*A1*)
Hi! You can use wildcards to find and count partial matches using the COUNTIF and COUNTIFS functions. Try to follow the recommendations from this article: COUNTIF formulas with wildcard characters (partial match).
Hi! You can find the difference and select the maximum value using the MAX formula. You can also use the IF function as shown in the examples below.
=MAX(0,SUM(A1,A3,A5,A7)-40)
=IF(SUM(A1,A3,A5,A7)-40>0,SUM(A1,A3,A5,A7)-40,0)
Thank you so much.
best wishes,
Nina
hi
i have problem with countifs :
when i type this formul
=countifs(Database!D2:D100;A5;Database!D2:D100;"="&A2)
It gives me the correct answer
But when type this formul
=countifs(Database!D2:D100;A5;Database!D2:D100;"<="&A2)
it give me 0
That is the wrong answer.
How should I modify the formula?
How can I send you an example of my data?
thank you
Sorry, we don't work with user data. You can try writing an example of the data in a blog post.
Thank you, I think I explained it wrong. I want to find the estimate of numbers smaller than a certain number for me, for example ?=> 1400
،I write this number (1400) in the cell A2
،The answer should be obtained from table2 in the sheet i called DataBase
Look for the example formulas here: COUNTIF function in Excel - count if not blank, greater than, duplicate or unique. To correctly create a table reference, use these instructions: Structured reference in Excel tables.
hi.
i have problem
i want, Count the number of uneven numbers, using the countifs function in two different sheets
this formula i use
=countifs(table2[name];A5;table2[number];"<="&A2)
table2 in another sheet i called MyDataBase
cell A2 is also the place where I write my number
thanks for help me
Hi! You cannot use the COUNTIFS function to count odd numbers because COUNTIFS cannot use other functions as a range or criteria argument. This SUMPRODUCT formula counts the number of odd numbers in a range using the ODD function.
=SUMPRODUCT(--(A1:A10=ODD(A1:A10)))
Is it possible to use COUNTIF in these?
Total count of Column A for which the criteria are met without adding extra column C
[Criteria: IF (DAYS (Column A1, Column B1) > 3, 1, 0)]
A B
16/11/2022 20/11/2022
10/11/2022 14/11/2022
29/11/2022 01/11/2022
18/10/2022 10/10/2022
12/10/2022 04/10/2022
Hi! The COUNTIF function can only use cell references as arguments. You cannot use calculations within it. So if I understand the question correctly, try this formula to find the number of time intervals greater than 3 days.
=SUMPRODUCT(--(DAYS(B1:B4,A1:A4)>3))
I hope it’ll be helpful. If this is not what you wanted, please describe the problem in more detail.
Hello. Is it possible to use in this criteria: IF (NETWORKDAYS.INT(Column A1, Column B1,16) > 4, 1, 0)?
Hello! is it possible to use SUMPRODUCT with this [Criteria: IF (NETWORKDAYS.INTL(WORKDAY.INTL(Column A1,1,16), Column B1,16) > 3,1,0]
Hi! Your formula needs to be checked with your data. What does "Column A1" mean? Do you want to specify cell A1 or range A1:A4? WORKDAY.INTL and NETWORKDAYS.INTL functions to calculate workdays do not work with ranges, but only with one date cell.
[Criteria: IF (NETWORKDAYS.INTL(WORKDAY.INTL(A1:A4,1,16), Column B1:B4,16) > 3,1,0]
As I said, the WORKDAY.INTL(A1:A4,1,16) function is not possible. You can create an additional column where you count working days between two dates in each cell.
Hi! It is not possible to select numbers where the sum is zero and which match the criterion by using a formula. Perhaps this guide will help: How to find all combinations of numbers that equal given sum in Excel.
Thanks @Alexander for the prompt response. It was really helpful
Hi! You can write the conditions in three separate cells and use a COUNTIFS formula like this:
=SUM(COUNTIFS($C$2:$C$11, D1:D3))
If you write all the conditions in one cell and separate them with spaces, use the TEXTSPLIT function to split the criteria:
=SUM(COUNTIFS($C$2:$C$11, TEXTSPLIT(D1,," ")))
I hope my advice will help you solve your task.
Alexander, thank you so much. The TEXTSPLIT function was exactly what I needed. Definitely keeping that one in my back pocket for future use. Have a great weekend!
One last question. In the example above the TEXTSPLIT worked great. How could I alter your suggestion to count excluding those three text items? I was thinking this might work but apparently I was wrong.
=SUM(COUNTIFS($C$2:$C$11, ""&TEXTSPLIT(D1,",")))
Hi! If I understand your task correctly, try the following formula:
=COUNTA($C$2:$C$11) - SUM(COUNTIFS($C$2:$C$11, TEXTSPLIT(D1,," ")))
For more information, read: COUNT and COUNTA functions to count cells.
Thank you. I was offline for the last 10 days but will have a look at this later today. Appreciate your help :-)
Hello, I am trying to count how many colours are in a row of data cells e.g. Red, Green, Green, Yellow would be 3 colours. When I use SUM(COUNTIFS variables it says 4 because it is adding all colours. Is there a way to count only how many types of colours there are?
Hi! COUNTIFS formula counts the number of all values by condition, including duplicates. To count only unique values, try using these guidelines: How to count unique values in Excel an easy way. I hope I answered your question. If something is still unclear, please feel free to ask.
Thank you. I have tried a few of those formulas and can't figure it out.
Artem A Set1A Set1A Set1B Set1B Set1C Ditties Set1C
I need it to count how many times it says Set1A, Set1B, Set1C and Ditties in this example above. Because each row needs to be calculated differently as they are different start points, I am struggling to do it per row and not across the whole page of data like the examples show.
Hi! As far as I can see from your second comment, your task is now different from the original one. You are asking a very different question from earlier. To count "how many times it says Set1A", use COUNTIF formula. For example:
=COUNTIF($A$2:$L$2,C2)
If this is again not what you need, give an example of source data and write the desired result.
I'm trying to do a countifs with multiple text criteria, to breakdown how many sales were done by an individual from a particular lead source
As an example
John doe
how many were organic
how many were self generated
Jane doe
how many were organic
how many were self generated
Can you please help?
Hi! I hope you have studied the recommendations in the tutorial above. It contains answers to your question. If this does not help, explain the problem in detail.
I'm trying to have a formula that counts a student when two conditions "English" and "Graduated" are true, but I keep getting an error. I am trying to pull information from another sheet. Below is the formula I've been trying to use:
=countifs(‘Sheet2’!A2:A,”English”,B2:B,”Graduated”)
Hi! The COUNTIFS function can only correctly calculate values for a condition on one sheet in one Excel spreadsheet. Please read the above article carefully.
I need to write a fomula that counts the UPC codes that were used in Las Vegas. There is a mixture of blanks and with letters. Here is a similar example:
Location UPC Codes
Las Vegas 981
Los Angeles 8989
Tokyo 9867
Las Vegas 8989
Los Angeles 8989
Tokyo
New York 65464
Miami Pi757
Las Vegas
Los Angeles 8989
Tokyo 2165
New York
Miami 235
Las Vegas 8989
Los Angeles G192
Tokyo Pi757
New York 8989
Miami 8989
Hi! Please check out this article to learn how to count unique values in Excel: with criteria, ignoring blanks.
Try to use this formula:
=IFERROR(ROWS(UNIQUE(FILTER(B2:B20,A2:A20="Las Vegas"))), 0)
I need to identify the presence of an element in at least one column, in columns that are separated from each other, but I need to count it just once (even if it is in several columns).
For example, in column A I have attendance on day X; in column D I have the attendance for day Y and in column H I have the attendance for day Z. Each day is marked "Yes" or "No".
I need to count the people who attended, regardless of whether they went 1, 2 or 3 times. When using the countifs function, if the person was not there on a day, it doesn't count them. On the other hand, if I combine the countifs function and add what is derived from the Or function, then it counts it 1, 2, or 3 instead of 1. Is there a way to do it?
Hello! Try to follow the recommendations from this article: How to count unique values in Excel with criteria
I believe the following formula will help you solve your task:
=COUNTA(UNIQUE(FILTER(A1:A10, (B1:B10="Yes")+(C1:C10="Yes")+(D1:D10="Yes"))))
Hi, i have a question about a seemingly simple function but i cannot get it figured out.
So this is the formula i have
=COUNTIFS(I:I,"",D:D,"DEPO",B:B,"2024FA")+COUNTIFS(J:J,"86",D:D,"DEPO",B:B,"2024FA")
Now, the context is that i need to count a person whether they have either any value in Column I, or a value of 86 in Column J as well as the criteria for columns D and B staying the same. People CAN have both values present. The way the formula is written now, if someone has both values present, they are counted twice.
Am i missing something? I thought of using an OR function, but i cannot get that to work. Anyone have any insight into this?
Thank you!
Hello! Subtract the number of people who have both values present. Try the formula:
=COUNTIFS(I:I,"",D:D,"DEPO",B:B,"2024FA")+COUNTIFS(J:J,"86",D:D,"DEPO",B:B,"2024FA") - COUNTIFS(I:I,"",J:J,"86",D:D,"DEPO",B:B,"2024FA")
Hi! I'm trying to count a range of cells across a large array; *if* they match the criteria in a single column,
so, my first through was; It should be as simple as
=COUNTIF(B3:B123, "A Shift", F3:HH123, "Assigned"),
now; if i'm understanding correctly; the the vertical range must be the same size;
Is failing because the horizontal range is larger?
If so; what's the solution to simply find
if x=a in a single vertical column, count how many occurrences on the horizontal =b
I've tried
=IF(B3:B123=A, COUNTIF(F3:HH123, "Assigned"),0) and that wants to spill to nearby cells;
What am I missing here?
Hi! If I understand your task correctly, to count the number of values across multiple criteria, try using the SUMPRODUCT function. Here is an example formula:
=SUMPRODUCT((B3:B20="A Shift")*(F3:M20="Assigned"))
I hope it’ll be helpful.
Thanks for the speedy reply;
Unfortunately that example is returning 0
For what i'm trying to do, I have Column B which is just "A", "B", and "C" about 20 times each as we go down the rows from 3 to 123;
Then I have a matrix going across all the way from Column F to Column HH,
Some of the cells have dates in to indicate when a task completed; and some contain just the word "Assigned";
I'd like to count how many occurances of "Assigned" appear across the range where column B="A", then once that's working follow on for rows where Column B="B" and where Column B="C"
I originally used
=COUNTIFS('Primary Matrix'!F3:T30,"*Assigned*") to count the rows where Column B="A"
but this would mean that someone will have to manually adjust the formula whenever a new person is added to the range where B="A"
So rather i'd like to create a formula that will sum all occurrences of "Assigned" between Columns F and HH; only IF column B="A"
So i've tried your example like this, and I can see how it should work;
=SUMPRODUCT((B3:B123="A")*(F3:HH123="*Assigned*"))
But it returned 0 across a range that does contain multiple occurences of "Assigned", and I feel like i'm missing something obvious; but I can't work out what.
Hi! The formula I sent to you was created based on the description you provided in your first request. However, as far as I can see from your second comment, your task is now different from the original one.
To learn how to find a partial text match, please read: How to find substring in Excel.
For example:
(ISNUMBER(SEARCH("Assigned",F3:HH123)))
Hi,
I'll give that a go;
Apologies if it was unclear; the task has always been: count number of "*Assigned*" in a range; only where column B (outside of that range)="A*", and ignore other instances (within the range) of "*Assigned*"
Hi! If I understand correctly, use the FILTER function to get the range to count the "Assigned" values.
=SUMPRODUCT(--(FILTER(F3:M120,B3:B120="A")="Assigned"))
So, I've found a workaround;
I wanted to avoid adding any additional columns to the page with the data;
but by doing a single column with just
=COUNTIF(F3:HC3,"*Assigned*")
after the final data column; then all I had to do was (on the page I wanted to display the data)
=SUMIF('Primary Matrix'!B:B,"A*",'Primary Matrix'!HF:HF)
and likewise for B, and C.
that's solved it; not how I wanted to solve it; but it unarguably works now.
*A single column, with that COUNTIF repeated for each row of data.
I am trying to incorporate the today function into my countifs formula. I have a column that reflects the date of activity but I can't seem to get it right.
=COUNTIFS(Master_TTHU_Inventory!$H$2:H$5000, A4,Master_TTHU_Inventory!$G$2:$G$5000,"MISSION READY")
The above formula is for my grand total report, but I need to show daily totals for cob that day on a separate sheet using the same information.
Hi! Create a column with dates on a separate sheet. Then add a condition for the date to the COUNTIFS formula. For example:
=COUNTIFS(Master_TTHU_Inventory!$H$2:H$5000, A4,Master_TTHU_Inventory!$G$2:$G$5000,"MISSION READY", Master_TTHU_Inventory!$D$2:$D$5000,New_Sheet!D2)
D - column with dates.
You can get a report without formulas, using a pivot table with grouping by days. Read more: How to make and use Pivot Table in Excel.
I hope it’ll be helpful. If something is still unclear, please feel free to ask.
I appreciate a lot to the information provided above. We are learning. However, I am still not clear on something I dont know which formula works best for the following example.
A B C
Month Dept Service Requested
1 Jan-23 Sales 0001
2 Jan-23 Sales 0001
3 Jan-23 Sales 0001
4 Jan-23 Operations 0001
5 Jan-23 Accounts 0002
6 Jan-23 Operations 0002
7 Jan-23 Accounts 0002
8 Jan-23 Admin 0003
9 Feb-23 Accounts 0004
10 Feb-23 Sales 0004
11 Mar-23 Accounts 0005
12 Mar-23 Operations 0006
13 Mar-23 Sales 0007
14 Mar-23 Operations 0008
15 Apr-23 Admin 0009
16 Apr-23 Admin 0010
17 May-23 Admin 0011
I want to count "how many service types were requested by each department per month". This means the formula has to count the similar service type once for same dept in the same month right.
Hi! If I understand your task correctly, the following tutorial should help: Count unique values with multiple criteria. For example,
=IFERROR(ROWS(UNIQUE(FILTER(B1:B20, (MONTH(A1:A20)=1)* (C1:C20="0001")))), 0)
I am using this formula and it is generating an incorrect value. =COUNTIFS('Tray Audit Log'!D:D, "Y",'Tray Audit Log'!B:B,">6/1/2023") - COUNTIFS('Tray Audit Log'!B:B,"<6/30/2023"). The data is counting 641 when there are actually 194 yes in the month of June.
I am trying to count the total y(yes) from one column and the MONTH from another column all information on a different tab. I can send the data via email I cannot attach it to this chat.
Hi! If you want to calculate June data, use the dates of May 31 and July 1 in your formula.
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.
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
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.