The tutorial explains how to use COUNTIFS and COUNTIF formulas with multiple criteria in Excel based on AND as well as OR logic. You will find a number of examples for different data types - numbers, dates, text, wildcard characters, non-blank cells and more.
Of all Excel functions, COUNTIFS and COUNTIF are probably most often mixed up because they look very much alike and both are purposed for counting cells based on the specified criteria.
The difference is that COUNTIF is designed for counting cells with a single condition in one range, whereas COUNTIFS can evaluate different criteria in the same or in different ranges. The aim of this tutorial is to demonstrate different approaches and help you choose the most efficient formula for each particular task.
Excel COUNTIFS function - syntax and usage
The Excel COUNTIFS function counts cells across multiple ranges based on one or several conditions. The function is available in Excel 365, 2021, 2019, 2016, 2013, Excel 2010, and Excel 2007, so you can use the below examples in any Excel version.
COUNTIFS syntax
The syntax of the COUNTIFS function is as follows:
- criteria_range1 (required) - defines the first range to which the first condition (criteria1) shall be applied.
- criteria1 (required) - sets the condition in the form of a number, cell reference, text string, expression or another Excel function. The criteria defines which cells shall be counted and can be expressed as 10, "<=32", A6, "sweets".
- [criteria_range2, criteria2]… (optional) - these are additional ranges and their associated criteria. You can specify up to 127 range/criteria pairs in your formulas.
In fact, you don't have to remember the syntax of the COUNTIF function by heart. Microsoft Excel will display the function's arguments as soon as you start typing; the argument you are entering at the moment is highlighted in bold.
Excel COUNTIFS - things to remember!
- You can use the COUNTIFS function in Excel to count cells in a single range with a single condition as well as in multiple ranges with multiple conditions. If the latter, only those cells that meet all of the specified conditions are counted.
- Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument).
- Both contiguous and non-contiguous ranges are allowed.
- If the criteria is a reference to an empty cell, the COUNTIFS function treats it as a zero value (0).
- You can use the wildcard characters in criteria - asterisk (*) and question mark (?). See this example for full details.
How to use COUNTIFS and COUNTIF with multiple criteria in Excel
Below you will find a number of formula examples that demonstrate how to use the COUNTIFS and COUNTIF functions in Excel to evaluate multiple conditions.
How to count cells with multiple criteria (AND logic)
This scenario is the easiest one, since the COUNTIFS function in Excel is designed to count only those cells for which all of the specified conditions are TRUE. We call it the AND logic, because Excel's AND function works this way.
Formula 1. COUNTIFS formula with multiple criteria
Suppose you have a product list like shown in the screenshot below. You want to get a count of items that are in stock (value in column B is greater than 0) but have not been sold yet (value is column C is equal to 0).
The task can be accomplished by using this formula:
=COUNTIFS(B2:B7,">0", C2:C7,"=0")
And the count is 2 ("Cherries" and "Lemons"):
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.
Using a simpler formula with a single criteria_range like COUNTIFS(B2:C7,"=0") would yield a different result - the total count of cells in the range B2:C7 containing a zero (which is 4 in this example).
How to count cells with multiple criteria (OR logic)
As you have seen in the above examples, counting cells that meet all of the specified criteria is easy because the COUNTIFS function is designed to work this way.
But what if you want to count cells for which at least one of the specified conditions is TRUE, i.e. based on the OR logic? Overall, there are two ways to do this - by adding up several COUNTIF formulas or using a SUM COUNTIFS formula with an array constant.
Formula 1. Add up two or more COUNTIF or COUNITFS formulas
In the table below, supposing you want to count orders with the "Cancelled" and "Pending" status. To have it doen, you can simply write 2 regular Countif formulas and add up the results:
=COUNTIF($C$2:$C$11,"Cancelled") + COUNTIF($C$2:$C$11,"Pending")
In case each of the functions is supposed to evaluate more than one condition, use COUNTIFS instead of COUNTIF. For example, to get the count of "Cancelled" and "Pending" orders for "Apples" use this formula:
=COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Cancelled") + COUNTIFS($A$2:$A$11, "Apples", $C$2:$C$11,"Pending")
Formula 2. SUM COUNTIFS with an array constant
In situations when you have to evaluate a lot of criteria, the above approach is not the best way to go because your formula would grow too big in size. To perform the same calculations in a more compact formula, list all of your criteria in an array constant, and supply that array to the criteria argument of the COUNTIFS function. To get the total count, embed COUNTIFS inside the SUM function, like this:
In our sample table, to count orders with the status "Cancelled" or "Pending" or "In transit", the formula would go as follows:
=SUM(COUNTIFS($C$2:$C$11, {"cancelled", "pending", "in transit"}))
In a similar manner, you can count cells based on two or more criteria_range / criteria pairs. For instance, to get the number of "Apples" orders that are "Cancelled" or "Pending" or "In transit", use this formula:
=SUM(COUNTIFS($A$2:$A$11,"apples",$C$2:$C$11,{"cancelled","pending","in transit"}))
You can find a few more ways to count cells with OR logic in this tutorial: Excel COUNTIF and COUNTIFS with OR conditions.
How to count numbers between 2 specified numbers
By and large, COUNTIFS formulas for numbers fall into 2 categories - based on several conditions (explained in the above examples) and between the two values you specify. The latter can be accomplished in two ways - by using the COUNTIFS function or by subtracting one COUNTIF from another.
Formula 1. COUNTIFS to count cells between two numbers
To find out how many numbers between 5 and 10 (not including 5 and 10) are contained in cells C2 through C10, use this formula:
=COUNTIFS(C2:C10,">5", C2:C10,"<10")
To include 5 and 10 in the count, use the "greater than or equal to" and "less than or equal to" operators:
=COUNTIFS(B2:B10,">=5", B2:B10,"<=10")
Formula 2. COUNTIF formulas to count numbers between X and Y
The same result can be achieved by subtracting one Countif formula from another. The first one counts how many numbers are greater than the lower bound value (5 in this example). The second formula returns the count of numbers that are greater than the upper bound value (10 in this case). The difference between the first and second number is the result you are looking for.
- =COUNTIF(C2:C10,">5")-COUNTIF(C2:C10,">=10") - counts how many numbers greater than 5 and less than 10 are in the range C2:C10. This formula will return the same count as shown in the screenshot above.
- =COUNTIF(C2:C10, ">=5")-COUNTIF(C2:C10, ">10") - the formula counts how many numbers between 5 and 10 are in the range C2:C10, including 5 and 10.
How to use cell references in COUNTIFS formulas
When using logical operators such as ">", "<", "<=" or ">=" together with cell references in your Excel COUNTIFS formulas, remember to enclose the operator in "double quotes" and
add an ampersand (&) before a cell reference to construct a text string.
In a sample dataset below, let's count "Apples" orders with amount greater than $200. With criteria_range1 in cells A2:A11 and criteria_range2 in B2:B11, you can use this formula:
=COUNTIFS($A$2:$A$11, "Apples", $B$2:$B$11, ">200")
Or, you can input your criteria values in certain cells, say F1 and F2, and reference those cells in your formula:
=COUNTIFS($A$2:$A$11, $F$1, $B$2:$B$11, ">"&$F$2)
Please notice the use of absolute cell references both in the criteria and criteria_range arguments, which prevents the formula from being broken when copied to other cells.
For more information about the use of an ampersand in COUNTIF and COUNTIFS formulas, please see Excel COUNTIF - frequently asked questions.
How to use COUNTIFS with wildcard characters
In Excel COUNTIFS formulas, you can use the following wildcard characters:
- Question mark (?) - matches any single character, use it to count cells starting and/or ending with certain characters.
- Asterisk (*) - matches any sequence of characters, you use it to count cells containing a specified word or a character(s) as part of the cell's contents.
Tip. If you want to count cells with an actual question mark or asterisk, type a tilde (~) before an asterisk or question mark.
Now let's see how you can use a wildcard char in real-life COUNTIFS formulas in Excel. Suppose, you have a list of projects in column A. You wish to know how many projects are already assigned to someone, i.e. have any name in column B. And because we are learning how to use the COUNTIFS function with multiple criteria, let's add a second condition - the End Date in column D should also be set.
Here is the formula that works a treat:
=COUNTIFS(B2:B10,"*",D2:D10,"<>"&""))
Please note, you cannot use a wildcard character in the 2nd criteria because you have dates rather that text values in column D. That is why, you use the criteria that finds non-blank cells: "<>"&""
COUNTIFS and COUNTIF with multiple criteria for dates
The COUNTIFS and COUNTIF formulas you use for dates are very much similar to the above formulas for numbers.
Example 1. Count dates in a specific date range
To count the dates that fall in a certain date range, you can also use either a COUNTIFS formula with two criteria or a combination of two COUNTIF functions.
For example, the following formulas count the number of dates in cells C2 through C10 that fall between 1-Jun-2014 and 7-Jun-2014, inclusive:
=COUNTIFS(C2:C9, ">=6/1/2014", C2:C9, "<=6/7/2014")
=COUNTIF(C2:C9, ">=6/1/2014") - COUNTIF(C2:C9, ">6/7/2014")
Example 2. Count dates with multiple conditions
In the same manner, you can use a COUNTIFS formula to count the number of dates in different columns that meet 2 or more conditions. For instance, the below formula will find out how many products were purchased after the 20th of May and delivered after the 1st of June:
=COUNTIFS(C2:C9, ">5/1/2014", D2:D9, ">6/7/2014")
Example 3. Count dates with multiple conditions based on the current date
You can use Excel's TODAY() function in combination with COUNTIF to count dates based on the current date.
For example, the following COUNTIF formula with two ranges and two criteria will tell you how many products have already been purchased but not delivered yet.
=COUNTIFS(C2:C9, "<"&TODAY(), D2:D9, ">"&TODAY())
This formula allows for many possible variations. For instance, you can tweak it to count how many products were purchased more than a week ago and are not delivered yet:
=COUNTIFS(C2:C9, "<="&TODAY()-7, D2:D9, ">"&TODAY())
This is how you count cells with multiple criteria in Excel. I hope you will find these examples helpful. Anyway, I thank you for reading and hope to see you on our blog next week!
2039 comments
Hiya
I have a workbook with mulitple sheets and an overview sheet.
The overview has validation list for different months whicg relates to each of the muliple sheets.
I need a count if where by the sheet name in the range will change depending on the month selected in the validation
i.e If 'May-14' in cell 'Overview!'C2 - Countif('May-14'!R:R,Criteria)
If then in overview cell2 it is changed to Jun-14 the Countif will change to Countif('Jun-14'!R:R,Criteria).
Please help?!
Hi Svetlana,
I was trying to follow your tutorial and adapt it to my data, but it didn't seem to work. Would you mind helping me troubleshoot please? :)
I was trying to create a COUNTIF for instances when there's text in column A AND text in column C OR column D.
Thanks in advance!
Tim,
See if this works:
=COUNTIFS(A:A,""&"",C:C,""&"")+=COUNTIFS(A:A,""&"",D:D,""&"")
Hi Svetlana,
How can I count two different texts in one column?
So my usual formula is: =COUNTIFS(C:C,"Passed",D:D,"Quebec")
And its giving my correct figures.
But if in the column C, i also want to count any other status that says Remediation Passed, how should I say that? No change in column D. I tried something like, COUNTIFS(C:C,"Passed" OR "Remediation Passed",D:D,"Quebec"), but that didn't work.
Grateful for your insights.
Cheers
=COUNTIFS(C:C,"Passed",D:D,"Quebec")+COUNTIF(C:C,"Remediation Passed)
This is useful for differing values.
or
=COUNTIFS(C:C,"*Passed",D:D,"Quebec")
This is more efficient and works to find anything containing the word "Passed" as in your example.
Can I use countifs with more to count more than three ranges and criteria?
Hi Angela,
Of course, you can. You can actually use up to 127 dirrerent ranges / criteria in one COUNTIFS formula: )
Hi Svetlana,
Could you be kind enough to help me out on this excel problem I am trying to refer to a particular cell for formatting but there is a conflict. I will appreciate your prompt response.
I have sent the file to your mail.
Thanks
Hi!
In your case, it probably makes sense to look up by 2 columns C and D using an array INDEX / MATCH formula. I've sent you an email with a formula example, hopefully that is the result you are trying to achieve.
Hi, I have a range of cells I want to count for a skills matrix for my staff. The ranges of what I want counted are drop down menus in each of the cells with "Sound", "Advanced", "Expert" etc, and these I wanted counted in the number of times that the cells have one of those words in them. The other cells contain "UnAware" and "Basic" which I dont want counted in the original total, but put in a total for all the types of details entered, this way I will get a % of staff with the desired level of training/competence in the processes they use every day.
I tried COUNTIFS but I kept getting a zero count even though I used the formula correctly (no error message). Could you please help me work this out?
Hi Brandon,
I am sorry it's difficult for me to say why this happens without seeing your data. Please send your sample workbook at support@ablebits.com and we'll try to help.
YES!! This is exactly what I am trying to do, too - and I am getting the same non-error of a zero result. What is the proper way to formulate this?
Dear Svetlana,
Thanks for that. I've sorted it out. Someone had been clearing cells by pressing the space bar and obviously a space is still a character so this was distorting any new entries such as formulas. I've made a note of your resolutions above for future reference. Excellent stuff!
Your help is much appreciated (and is worth a vodka or two!!).
Cheers,
vcoolio.
Thanks Vcoolio, I prefer Baileys : )
Hello Svetlana,
I noticed that in your tutorial that COUNTIF formulas are used outside the columns/cells that need to be totalled.
I have a work sheet with a number of columns, one of which is Sales/Purchases. The data in the work sheet is extensive and the columns are very long so I like to keep track of the number of Sales and Purchases for a month by using =COUNTIF(range,"SALE")and the same for Purchases. If I place the formulas in a cell at the top or bottom of this column everything works fine. However, should I place the formulas outside this column all I get is a date (such as January 1900). Am I doing something wrong or is the formula restricted to its specific column?
Thank you in advance for any help.
Cheers,
vcoolio.
Hello Vcoolio,
You can put your formulas in any cells. For the formulas to work correctly, try the following:
1 Apply the General format to the cell with the formula (press Ctrl + 1 and select General in the Format Cells dialog window).
2 If you used relative cell references in the range argument, the references got distorted when you copied the formula. Try using the absolute cell references instead (e.g. $B:$B for column B).
If the above suggestions do not work, please send me a sample workbook at support@ablebits.com and we will try to figure out the source of the problem.
I need a help to do below thing. Suppose I have column A which contains values either of A,B or C as Follows.
Column A
A
A
B
A
B
B
C
A
Now what I have to do is, I want to count pair of AA, AB, AC likewise, based on the two consecutive values, if First row contains A and 2nd row contains A, then AA count should be 1 likewise go on.
What I tired is I can get count for two cells only using following formula =COUNTIFS(A1, "=A",A2,"=B")
But I don't how to go on increasing the rows.
Please help
I am trying to add a value for a Alpha value in a cell. The Cell can have an M=5, a C=3 or a Z=1 so in the same cell I want to show a value of the corresponding letter, with a default of "0" if they do not choose either letter.
Also I am adding another value in a subsequent cell for "C" a value of 1,2,3 will be used as as a negative of 1=-0.5, 2=-1 and 3=-1.5, same values only apply to a Z 4=-.5, 5=-1, and 6=-1.5.
Thanks for your help in advance...
Hi Brad,
Sorry, I'm not sure I can follow you. If you can send me your sample workbook at support@ablebits.com, I will try to help.
Dear Svetlana Cheusheva,
I appreciate your help tremendously!
can you inform that,
A
B
C
A
D
H
A
J
K
L
A
U
above there if i use the formula =COUNTIF($F$8:$F$30,"A") than result is 3
but i wants to know that, How Would I Count Only The Same Name Once/ Count Repeated Items Once.
Please help me urgently.
Thanking you,
Imam Azad
Macro Cable Ltd
Dhaka, Bangladesh
Hello Imam,
If you want to get the list of unique values, you can copy your list to a new sheet and click on the Remove Duplicates icon under the DATA tab.
If you want to get something different, please describe your task in more details.
Dear Svetlana Cheusheva,
Please solve my example: Mr. Karim is market visited statement as below-
Date Code Name Type of Customers
10 October 2014 100 ABC Traders Traders
11 October 2014 101 MNZ Traders Traders
12 October 2014 201 AKA Builders Developers
13 October 2014 300 PWD Consultant
14 October 2014 100 ABC Traders Traders
15 October 2014 300 PWD Consultant
16 October 2014 201 AKA Builders Developers
16 October 2014 103 ABD Traders Traders
17 October 2014 100 ABC Traders Traders
17 October 2014 101 MNZ Traders Traders
19 October 2014 104 PQS Traders Traders
20 October 2014 100 ABC Traders Traders
Now I want to report/result:
1. How many times visited there? Ans: 12 times. it's i can do.
2. How many customers are in visited there?
Please forward formula how to solve.
Thanking you,
Imam Azad
Macro Cable Ltd
Dhaka, Bangladesh
Dear Svetlana Cheusheva,
Please help any update.
Thanking you
Imam
Dhaka
ANY UPDATE
Please be Reply
IMAM
Sex Age
F 14
F 19
F 15
F 14
F 16
F 21
F 24
how can i count with these limitations? what formula/syntax will i use?
i need to count all F with age less than 15, F equal to 15 but not more than 19 and all the F equal 20 but not more than 24
I want to tabulate it in this format.
F less than 15
F equal 15 pero not more than 19
F equal 20 but not more than 24
thanks for helping me on this one
Hi Gio,
Try these formulas:
F is less than 15:
=COUNTIFS($A$2:$A$8,"F",$B$2:$B$8,"<15")
F equal 15 pero not more than 19:
=COUNTIFS($A$2:$A$8,"F",$B$2:$B$8,">=15",$B$2:$B$8,"<19")
F equal 20 but not more than 24:
=COUNTIFS($A$2:$A$8,"F",$B$2:$B$8,">=20",$B$2:$B$8,"<24")
Hi Svetlana Cheusheva , Your solution is helping me , Thanks
Hi Svetlana I sent you an email for your assistance could you be so kind to help me? thanks Jason
Hi Jason,
Have just emailed you the formula, hopefully this is the result you are looking for.
Column B & C data not pasted very well. Just put every second time in column c.
Hello Kees,
I believe the following formula will work a treat:
=COUNTIFS(A2:A10,"<6",B2:B10,">="&TIME(5,0,0),B2:B10,"<="&TIME(7,0,0))+COUNTIFS(A2:A10,"<6",C2:C10,">="&TIME(5,0,0),C2:C10,"<="&TIME(7,0,0))
In your case, the result will be 4.
Help please.
3 columns. Column A is a number (Day), Column B & C are time.
Count rows where day number is less than 6 and times in either B or C are between 5:00 & 7:00
-----------
A B C
D T0001 T0002
1 6:14
1 6:57
1 6:58
1 20:50
1 23:05
2 17:47
2 17:59
3 6:01
3 17:46
5 18:20
6 7:06
6 11:50
6 13:29
6 13:53
6 14:57
6 17:36
7 10:26
7 10:32
Column G is "Barcodes". Column J is "Carriers". How can it get the Excel to display "Flexsteel Truck or FedEx or UPS" in column J:J whenever a BX number (for example..BX09225)is enter in G:G?
Thanks in advance,
Glenn
Hi Glenn,
If you want to use only formulas, then enter this one in cell J2:
=IF(And(G2<>"", len(G2)>2,left(G2,2)="BX"),"Flexsteel Truck or FedEx or UPS", "")
Then copy the formula across other cells in column J.
If you want to insert some values in column J, but have these values replaced with "Flexsteel Truck or FedEx or UPS", or something like that, as soon as the code appears in column G, you need a special VBA macro to fulfill this.
Hi,
I have a query countiff not working. I have a project allocation sheet where column A is resources and B, C, D, E ....are daily dates. I have to allocate project to a resource in column A in other columns by selecting a drop down I have created in Column B onwards. Now I want a summary that how many resources are in a project end of month.
Suppose 5 resources were allocated Bug fixing project through out the month the formula would now count resources for me it counts the allocations i.e. number of times I allocated bug fixing to resources
Please help
Hi,
how can i automatically count or computed in Monday to Sunday data base count as week summary
Hi Rodz,
Sorry, I cannot follow you. Could you elaborate on the task a bit more, please?
Trying to find a formula that will average only if EACH cell has a value greater than 0 in it; or if the last 3 consecutive months have a value greater than 0. Any help is greatly appreciated.
I believe, you can use a formula similar to this:
=IF(AND(E2>0,F2>0,G2>0),AVERAGE(A2:E2),"-") where E, F and G are the last 3 months' values. You can add more > operators to the nested AND function if you want to check more than 3 months.
oops, it's not pasting like i want it to. basically, each day is a column, each time is a row. sorry for the confusion.
Hi Emily,
Can you please send me your sample workbook at support@ablebits.com and an example of the result you want to get? I believe in this way it will be easier for us to suggest a formula that returns exactly the result you are looking for.
Hi Svetlana,
I just sent the sample workbook. Please let me know if you received it.
Thank you!!
Emily
Hi Emily,
Yes, our support team passed me the workbook this morning and I emailed you the result a few minutes ago. Hopefully, the formulas work as you expected :)
Hi Svetlana,
I think I have similar problem.
Would you please publish the solution for use the time as the cretria, something like
"> 12:00 PM" and "<1:00 PM"
Regards
Hi Hassan,
A formula can be similar to this:
=COUNTIFS(A1:A21, ">"&TIMEVALUE("12:00 PM"), A1:A21, "<="&TIMEVALUE("1:00 PM"))
what is deference between countif and countifs
COUNTIF is intended for counting cells based on a single condition, while COUNTIFS allows specifying several criteria in several different ranges.
Hi Svetlana ,
I 've send sample data Plz help me for get formula
Ma'am,
I want to how many HBL availbale in sheet against city
Exmp
CITY COUMN A COLUMN B
ALIGARH HBL HBL
ALIGARH HBL HBL.
ALIGARH HBL HBL
ETAH HBL HBL
ALIGARH HBL HBL
ALIGARH HBL HBL
Ma'am,
I want to how many HBL availbale in sheet against city
Exmp
CITY COUMN A COLUMN B
ALIGARH HBL HBL
ALIGARH HBL HBL.
ALIGARH HBL HBL
ETAH HBL HBL
ETAH HBL HBL
ETAH HBL HBL
formate
cluster name HBL QTY REQUIRED
ALIGARH
ETAH
Hello,
I have a list of classes with the day and start & end times in one spreadsheet.
The format looks like this:
M 8:00 AM - 9:50 AM
T 12:30 PM - 2:20 PM
M 9:00 AM - 10:15 AM
F 7:00 AM - 1:00 PM
In another spreadsheet i have a table like this one below. I want to know how many classes occur on Mondays between 6:00 am and 6:29 am,6:30 am - 6:59 am,7:00 am - 7:29 am, etc.
M T W R F
6:00 AM
6:30 AM
7:00 AM
7:30 AM
8:00 AM
8:30 AM
9:00 AM
9:30 AM
10:00 AM
10:30 AM
11:00 AM
11:30 AM
12:00 PM
12:30 PM
1:00 PM
1:30 PM
2:00 PM
2:30 PM
3:00 PM
3:30 PM
4:00 PM
4:30 PM
5:00 PM
5:30 PM
6:00 PM
6:30 PM
7:00 PM
7:30 PM
8:00 PM
8:30 PM
9:00 PM
9:30 PM
10:00 PM
10:30 PM
11:00 PM
11:30 PM
12:00 AM
I appreciate your help tremendously!
Thank you!
Thank you. I just spoke to a colleague who walked me though a pivot table of my data. Thanks again.
Can COUNTIFS can be used to find the number of matches within the same range?
I have a range of 500 postal codes in one column. These are formatted in two groups of three characters each (i.e. A9A 9A9). The first group of characters will change slightly to represent a different region - A9B, A9C, A9D, etc. I would like to get a count of each regional group.
I could do this over and over again (as I've already done) as follows:
=COUNTIF(M1:M500, "A9A*")
This proved to be very repetitive to copy, paste and modify this 25 times for each of the regional postal code categories I'm working with. Can COUNTIFS do this at one time?
Hello Michael,
Regrettably, COUNTIFS cannot help in your case because it counts cells that meet ALL of the criteria you specify in the formula. You can achieve the desired result in this way:
Create an additional column and copy the following formula there =LEFT(A2,3) where A is your postal codes column. This formula will extrat the first 3 characters of the codes.
Then you can proceed in 2 ways.
Way 1:
- Sort your table by the postal code column or the newly created column with the above formula.
- Apply subtotal to the table (Data >Outline >Subtotal) with these settings:
At each change in : Column with the formula
Use function: Count
Add subtotal to: Column with the formula
- Click Ok.
- Then Press Number 2 at the left side of you sheet and you will get the count of codes by region.
For more info about using subtotals please see this article -
Way 2:
- Insert a pivot table (select your table and go to Insert > Tables > PivotTable).
- Place your pivot table onto a new sheet.
- Drag and drop the column with the formula to the Rows section and the original column with the postal codes to the Values section.
You will get the same count of codes by region.
if column A contains numeric value like = 1 2 3 4 5 6 7 8 9 10 etc...
and column B contains three status like = Ontime, Late & Not Done
then I want count-if of column A's numeric value 3 and 4 and column B contains status of Not Done
kindly help me.
=countifs(A:A,">=3",A:A,"<=4","B:B,"Not Done"
Few typos above.
=countifs(A:A,">=3",A:A,"<=4",B:B,"Not Done")
You could also do:
=countifs(A:A, {"3", "4"), B:B, "Not Done")
Ignore. minor error.
sainu says:
September 26, 2017 at 7:22 am
Hi Svetlana,
Could you please help to derive a formula for countif with 2 criteria
Scenario:-
cell range name is Date, i need a particular date plus
another cell range is Method, under method there are 3 options say (SIF Entry, Excel Upload & Bulk), i need count if both criteria meets, my table for the function look like,
SIF Entry Excel Upload Bulk
03 sep 2017 Formula comes here Formula comes here Formula comes here
04 sep 2017
THANKS VERY MUCH ITS VERY USEFUL FOR ME
I have the same problem where I want to count how many agents are working between 06:00 AM and 10:00 AM. How can i do that using countif function, send suggestions
Jeethan,
You can use a formula similar to this:
=COUNTIFS(A1:A21, ">="&TIMEVALUE("6:00 AM"), A1:A21, "<="&TIMEVALUE("10:00 AM"))
Or this :D
=IF(AND(E2=1,OR(F2>=TIMEVALUE("04:00:00 PM"),F2<=TIMEVALUE("04:00:00 AM"))),1,0)
sorry...was for another comment.