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 3. Total comments: 2050
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.
Hello! I have a range of dates I am looking at, and for those dates, one of two options will occur. I am trying to sum option A and option B by month. I have tried a COUNTIF similar to index match, but Excel is multiplying the data,
I am looking to count up the number of instances that option A and option B occur in February, then March, then so on; and show a comparison between the two by month.
Thanks for any help you can give!
Hi! Unfortunately, this information is not enough to understand what you need. Do you want to calculate OR logic or AND logic? Have you tried any of the methods described in this blog post? If they don't work for you, give an example of the source data and the expected result.
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.
Can someone help I dont know how to implement the Countifs formula is the sheet e.g. Column A2 has date B2 has Reference number Column C2:C5 has multiple items for that reference number. The next Reference number start from B6 and so on. I want count all reference based on date column. I want to make summary on weekly basis. The Column A2:A5 has same date uses it for SUMIFS so I can not leave it empty.
Hi! From your description, it is difficult to have a full understanding of your task. I’ll try to guess and offer you the following guide: Count unique values with criteria. If this is not what you intended to calculate, it would be helpful if you could provide an example of the source data and the desired result.
A B C D E F G H
Date Reference Items Value
05/02/2024 AA12 A £60 FEBRUARY
05/02/2024 C £40
05/02/2024 D £40 Weekly Breakdown Value Count
05/02/2024 F £20 01/02/2024 SUMIFS ?
05/02/2024 F £6.95 05/02/2024 SUMIFS ?
12/02/2024 SUMIFS ?
08/02/2024 BB13 da £129.00 19/02/2024 SUMIFS ?
08/02/2024 ss £18.00 26/02/2024 SUMIFS ?
08/02/2024 sa £14.00 Total XXXX 0
16/02/2024 CC14 aa £40.00
16/02/2024 ss £40.00
16/02/2024 sss £40.00
16/02/2024 asa £50.00
16/02/2024 assd £14.00
16/02/2024 afsaf £6.00
My sheet is like this I want to make weekly report (Column F to H) based on data on left side from Column A to D. For Values sum I used SUMIFS with Date as criteria in Column G. I want to Count The Column B reference based on date as criteria. So the count of each week comes ups in summary report based on data in Column A and B.
A....................B..............................C................D
Date..............Reference.............Items..........Value
05/02/2024..............AA12..............A...........£60.00
05/02/2024.....................................C........... £40.00
05/02/2024.....................................D...........£40.00
05/02/2024.....................................F........... £20.00
05/02/2024.....................................F........... £6.95
12/02/2024..............BB13..............A...........£60.00
12/02/2024.....................................C........... £40.00
12/02/2024.....................................D...........£40.00
19/02/2024..............CC14..............A...........£60.00
19/02/2024.....................................C........... £40.00
19/02/2024.....................................D...........£40.00
Summary Table
F........................................G......................H
Weekly Breakdown.........Value.............Count
01/02/2024.....................SUMIFS ...........?
05/02/2024.....................SUMIFS ............?
12/02/2024.....................SUMIFS ............?
19/02/2024....................SUMIFS ............?
26/02/2024....................SUMIFS..............?
My sheet is like this I want to make a weekly report (Columns F to H) based on data in Columns A to D. For Values sum I used SUMIFS with Date as criteria in Column G. I want to Count The Column B reference based on date as criteria. So the count of each week comes ups in a summary report based on data in Columns A and B.
Hi! If I understood the question correctly, all the information you need is in the article above. Also pay attention to the instructions: Using Excel COUNTIF function with dates. For example:
=COUNTIFS(B2:B10,""&"",A2:A10,">="&DATE(2024,2,1),A2:A10,"<="&DATE(2024,2,5))
Your summary table does not have an example of the desired result and does not match the description of the question. So if I don't guess, ask precisely.
When I apply this formula it gives me the count of both A and B columns, but I only want to count column B. In the above case, it should be 1 in the first week.
The COUNTIFS formula counts the values in one column B that match the conditions in column A. Read the article above carefully. And explain what you want to do.
I am working with a sheet where I have drop down menu with three options, poficient, accomplished, developing, needs assistance and want to count only profient and accomplished and divide them by the number of row
so i have 4 rows and but what to count only proficient and accomplish ratings and then /4 rows to get an average out of 100 point
Hi! You can count the number of values for each variant using the COUNTIF function. You can count the total number of values using the COUNTA function. You can count the number of rows in the range of values using the ROWS function. I cannot give you a more precise answer because your explanations are not very clear.
I am trying to use a formula to count the number of cells in a table from a drop down field which fall into two dates in a table. Does that make sense?
So quarterly or monthly data range measuring the number of referrals from a specific Area:
Referral area:
WARD x
WARD y
WARD Z
( Table data collated will have date of referral )
Hi! Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail. As it's currently written, it's hard to tell exactly what you're asking.
I have tried but unable to make it work for me. Forgive my basic excel knowledge but if i had a source table where there was a date of entry for every row added basic example
Apple 01.04.2024
Apple 01.02.2024
Pear 03.02.2024
Bannana04.02.2024
Pear 01.03.2024
Apple 05.02.2024
I need a formula to count the entries for apple and pears between monthly and Q1 dates
Is that any clearer i can count the number of entries and the amount between two dates but not both
Hi! Pay attention to the following paragraph of the article above: Count cells with multiple criteria (OR logic). Here is a guide to the counting of dates that are within a certain interval: COUNTIF formulas for dates.
The formula might look like this:
=COUNTIFS(A1:A6,"apple",B1:B6,">="&"2024-01-01",B1:B6,"<"&"2024-04-01") + COUNTIFS(A1:A6,"pear",B1:B6,">="&"2024-01-01",B1:B6,"<"&"2024-04-01")
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.
Hi Dear, I am having a hard time to find out the formula, I have 3 range references, 1st range I want to count the not equal to values, and the other 2 ranges I want to count with equal criteria but I could’nt get the actual counts after I validate from my table source
Hi! Unfortunately, this information is not enough to understand what you need. To understand what you want to do, give an example of the source data and the expected result.
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).
=COUNTIFS('Document Master'!$H$11:$H$378,"Philippe MURPHY",'Document Master'!$P$11:$P$378,">="&H72,'Document Master'!$P$11:$P$378,"<="&EOMONTH(H72,0),'Document Master'!$Q$11:$Q$378,"Approved")
This formula is working, however, I want to count also not only "Approved" documents but also "For information only" documents.
How do i do that?
Hi! Please re-check the article above since it covers your task. Read following paragraph: Count cells with multiple criteria (OR logic). I can't recommend you a formula that contains unique references to your data that I don't have.
Hello,
I have cells A1,A3,A5,A7 - I need to find out if they add up to 40 - if they dont for it to be a 0 and if they do to be the difference.
How would I put that into a formula please.
So if they added up to 28 the answer woudl be 0. But if they added up to 48 the difference woudl be 8. Thank you so much.
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
What about if I whant to count a cell that contains this data "Proj 34d Late", but in the other cells i can have "Late", "On Time", "Proj 0d On Time", and "Proj 5d Earlier"
Hi! Pay attention to the following paragraph of the article above: Count cells with multiple criteria (OR logic). You can also count all cells that have a certain word in them. For example:
=SUMPRODUCT(--(ISNUMBER(SEARCH("late",A1:A10))))
For more information, please read: How to find substring in Excel
Happy New Year to all!
Hi Alex! This formula works, but running with the issue is also counting when in the cell I have "Proj. 268 LATE" with the "48d LATE". How I can exclude counting when there is a projection in the future "Proj. #d LATE" in the A1:A#10, and only count the present milestones that are Late - "#d LATE"? Appreciate the help once again. I'm learning here. Thanks.
I gave you a link to the instructions for you to read. To look for a different text string, just change it in the formula. Instead of "late" it's "d late".
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.
Hi! I can't check your formula because I don't have your data.
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 COUNTIF working in my spreadsheet to count how many projects a person is on (example: John Smith can be on 4 different projects at 25%) however, if John Smith has "AL" (annual leave) instead of a percentage of work on that project for the week how would I display "AL" instead of the sum of 4 projects to give a high level overview that the person is on annual leave?
I will need this to also reflect for Parental Leave (PL)
Hi! If I understand your task correctly, the following formula should work for you:
=IF(COUNTIFS(A1:A10,"John Smith",B1:B10,"AL"),"AL",COUNTIF(A1:A10,"John Smith"))
Hi, How to flashfill or autofill the COUNTIFS
Hi! Maybe this guide will be helpful: Excel - autofill formulas.
Hello, how can i count data with COUNTIF that have an operator like "<IDR 1000" as text, not as command/formula? is it included in wildcard type?
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)))
Hi! The expression "
Hi, I have a spreadsheet that records answers to a series of questions that are submitted by employees. We have 3 shifts per day and each shift might enter 30 to 40 submissions. I have sorted the sheet in to date and time order so that each employee's name appears in "blocks" of entries. For example there might be 35 entries submitted by Fred, followed by 31 entries submitted by John, followed by 39 entries submitted by Sarah etc etc. Currently there are over 27,000 rows of data and growing. There are over 900 shifts (3 per day). What I am trying to achieve is to count the number of shifts carried out by each individual. Unfortunately I don't have access to the time sheets so I need to rely on the spreadsheet I'm working on. Is there a way to count the number of times a name appears as the first entry where there are multiple instances of that name? For example, lets assume that Sarah has done 23 shifts, here name would appear in 23 "blocks" of data, with each "block" containing multiple instances of her name (all in the same column). I can easily count how many submissions Sarah has entered, but what I want to know is how many "blocks" of her name there are. I hope that makes sense :)
Hi! This information is not enough to recommend a formula to you. If you have an additional column in your data where the date or shift number is written, you can count the number of unique values in that column for the employee's name. For example:
=IFERROR(ROWS(UNIQUE(FILTER(B2:B100,A2:A10="John Doe"))), 0)
You can find the examples and detailed instructions here: How to count unique values in Excel an easy way. I hope it’ll be helpful. If something is still unclear, please feel free to ask.
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.
I need a formula to find only cells in Column B(Amount) that adds up to Zero for each criterion in Column A(Reference)
Reference Amount
A97024 -57.73
A97024 1924.28
A97024 -1924.28
A97047 -893.16
A97213 229.65
A97213 -5569.68
A97213 5340.03
A97227 251.49
A97227 -3025.38
A97227 2773.89
A97232 -7.49
A97232 249.79
A97232 -249.79
A97244 229.65
A97244 -5569.68
A97244 5340.03
A97290 -1314.56
A97358 -9.39
A97358 156.43
A97358 -156.43
A97439 4208.14
A97439 -8474.05
A97439 4265.91
A97459 -3.41
A97459 -56.79
A97459 3.41
A97459 56.79
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,
I have a (very large) table with the following entries for each row:
name_of_applicant date_birthday date_application
I am trying to count all applications, where both of the following criteria are true:
1. all that have applied after a certain date, e.g. the 2022/01/01
2. the person was at least 16 years old at the day of the application
I cannot change the table itself or add auxiliary entries.
The first part (application after...) is no problem, but I can't figure out how to combine it with the second criteria.
Thanks for your help!
Hi! You cannot use calculations inside COUNTIFS formulas. Therefore, try a formula that looks like this:
=SUM(--((C1:C10>=DATE(2022,1,1)) + (DATEDIF(B1:B10,C1:C10,"y")>=16)=2))
To calculate age, use these guidelines: How to calculate age in Excel: from date of birth, between two dates
I have a sheet I am working on with dropdowns. I have fir example column E3:E63 has a dropdown box of new, used, pending or purchase. I need a formula to count say the "new" as 1, but in column F3:F63 I have a dropdown with employee names, so if a persons name is selected I need it subtract .5, if no name is selected or "no" then it can stay as 1. Not to add in addition to, but to just remain 1. If that makes sense?
To give you the scenario, I sell cars for a living. So, when I track my sold units I have a dropdown that tells me if it was a new car, used car, pending or a purchase. In the next column, (F) if I had to split the sale with an employee and I select their name I need it to subtract .5 from the new car or used car etc. I can count it as a whole number using the =Countif(E3:E63, "new") and it tallies a 1 in the "new units sold" section, but if it happens to be a split with another employee in column F3:F63 I need it to subtract .5. Is this possible, and if so, what is the formula? I have been trying to figure this out for 2 months and cannot get it!
Hi! The COUNTIFS function can be used to find the sum of multiple conditions. For example,
=SUMIF(F2:F10,"",E2:E10)+SUMIF(F2:F10,"no",E2:E10)+SUMIFS(E2:E10,F2:F10,"<>",F2:F10,"<>no")*0.5
You can also use the SUMPRODUCT function to find the sum of multiple criteria.
=SUMPRODUCT(E2:E10,0.5+0.5*(ISBLANK(F2:F10)+(F2:F10="no")))
I hope it’ll be helpful.
I'm sure others will provide a better answer but what I would do is create a formula in column G that that basically says that if F is not blank (meaning it includes a sales person's name with whom you'll split the sale with) then return .5, otherwise 1. =IF(F3="",1,0.5) copy this down to F63. then you can just sum those numbers together to get you the total units sold including split sales.
In the tutorial above, there is an example that counts orders with the status "Cancelled" or "Pending" or "In transit". The provided formula is:
=SUM(COUNTIFS($C$2:$C$11, {"cancelled", "pending", "in transit"}))
However, I’m interested in having the "cancelled", "pending", "in transit" portion of this formula contain a cell reference to this text. Something like:
=SUM(COUNTIFS($C$2:$C$11, {$D$2})) where cell D2 contains "cancelled", "pending", "in transit".
Any suggestions on how to get it to work?
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.
Hi,
I am wanting to find the sum of all cells which have a specific value in the same row.
I am currently logging teaching hours in a sheet and using a drop down in column D to select which class I am teaching (class A, class B, class C), then the amount of hours (1.5, 3, 4.5) in column G. Is there a way to add only the cells next to a specific class? So I can see a total number of hours for each specific class?
Thanks
Hi! Based on your description, it is hard to completely understand your task. However, I’ll try to guess and offer you the following formula:
=SUMIF(D2:D10,"A",G2:G10)
I recommend reading this guide: How to use SUMIF function in Excel with formula examples.
That's perfect, thank you :)
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"))))
DATE SALESMAN PRODUCTION HORECA
01-Oct-23 KOUSHAL JOSHI FOLLOW UP
01-Oct-23 NEERAJ PARIHAR CLOSED
01-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP
01-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
01-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
06-Oct-23 RAFIQ SHEIKH FOLLOW UP
06-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
06-Oct-23 RAFIQ SHEIKH CLOSED CLOSED
09-Oct-23 NEERAJ PARIHAR FOLLOW UP FOLLOW UP
10-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
10-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
10-Oct-23 RAFIQ SHEIKH FOLLOW UP
13-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
14-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
15-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP
15-Oct-23 KOUSHAL JOSHI FOLLOW UP FOLLOW UP
15-Oct-23 NEERAJ PARIHAR CLOSED CLOSED
15-Oct-23 RAFIQ SHEIKH FOLLOW UP FOLLOW UP
Need to know that which sales man has generated how many leads in production and HORECA on daily basis. Required daywise report
Hi! I can't guess what result you wanted to get. Please provide me with an example of the expected result.
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.
=COUNTIFS('Section 2'!$AC:$AC,"Pending",'Section 2'!$AA:$AA,">12 months")
I am trying the above formula to get the number of cases pending beyond 12 months, as per my data sheet the result of this formula should be 0. however, the formula is returning a value i.e. 1 in first instance & 2 in second instance.
When I removed the > sign, I got the desired result. Also, when I tried adding >12 months in my data sheet as a dummy value to test the formula, it did not return the correct number. why is that so?
Hi! I can't check your formula because I don't have your data. However, your formula counts the number of text values, not dates. I recommend reading this guide: COUNTIF formulas for dates.
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.
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
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
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))