As everyone knows, Excel COUNTIF function is designed to count cells based on just one criterion while COUNTIFS evaluates multiple criteria with AND logic. But what if your task requires OR logic – when several conditions are provided, any one can match to be included in the count? Continue reading
Comments page 2. Total comments: 172
Hi ,
Let's say I have 2 columns Column A - 1-20 and Column B - 31 - 50. How can I count the unique entries when column A is > 10 or Column B is > 40. Kindly help.
Hello!
If I understand your task correctly, the following tutorial should help: Count unique values with criteria.
Hi Sir,
I am creating schedules for our staff. Using below data and trying to count the actual working employees total and ignore employees those are on training and days off. I am using this formula but its not working . Please help me
=SUMIF($D$6:$D$14,"TRAINING",F6:F14) + SUMIF(F6:F14,"D/O",F6:F14)
AM Leads 05:45 - 14:15
D E F G H
LEADS EMPL # Sun Mon Tue Wed Thu Fri Sat
1 TRAINING D/O D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15
2 ANNY 05:45 - 14:15 05:45 - 14:15 D/O D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15
3 PERRI 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 D/O D/O 05:45 - 14:15
4 JAM D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 D/O
5 KLM 05:45 - 14:15 D/O D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15
6 BOBBY 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 D/O D/O 05:45 - 14:15 05:45 - 14:15
7 TRAINING 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 D/O D/O
8 TRAINING D/O D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15
9 TRAINING 05:45 - 14:15 05:45 - 14:15 D/O D/O 05:45 - 14:15 05:45 - 14:15 05:45 - 14:15
Daily Total 6 6 6 6 7 7 7
Actual Daily 4 4 0 0 0 0 0
Variance +(-) 2
Hi!
Use the COUNTIF function instead of the SUMIF function as described in the article above.
Hi sir,, thanks so much for yo class it's very interesting I've added something new..
Can you let me know if there is an excell formal that can colour the cell with a certain commands??
Hi!
I don't really understand your question, but maybe you need to use conditional formatting.
I mean that,, is there a formula that can help me to make a cell coloured??
Hi!
Take a look at the article I recommended to you earlier. This guide may also be helpful: Excel conditional formatting formulas based on another cell.
Hi
My current issue is i have to sheets lets say
Sheet1 is where the formula is so
Countif(sheet2A:A;$C$3) this formula will be in cell C5 and the C6,C7, C8
What i need is to move the auto fill series to move ranges on sheet2 to be filled as the formula on C6 to query B:B, C7 to query C:C and so on
Can you help me with that please
Hi!
Copying the formula down may change the row numbers, but not the column numbers. Autofill is not working the way you want.
You can dynamically change cell addresses in formulas using the INDIRECT function.
What do I do if I need to do count cells with multiple sets of OR conditions, but one of or conditions is not match, but rather a countif (ie >0)? Thanks!
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, I’ll try to suggest a solution.
Hi, I'm trying to assemble multiple AND/OR logic. The first group I can solve with SUM(COUNTIFS, but getting stuck after the OR logic
Count cells if:
column F is one of: "*Scope*","*Component*","*Vendor*" AND column E = A2 (let's call this group1)
OR
column F = "*Decommission*" AND column I "*Production*" AND column E = A2 (let's call this group2)
Final result should be total cell count of group1 + group2
(wildcards intentional)
Thank you
Hi!
Have you tried the ways described in this blog post? It covers your case completely.
Here is an example formula
=COUNTIFS(F1:F10,"*Scope*",E1:E10,$A$2)+COUNTIFS(F1:F10,"*Component*",E1:E10,$A$2)+COUNTIFS(F1:F10,"*Vendor*",E1:E10,$A$2)
For more information, please read: COUNTIF with wildcard characters (partial match)
note in the second group column I doesn't equal "*Production*" - looks like my symbols were removed
I have excel sheet for result analysis range H7:ET600. I have to count "AB" from some columns {e.g. J, W, AJ, AW, BJ, BV, CC, CO, DB, DO, EB, EP columns } only. I can't select range because columns other than {J, W, AJ, AW, BJ, BV, CC, CO, DB, DO, EB, EP} these one also have "AB" entry. how I can count it?
Hi!
If I understand your task correctly, the example following formula should work for you:
=SUM(--(A1:A10="AB"),--(C1:C10="AB"),--(E1:E10="AB"))
Specify each column individually.
How to count the occurrence of each number (range from 1 to 14) in a cell with a number pattern 1/12/5/1/13/10 or 10/11/9 or 8/5 ?
Hello!
Split this text into cells using this guide: How to split cells in Excel: Text to Columns, Flash Fill and formulas. Then count the number of times the number appears in the range using the COUNTIF function.
Good day
I'm trying to automate a count on a per class basis and a age.
my current formula is this:
=SUM(COUNTIFS('PC Spec CPT'!$A$1:$L$171, "*CLASS1*", 'PC Spec CPT'!$A$1:$L$171, {"5 years","6 years","7 years","8 years","9 years","10 years"}))
This is returning a value of 0
but if I do the counts separately I get the correct values. so "count class1", gives 39 and count (the different years) gives a value of 151 (as its searching the whole data set, but I only need it to count for class1 (Which is actually from A3 to L41) but I want to future proof for if I add or remove from the set
So the count cant be 0
Hi!
The COUNTIFS formula counts the rows where all the criteria are met once. But at the same time, it cannot work with a range ($A$1:$L$171), but only with a data column ($A$1:$A$171).
I think i may have figured it out...
=SUM(COUNTIFS('PC Spec CPT'!$B$3:$B$171, "*CLASS1*",'PC Spec CPT'!$J$3:$J$171,{"5 years","6 years","7 years","8 years","9 years","10 years"}))
Appears to give the correct result... I just needed to isolate the columns for the 2 criteria instead of doing the whole data set
Awesome! Thanks a lot for all clarifications in here!
Can you help....?
I have a spreadsheet with data collected from an electronically completed survey. Some of the columns are free text entry from the form. I want to summarise the submissions and categorise according to job role. However, there are a huge number of terms used for example for doctors....."registrar", "SHO", "consultant" "consultant anaesthetist", "anaesthetist", "FY2", "clinical fellow" etc. I am trying to use SUM and COUNTIFS to give me the number of forms that were submitted for a group of staff in one month. However, I am getting entries double counted as if the free text includes "consultant anaesthetist" then it is being counted twice as I want to ensure that entries that have only described the doctor as a consultant or anaesthetist are counted....
This is my formula I have named ranges Date and Recipient, H5 and I5 are cell references to specific dates.
=SUM(COUNTIFS(Date,">="&H$5,Date,"<"&I$5,Recipient,{"*Doctor*","*anaesthetist*","*surgeon*","*consultant*","*SAS*","*fellow*","*sho*","*reg*","*CT1*","*CT2*","*CT3*","*ST1*","*ST2*","*ST3*","*ST4*","*ST5*","*ST6*","*ST7*","*FY1*","*FY2*","associate specialist"}))
Hello!
To avoid double counting, in a separate column, write something like this SEARCH formula with all the words you need. Then use that column to count in the COUNTIFS formula.
=--(SUM(--ISNUMBER(SEARCH({"Doctor","anaesthetist"},A2)))>0)
Good morning! You all are so incredibly helpful, I just hope I can describe my issue well enough for you to understand! I have a table that looks like this:
Virtual Virtual Virtual
Onsite Onsite
OTT OTT
Jon X X X
Dan X X X
Rob X X X
Tim X X X
I need to count the number of times each person is either Onsite or OTT. The results I should get are:
Jon 2
Dan 1
Rob 0
Tim 3
However, when I try to use normal COUNTIFS it counts Jon and Tim twice because column C has both Onsite AND OTT. I need it to count Onsite OR OTT. I tried to use the OR logic you outlined... =SUM(COUNTIFS($B$1:$G$3,{"Onsite","OTT"},B4:G4,"X")) but that doesn't work with multiple rows. How can I get this to calculate correctly? I feel like I'm so close...
Okay, so multiple spaces get stripped out... Let's try with dots...
..........Virtual................Virtual................Virtual
........................Onsite...........................................Onsite
........................OTT....................OTT
Jon......................X.........................X.............X
Dan.........X.......................X......................................X
Rob.........X.......................X...........................X
Tim.....................X..........................X........................X
I am working on a spreadsheet with Start Date, Resolve Date, and Status. I want to look at the amount of work being done in the current month. For example, if I'd like to look at the number of things completed in August, I could count everything initiated in August that has a complete status PLUS everything resolved in August with a complete status. BUT, the problem is that some things can be initiated in August and Resolved in August, which would cause the same issue to be double counted.
My current formula for counting total complete based on start date is
=COUNTIFS(StartDate,">="&EOMONTH(TODAY(),-1)+1,StartDate,"="&EOMONTH(TODAY(),-1)+1,Resolved,"<"&EOMONTH(TODAY(),0)+1,Status,"Completed")
I'm not quite sure how to combine these into one formula and prevent the double counting of items that are completed with a start and resolve date in the same month. Any help would be greatly appreciated!!!
Hello!
I can't check the formula that contains unique references to your workbook worksheets. Count the records that meet the first condition, add the records that meet the second condition, and subtract the records that meet both conditions.
=COUNTIFS(StartDate,”>= ”&EOMONTH(TODAY(),-1)+1,Status,"Completed") + COUNTIFS(Resolved,”<"&EOMONTH(TODAY(),0)+1,Status,"Completed") - COUNTIFS(StartDate,”>=”&EOMONTH(TODAY(),-1)+1, Resolved,”<"&EOMONTH(TODAY(),0)+1,Status,"Completed")
I typed in two formulas, but it looks like it somehow got combined into two?? They should be as follows:
Based on start date:
=COUNTIFS(StartDate,">="&EOMONTH(TODAY(),-1)+1,StartDate,"="&EOMONTH(TODAY(),-1)+1,Resolved,"<"&EOMONTH(TODAY(),0)+1,Status,"Completed")
I don't know why this keeps happening... There are two formulas that I'm typing in, with a new paragraph between them. My paragraph keeps getting deleted and the formulas partially combined.
Hi,
I am trying to create a column that will provide me a subset of orders that need to be reconciled between two ERP systems. However, there are three different types of ways that one system will recognize an order.
I am hoping that this column will catch IF it exists in one system under one reference, but right now there are cases where an order can be recognized by all three references, just depends on user input.
Trying to acheive a formula that will count Order Ref 1 OR Order Ref 2 or Order Ref 3. If the system recognizes it as Order Ref 1 / Order Ref 2 I only want it to count once towards the total subset.
Current formula: =COUNTIF('TMS DATA'!A:A, Table2[[#All],[Order '#]])+COUNTIF('TMS DATA'!A:A,Table2[[#All],[Shipment'#]])+COUNTIF('TMS DATA'!A:A,Table2[[#All],[Order ID]])
Can you help me with the OR part that I am missing? I feel like I am just counting them all.
Hi!
It is very difficult to understand a formula that contains unique references to your workbook worksheets. Unfortunately, without seeing your data it is difficult to give you any advice. Please provide me with an example of the source data and the expected result.
Can anyone help with the formula?
I have 10 drivers and 10 vehicles, Each day wages of driving individual vehicle is different. I.e Vehicle A wages 500, vehicle B wages 1000 and Vehicle C Wages 1500. Now Driver A had drove those vehicles in term of 15 days. How would I calculate this with the formula.
Hello and thank you for you dedication to helping people!
I believe there is an issue with the AND/OR logic part of the article in that the formula generates "false positives" which must be subtracted to get a correct answer.
LIST A LIST B LIST C LIST D
TRUE TRUE TRUE TRUE
TRUE TRUE TRUE FALSE
TRUE TRUE FALSE TRUE
TRUE TRUE FALSE FALSE
TRUE TRUE TRUE TRUE
TRUE TRUE TRUE FALSE
TRUE FALSE FALSE TRUE
TRUE FALSE FALSE FALSE
TRUE FALSE TRUE TRUE
TRUE FALSE TRUE FALSE
TRUE FALSE FALSE TRUE
TRUE FALSE FALSE FALSE
For instance, if (A and B) or C or D are true in the above data the result should be 5 (not 7) as below:
=COUNTIFS(LIST_A,TRUE,LIST_B,TRUE,LIST_C,TRUE)+COUNTIFS(LIST_A,TRUE,LIST_B,TRUE,LIST_D,TRUE)-COUNTIFS(LIST_A,TRUE,LIST_B,TRUE,LIST_C,TRUE,LIST_D,TRUE)
Here's the rub. If I have additional columns (not shown and also not actual data) and need to find (A and B) or C or D or E or F or G or H or I or J or K or L in a list of 100,000 items (peak season), is an elegant solution possible?
Thanks and I do appreciate your work!
Hi!
Your formula returns 5. But if I understood your conditions correctly, the result should be 3.
If I understand your task correctly, the following formula should work for you:
=SUM(--((A2:A13+B2:B13+(C2:C13+D2:D13=1)=3)))
I hope I answered your question. If something is still unclear, please feel free to ask.
Thank you for the prompt response. Unfortunately I did not clearly state the full nature of the problem.
Data is not "true" or "false" but could be text, currency, value, date, blank, etc.
Each line is counted only once based on conditions further explained as follows:
List A and List B must both be "true" for a line to be counted.
Lists E through L must have at least one condition "true" for a line to be counted.
Each line may only be counted as one instance.
So lines 1, 2, 3, 5, 6 should be the only lines counted for a total of 5 lines meeting the conditions.
Helper columns discouraged because of the size of the data.
I perceive this as Wizardry at this point.
Hi!
If I understand your task correctly, try the following formula:
=SUM(--(((A2:A13=TRUE)*(B2:B13=TRUE)*100+(C2:C13=TRUE)+(D2:D13=TRUE)) > 100))
Sir, that is a brilliant and imaginative solution! This is a truly remarkable method for implementing complex AND/OR conditions in Excel. Thank you and may the formulas be always in your favor.
Hello. The "count cells with multiple sets of OR conditions" formula described above was extremely helpful for me. Thank you!
Let's say there's a "Date_Shipped" column in D:D.
How can I find {apples, bananas, lemons}, {bag,tray}, {delivered, in transit} ***where Date_Shipped > mm/dd/yyyy and Date_Shipped < mm/dd/yyyy***
This is the formula from the example above I'm using and just need to figure out how to incorporate the date part:
=SUMPRODUCT(ISNUMBER(MATCH(A2:A10,{"apples","bananas","lemons"},0))*
ISNUMBER(MATCH(B2:B10,{"bag","tray"},0))*
ISNUMBER(MATCH(C2:C10,{"delivered","in transit"},0)))
Thanks for any help you can offer. Cheers!
Hello!
If you write dates in column B, then you can compare them with the desired date using the DATE function.
=SUMPRODUCT(ISNUMBER(MATCH($A$2:$A$10, {"apples","bananas","lemons"},0))*ISNUMBER(MATCH($B$2:$B$10, {"bag","tray"},0))*ISNUMBER(MATCH($C$2:$C$10, {"delivered","in transit"},0))*(--($D$2:$D$10 > DATE(2022,2,1))*(--($D$2:$D$10 < DATE(2022,3,1)))))
Hope this is what you need.
Thank you! I was not familiar with the double minus (--). This is exactly what I needed and the formula works like a charm. CHEERS!
I have a worksheet that I am working for work. Basically, I would like to count how many people visit the park (column A) in both year 2020 and 2021(column B). Column B only shows either 2020 or 2021.
This formula: =SUM(COUNTIFS(Table2[List YR], {"2020","2021"}, Table2[COUNTY], A2))
- provides number of people that visit on 2020 and number of people that visit on 2021, not the number of people that visit both year.
This formula: =COUNTIFS(SPEC!A:A,A2,SPEC!B:B,2020,SPEC!B:B,2021)
- provides 0
Please help
Hello!
Add column C to the table with the formula
=IF(COUNTIFS($A$2:$A$10,A2,$B$2:$B$10,2021)>0,2021,"")
Count the number of people using COUNTIFS:
=COUNTIFS(B2:B10,2020,C2:C10,2021)
I hope my advice will help you solve your task.
If a student gets mark less than 16 or his average be less than 50 he must be in group D. Please write a formula for it
Hi!
Please check out this article to learn how to write an IF OR statement in Excel to check for various "this OR that" conditions.
Hello!
My husband is trying to create a spreadsheet for work and cannot seem to find a formula that works.
He is trying to use the COUNTIFS function to count all cells in a range that are within separate number ranges.
He needs the cells to be counted once if they are below 517, or between 525 and 896, or above 905. Every formula we have tried has not worked. It either does not count the cells, or counts them more than once.
This is an example of one of the formulas we have tried:
=COUNTIFS(C3:I4,">=0","525","905")
I know this is not right, but I have scoured the internet but have not found a solution.
Thank you!
Hello!
You can find the examples and detailed instructions here: Count cells with OR conditions in Excel.
I hope I answered your question. If something is still unclear, please feel free to ask.
Hey, can you help me with a google sheet formula?
=SUM(COUNTIF('Signed Case'!C:C,{"Barry","Maya"}))
It seems that Google Sheet can only count the total number of "Barry" but NOT BOTH "Barry" and "Maya", is there a way to fix this?
=SUM(COUNTIF('Signed Case'!C:C,{"Barry","Maya"})) - Wrong Formula
Correct one
=SUM(COUNTIFS('Signed Case'!C:C,{"Barry","Maya"})) -than press Ctrl+shift+Enter
Hey Barry,
I believe you will find these instructions for Google Sheers helpful:
Count in Google Sheets with multiple criteria — OR logic
Hello!
I have been trying to count the number of LGBTQ+ from an organization. However, the code
SUM(COUNTIF(range, {criterion1, criterion2, criterion3, …}))
does not seem to work. Here is a sample of my work. I hope you can visualize it.
=SUM(COUNTIFS(E169:E209,{"P","Bi"}))
Note: COUNTIFS or COUNTIF, still does not work. It does not count the "Bi"
I am trying to count Yes and No in 1 cell but from multiple columns and then create a score in another column. So if I got 3 "yes" and 1 "no" the score would be 3. This what I got:
=SUM(COUNTIF(U3,N3,X3,{"Yes",1})(U3,N3,X3,{"No",0}))
But it did occur to me that I don't need to count the "No" so could I shorten it thus?
=SUM(COUNTIF(U3,N3,X3,{"Yes",1})
I'm getting errors saying I'm entering too many arguments and it doesn't work. Help!
Hello!
Trying to find a solution for nested conditions with no success so far. Please see below:
Spreadsheet is looking to see if a range of cells (D:32:D35) is answered "Yes", If 1-2 cells in this range are answered "Yes", then cell L:31 will be assigned a value of .5. However if greater than 2 cells in the range answer "Yes". then L:31 will need to be 1.
Any tips? Thank you!
Hi!
If I got you right, the formula below will help you with your task:
=IF(COUNTIF(D2:D35,"Yes")<3,0.5,1)
You can learn more about COUNTIF function in Excel in this guide.
Since, after multiple attempts, I can't seem to get my formula to show correctly, can I email it? It shows fine, until I hit Send and then half of it is missing.
Thank you for your emailed response, which worked.
We apologize for this nasty behavior. Our blog engine often mangles formulas containing "less than" and "greater than" operators, and we can do nothing about it. You can email your formula to support@ablebits.com Att: Alexander Trifuntov
Again, our apologies for the inconvenience.
SUMPRODUCT(--(AND('Source Sheet'!$D:D>=A3,'Source Sheet'!$D:D0,1,0))
Aaarrrrgghhhh!!!!!
I don't understand why the formulae are being truncated.
Breaking it up, will see if that works
=SUMPRODUCT(--(AND('Source Sheet'!$D:D>=A3,'Source Sheet'!$D:D0,1,0))
I want to count, only once, those values that match ONE of a range of three criteria. Column A contains dates and multiple rows can have the same date. Columns B, C or D contain only "Y" or "N". I want to count, for each date, only those rows where a "Y" is in any one of B, C or D. If there is an N in all three, it is not counted. For example:
01/01/2021 Y N N
01/01/2021 N N Y
01/01/2021 N N N
01/01/2021 Y Y Y
02/01/2021 Y Y Y
The count against 01/01/2021 should return 3 above, because there is at least one Y in cols B, C or D on three of the four rows that match that date (where there is more than one, it should only be counted once).
No variation of SUMPRODUCT, COUNTIFS etc I have come up with gives me the right number. Can you help please?
Hello!
Please check the formula below, it should work for you:
=SUMPRODUCT(--($A$1:$A$10=A1),IF(($B$1:$B$10="Y")+($C$1:$C$10="Y")+($D$1:$D$10="Y")>0,1,0))
I hope this will help
It does for individual dates, thank you. I also have a monthly summary sheet. In this one, months (eg Jan-21, Feb 21 etc are in column A of the summary sheet, to be checked against individual dates on column D of the source worksheet and the data to be checked for a single Y are in columns E to G of the source worksheet. I have attempted to adapt the formula you gave but this returns a VALUE error. I am guessing it is a simple missed comma or bracket, or is it the AND throwing it out?
=SUMPRODUCT(--(AND('Source Sheet'!$D:D>=A3,'Source Sheet'!$D:D0,1,0))
This is attempting to count, for all dates between 1st and last date of the month in column A of the target sheet, where there is a Y on each row in any one of columns E to G in the source sheet,
For example, if A3 on the target sheet were Mar-21, it would retrieve all values where the date is greater than or equal to 1st March 2021 and less than or equal to 31st March 2021 and, for the rows between those dates in the source sheet, count how many of those rows have at least one Y between cells E and G and output that number to the cell containing the above formula in the target sheet. Note, I have ruled out using just month numbers as the source sheet contains more than one year of dates.
Some of the formula was missing in my last comment. Trying again
=SUMPRODUCT(--(AND('Source Sheet'!$D:D>=A3,'Source Sheet'!$D:D0,1,0))
I am creating an spreadsheet for our Oncology dept which has the following sheets say 3 March, 4 March, 5 March etc and then a summary page. Each days sheet contains the Patient ID as well as what type, namely chemo, New File, Others etc. In the summary page I need to show a summary count with each of the category (Chemo,New Fileetc.) under a day column like this
05 March 2021 06 March 2021 07 March 2021
Morning Session - New File 1 #VALUE!
Morning Session - Chemo 2
Morning Session - Old 1
Morning Session - Others 0
***** 4
The COUNTIFS formula works when I dont have to evaluate the date to the current date which I have given as a heading and then in a cell in the days (6th March sheet). That throws an error. This is the formula I have used
=COUNTIFS('6th March'!E5:E1335,"Chemo", ',Summary!C2,'6th March'!C2)
Where the second criteria is the date I am trying to collate.
Any help will be much appreciated.
Thank you in advance.
Hello!
Unfortunately, without seeing your data it is impossible to give you advice.
I'm sorry, it is not very clear what result you want to get. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.
We'll look into your task and try to help.
Hi,
I am currently working on a formula to track 3 different types of orders and their status. In the workbook I have the order type as well as the due date and completion date in separate columns. I also created 2 columns to calculate IF statements to determine if 1) the order is "overdue" (completion date>due date) and 2) if the completion date is "blank" to mark it as outstanding. Currently I have the formula set to count any of the specific order type that is marked as overdue or as outstanding (Formula:=COUNTIFS('Due Dates'!$A:$A, T18,'Due Dates'!I:I, "OVERDUE")+COUNTIFS('Due Dates'!$A:$A, T18,'Due Dates'!J:J, "OUTSTANDING"); however, I want to narrow it down further so that only pulls the overdue+outstanding count from a specific due date instead of from everything. What function should I use to go about this? Thank you!
Hello!
If I understand your problem correctly, one more condition needs to be added to each of the COUNTIFS formulas. Like that:
=COUNTIFS('Due Dates'!$A:$A, T18,'Due Dates'!I:I, "OVERDUE",'Due Dates'!B:B,">"&T19 )+COUNTIFS('Due Dates'!$A:$A, T18,'Due Dates'!J:J, "OUTSTANDING",'Due Dates'!B:B,">"&T19)
where T19 is the date to count.
Hope this is what you need.
Hi,
Help me with the count function for a number and a text on the same range. For example, I want to count cells based on attendance, if it is Y, it should be considered, if I update as 1 or 30, it should also be counted for all the data
Hi,
If I understand your task correctly, the following formula should work for you:
=SUM(COUNTIF(A1:A10,{1,30,"Y"}))
I hope this will help
Need help. I need to an item in a separate excel spreadsheet to be counted based on two conditions in a worksheet. I need it to count the item once if the Part No of the item (for example is 01667-1" and the order number column is populated with an all numerical number (for examples " 1234" or #1556"). The numerical number is unique except for the first number so I tried using a wild card. Oh and one more thing the numerical column (G:G) may have blanks. The count is populated into a different worksheet.
I wrote this one but its not working. My result says 0 when I know I currently have 18 items like this....
=COUNTIFS(' Fruit Config Flow'!$C:$C,"01667-1",' ACCG Config Flow'!$G:$G,"1*")
Please help!!!
Hello!
The COUNTIFS function uses only range references as criteria_range. Therefore, you cannot use COUNTIFS in your case.
Try this array formula:
=SUM(--(FREQUENCY(IF(C2:C10=$K$1,MATCH(REPLACE(G2:G10,1,1,""), REPLACE(G2:G10,1,1,""),0)),ROW(C2:C10)-ROW(C2)+1)>0))
This is an array formula and it needs to be entered via Ctrl + Shift + Enter, not just Enter.
$K$1 is "01667-1"
I hope I answered your question. If something is still unclear, please feel free to ask.
Hello, I am trying to write a function that will count employees with either blank termination dates or termination dates after 1/1/20. The other criteria is all of these employees have to be from NYC. The function I have is =SUM(COUNTIFS(Q:Q, {"", ">1/1/2020"}, G:G, "New York")). It only seems to be counting the blanks and not adding term dates post 1/1/20 to the total count. Any advice for resolving would be very appreciated!
Hello!
If I understand your task correctly, the following formula should work for you:
=COUNTIFS(Q:Q, "", G:G, "New York")+COUNTIFS(Q:Q,">1/1/20", G:G, "New York")
You can learn more about count cells with OR conditions in Excel in this article on our blog.
I want to count the number of cells that have a number in them, not if it is blank.
Hello!
Here is the article that may be helpful to you: COUNTIF in Excel - count if not blank.
I hope it’ll be helpful.
Hello! GREAT ARTICLE, but as a German Excel user there remains a crucial question:
After
"Count cells with 2 sets of OR conditions"
you say:
"Please note the semicolon in the second array constant"
Well, semicolon is the standard in Germany for the comma (as in probably all European countries). Can somebody tell me what would be the equivalent for that semicolon then in Germany? Thanks a lot in advance.
Thanks
David
by the way it is not comma
I just got it! I downloaded one of the files on this site where the formula I meant is included - and my German Excel converted it automatically to German enterings. It would be "\" in Europe :-)
Hello,
Could you help me with a formula -- I have a pack slip for warehousing and I'm trying to sum the total of packages that have either "1" OR "13" items (cell range D10:D20) AND are being shipped via any of the following carriers "GSO", "VINGO", or "UPS" which are listed in cell range C10:C20. I currently have the formula as =SUM(COUNTIFS(C10:C20, {"GSO", "UPS", "VINGO"}, D10:D20, {"=1"; "=13"})) but it'sa not returning the correct results. Help?
Thanks
Hello!
The formula below will do the trick for you:
=SUM(COUNTIFS(C10:C20,{"UPS","GSO"},D10:D20,{1,13}))
or
=SUM(COUNTIFS(C10:C20,{"UPS","GSO"},D10:D20,{"1","13"}))
if your numbers are written as text
I have the data I want to add together in column I. I only want to count the data in column I for specific criteria/names in column B.
I am struggling putting together the formula to achieve this sum for column I based on criteria in column B.
Hi I am trying to do the following COUNT formula:
If cells J20:J44 are greater than 0 but less than 50
Thank you in advance
Hello!
You have 2 conditions for counting. So use the COUNTIFS function
=COUNTIFS(J20:J44,">0", J20:J44,"<50")
Hope this is what you need.
Hello.
I couldn't get the neater "OR" countifs function to work (Formula 2: countifs with array constant). The longer formula 1 (Countif + Countif) does work, but isn't as tidy.
Here is your example:
=SUM(COUNTIFS(A2:A10, {"apples","bananas","lemons"}, C2:C10, "delivered"))
My version is attempting to count the number of people who took a certain course in 2019 OR 2020 (adding the number of delegates from 2019 and 2020 together for a specific course).
=sum(COUNTIFS('Form responses 1'!B:B,{"2020","2019"},'Form responses 1'!D:D,"Course X")) where column B is the year column, column D is course name (redacted for the purposes of this post)
However this formula will only return numbers from 2020. Swap the years around, it only returns numbers from 2019. I would like them added together.
Any ideas what I'm doing wrong?
Hello!
Unfortunately, without seeing your data it hard to give you advice.
I can assume that in your table ′Form responses 1′!B:B,the year is written not as text, but as a number.
Therefore, do not use quotation marks - {2020,2019}.
I recommend using the SUMPRODUCT function for counting. Read more here
I hope it’ll be helpful.
Hello. Can you please help me figure out how to count how many times a value occurs between two date columns?
I'm trying to count how many, let say "installs," occur per week with the start at end date columns.
There is more than one row with start dates and end dates that overlap and I'm trying to break it down by how many are overlapping in each week.
Column B & C are the start and end of the install. E and F are just part of my model.
For example, someone may have 44 installs per year, but how many are occurring each week at the same time.
I'm trying to show how many installs occur/overlap to the right of columns E and F via column G.
Link to the spreadsheet: https://docs.google.com/spreadsheets/d/1krnLiVUTfXWIWh0PTVXqK9Zpy5lNegYHoUWGMTruI88/edit#gid=997917131
Here are some formulas I have tried:
1. =SUMIFS($H$3:$H$44,$G$3:$G$44, >=K3&)+SUMIFS($H$3:$H$44,$G$3:$G$44, "&K2,$A$2:$A$217,$H$2:$H$217,"=K3"},0))*ISNUMBER(MATCH($H$3:$H$44, {"<=L3"},0))*ISNUMBER(MATCH($A$3:$A$44,{"Deb Condon"},0)))
Hi there. I am struggling to write a formula to count all data that meets the following criteria: Male (column IN, data criteria is "1"), and age 25-64 (column IO, data criteria is "2, 3, 4, 5, 6, 7, 8, or 9"), and college educated (column IS, data criteria is "5 or 6"), and employed full-time (column IT, data criteria is "1"), and HHI of $50-75k (column IV, data criteria is "5"), and white (column IX, data criteria is "3"), and in the south (column JI, data criteria is "2"), and in data wave 1 (column B, data criteria is "1).
Separately, next I'll need to add another criteria layer to the above... Answered Q1 as "Not very concerned" (column C, data criteria is "3"). But I'll need this count value turned into a % of the total count (above).
Can you please help?
Hello Alexis!
I hope you have studied the recommendations in the above tutorial. Read "COUNTIF-multiple-criteria-AND-logic". Please let me know in more detail what you were trying to find, what formula you used and what problem or error occurred. In that case I will try to help you.
Hi Alexander. Yes I have studied the above.
I first need to count the # of people who fit this criteria: In data wave 1 (column B, data criteria is "1"), and Male (column IN, data criteria is "1"), and age 25-64 (column IO, data criteria is "2, 3, 4, 5, 6, 7, 8, OR 9"), and college educated (column IS, data criteria is "5 OR 6"), and employed full-time (column IT, data criteria is "1"), and HHI of $50-75k (column IV, data criteria is "5"), and white (column IX, data criteria is "3"), and in the south (column JI, data criteria is "2").
This returns #VALUE! error: =SUM(COUNTIFS(CSVData4241!B:B,1,CSVData4241!IN:IN,1,CSVData4241!IO:IO,{">=2";
=5";"=2","=5","<=6"},CSVData4241!IT:IT,1,CSVData4241!IV:IV,5,CSVData4241!IX:IX,3,CSVData4241!JI:IJI,2))
Hello Alexis!
If I got you right, the formula below will help you with your task:
=SUM(COUNTIFS(B2:B8,1,IN2:IN8,1,IO2:IO8,{2,3,4,5,6,7,8,9}, IS2:IS8,{5,6},IT2:IT8,1, HHI2:HHI8,5,IX2:IX8,3,JI2:JI8,2))
Change the cell addresses to suit your task. I hope you understand that you can use an array of values for several conditions.
Looks like my example formulas got cut off. Please see below:
This returns #VALUE! error: =SUM(COUNTIFS(CSVData4241!B:B,1,CSVData4241!IN:IN,1,CSVData4241!IO:IO,{">=2";
=5";"=2","=5","<=6"},CSVData4241!IT:IT,1,CSVData4241!IV:IV,5,CSVData4241!IX:IX,3,CSVData4241!JI:IJI,2))
Hi,
Can you help me with one formula? I've been struggling for a while to get it right.
I am trying to capture (COUNTIFS) a certain employee has either not delivered a report in time (past its due date) or if he has delivered it, but past its due date. In my current raw data i have the Employee Name, Due date, the Delivery date (which can be blank while its not yet delivered, or filled if delivered) the name of the employee & the status of a report (its "draft" if its still not delivered; its "Final" or "Provisional" if it has been delivered).
I'd highly appreciate if you could help me out. It's been bugging me for some time!
Thanks in advance!
Hello Aline!
If you want to have the report delivery status for each employee (in Column H, for example), please use this formula:
=IF(C2<>"",IF(B2>C2,"OK","Past due date"), "Not delivered")
There is a due date in Column B and a delivery date (or nothing) in Column C here.
If it is necessary to count how many reports are overdue or not submitted, please use this formula:
=SUM((C2:C10>B2:B10)+(C2:C10=""))
If you still have questions, please ask.
Greetings,
I have a spreadsheet that has pressure in one column from row 4 to row 54435. I have multiple pumps (the pumps have either a 0 for off or a 1 for running in each row) Each pump being in a separate column with rows 4 through row 54435. What I need to do is count a specific pressure rating range (PSI between equal to or greater than 85psi but less than 86psi). But the catch is that I want to count the pressure only once with any of the pumps running. So for example if I have pump 5 running OR pump 6 or any of the other pumps are running AND the pressure is between 85 and 86psi, I want to count it once. I would like to do this for multiple pressure settings. I have used Countif(PSIRange,">"&"="85, PSIRANGE,"<"&86,PUMP1Range,"="&1,...PumpNRange,"="&1) but this only counts if ALL the Pumps are running, not if any of the pumps are running.
Hello Ray!
If I understand your task correctly, maybe the following formula should work for you:
=SUMPRODUCT(-- (PSIRANGE>=85), -- (PSIRANGE<=86), (-- (PUMP1Range=1))+ (-- (PUMP2Range=1))+ (-- (PUMP3Range=1)))
If there is anything else I can help you with, please let me know.
Thank You
Hi, I am wondering if someone can help me figure our how to combine COUNTIFS formulas. For example, I need to present this more efficiently:
=COUNTIFS(VAR1,”Yes”,VAR2,"2016",VAR3,"Q1",VAR4,PH,VAR5,"Pres") +
COUNTIFS(VAR1,”Yes”,VAR2,"2016",VAR3,"Q1",VAR4,"Both", VAR5,"Pres") +
COUNTIFS(VAR1,”Yes”,VAR2,"2016",VAR3,"Q1", VAR6,PH, VAR5,"Pres") +
COUNTIFS(VAR1,”Yes”,VAR2,"2016",VAR3,"Q1", VAR6,"Both", VAR5,"Pres")
So I need counts if VAR1 =Yes; VAR2 = 2016; VAR3=Q1; VAR5=Pres; AND VAR4= PH or Both; AND VAR6=PH or Both. I think the way I have it does the job, but I'm sure there is a more concise way to write the formula as it may get very long as I add criteria to it.
Hello E Safi!
If I understand your task correctly, the following formula should work for you:
=SUMPRODUCT(--(A1:A4="Yes"),--(B1:B4=2016), --(C1:C4="Q1"), ((D1:D4="PH")+(D1:D4="Both")),--(E1:E4="Pres"), ((F1:F4="PH")+(F1:F4="Both")))
I hope this will help, otherwise please do not hesitate to contact me anytime.
I am having the same problem like "E Safi" but rather than using direct literal text. I need to use wild card as it is group in a single cell. below is a working formula but the problem is it counts the cell twice if it contains both the word "PH" and "Both". is there anyways that it will be only counted once?
=SUMPRODUCT(--(A1:A4="Yes"),--(B1:B4=2016),--(C1:C4="Q1"),((D1:D4="PH")+(D1:D4="Both")),--(E1:E4="Pres"),(ISNUMBER(SEARCH("*PH*",F1:F4)+ISNUMBER(SEARCH("*Both*",F1:F4)))))
Hello Russel!
If I understand your task correctly, the following formula should work for you:
=SUMPRODUCT(--(A1:A4="Yes"),--(B1:B4=2016), --(C1:C4="Q1"),((D1:D4="PH")+(D1:D4="Both")), --(E1:E4="Pres"), (ISNUMBER(SEARCH("*PH*",F1:F4))+ISNUMBER(SEARCH("*Both*",F1:F4))))
I hope it’ll be helpful.
I have rows of numbers (thousands of them) and dozens of columns with numbers in them. Some of the numbers are formatted as dates, some are formatted as time and some are formatted as Number/Fixed/2. All the numbers in the columns are the same format. The database is large and has a lot of blank cells because there is no data available.
I would like a COUNTIF formula which would tell me how many (for example) non-blank cells in the row are formatted for Number/Fixed/2.
Can you help?
Thanks
I'm trying to count "Agree" and "Strongly Agree" in columns h:k, but only if column D="Tony"
I already tried this formula =SUM(COUNTIFS(PreWorksheet!H:K, {"Agree","Strongly Agree"}, PreWorksheet!D:D, "Tony")) and it's not working. I keep getting the #VALUE error.
Any help is appreciated.
TIA
Hello,
Can you help me with formula?
Assuming the range A1:A20, I need to count the number of cells that:
1- Not Blank
2- Does not equal "Red" or "Blue" or "Green"
3- Does not contain Numbers
No matter what I try, I still get the wrong count.
Can anyone help me please?
Thanks!
Hello, thank you for your detailed explanations of the functions. I am currently trying to count using count if plus OR and none of the above mentioned seemed to be working. Im trying to count if column A has Yes and if either column B or C are blank, unfortunately right now it does a double count if both B and C are blank. I would be grateful for your help. Unfortunately there is no minimum value and it has to be blank
Hello, i am working with work orders. Specifically the comments technicians write about the work orders and i am counting specific words used like "hot", "cold", "temperature", etc.
example:
STORE COMMENT
1 Unit is too hot
2 Unit moves from cold to hot
3 Temperature not holding
4 Temperature is too cold
5 Unit is too cold
I am using "* *" in my countif to search within text, like "*hot*" would come back as "2". my question is, how can i do a countif, countifs, or sum to count "*cold*" + "*hot*" + "*temperature*" without double counting comments that contain two of those key words. For example, with the above data, i want the count to be "5" but if i follow the above instructions it would count store 2 and store 4 twice, giving me a total of "7". any thoughts?
Good morning,
I was hoping you could help me with a table i'm trying to create. I want to "reverse" the countifs formula i've got to get the results it has counted (as if it was a pivot table).
My formula looks like this: =SUM(COUNTIFS('worksheet1'!$B:$B,"Criteria1",'worksheet2'!$W:$W, {"criteria2","criteria3"}))
As you'll see this is multiple criteria (criteria1 AND (criteria 2 OR 3)).
What I then need to do is something like a complex vlookup to find the rows that the formula has counted and then pick specific cells to return.
Imagine my table having 25 columns. My criteria are in columns 2 (B) and 23 (W) and I want a formula that will help me return values from column 1 (A) for any row counted with the countif formula mentioned earlier.
Hope that makes sense.