You are on page 1of 56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

HOME

PRODUCTS

DOWNLOADS

SUPPORT

FORUMS

BLOG

ABOUT US

PURCHASE

COUNTIF in Excel - count if not blank, greater than, duplicate or unique


by Svetlana Cheusheva

Jul

Excel, Excel duplicates, Excel functions, Excel tips

223 Comments

2
Microsoft Excel provides several functions purposed for counting different kinds of cells, such
as blanks or non-blanks, with number, date or text values, containing specific words or
character, etc.

Excel: featured articles

In this article, we will focus on the Excel COUNTIF function that is purposed for counting cells
with the condition you specify. First, we will briefly cover the syntax and general usage, and
then I provide a number of examples and warn about possible quirks when using this function
with multiple criteria and specific types of cells.

VLOOKUP in Excel tutorial with


formula examples

In essence, COUNTIF formulas are identical in all Excel versions, so you can use the examples
from this tutorial in Excel 2013, 2010, 2007 and 2003.
Excel COUNTIF function - syntax and usage
Examples of how to use COUNTIF in Excel
COUNTIF formula for text and numbers (exact match)
COUNTIF with wildcard characters (partial match)
Count if blank or not blank
Count if greater than, less than or equal to
COUNTIF formulas for dates
Excel COUNTIF with multiple criteria
Count duplicates and unique values
Excel COUNTIF - frequently asked questions and issues

COUNTIF function in Excel - syntax and usage


Excel COUNTIF function is used for counting cells within a specified range that meet a certain
criterion, or condition.

How to use Excel COUNTIFS and


COUNTIF with multiple criteria

Creating a drop down list: static,


dynamic, from another
workbook
Excel formulas for conditional
formatting based on another
cell value
COUNTIF in Excel - count if not
blank, greater than, duplicate or
unique
Using IF function: formulas for
numbers, text, dates, blank cells
How to use Excel SUMIFS and
SUMIF with multiple criteria
Change background color based
on cell value
INDEX & MATCH functions in
Excel - a better alternative to
VLOOKUP

Outlook: featured articles

For example, you can write a COUNTIF formula to find out how many cells in your worksheet

How to sync Google Calendar


with Outlook

contain a number greater than or less than the number you specify. Another typical use of
COUNTIF in Excel is for counting cells with a specific word or starting with a particular letter(s).

How to fix "Cannot start


Microsoft Outlook" error

The syntax of the COUNTIF function is very simple:

Merge duplicate contacts in

COUNTIF(range, criteria)

Outlook

As you see, there are only 2 arguments, both of which are required:

Remove duplicate emails in

range - defines one or several cells to count. You put the range in a formula like you usually
do in Excel, e.g. A1:A20.
criteria - defines the condition that tells the function which cells to count. It can be a number,

Outlook 2010 and 2013 quickly


and safely
How to create and use e-mail
templates in Outlook

text string, cell reference or expression. For instance, you can use the criteria like these: "10",
A2, ">=10", "some text".
And here is the simplest example of Excel COUNTIF function. What you see in the image below
is the list of the best tennis players for the last 14 years. The formula
=COUNTIF(C2:C15,"Roger Federer")counts how many times Roger Federer's name is on the
list:

Excel
Excel charts

Excel add-ins
Excel consolidation

Excel duplicates

Excel formatting

Excel fun

Excel functions
https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

1/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Excel PivotTables

Excel randoms

Excel tips

Excel Vlookup

Merge data in Excel


Microsoft Office

Microsoft Word

new release

Office 365 tips

Office fun

Office news

Office tips

Outlook

Outlook add-ins

Outlook BCC

Outlook calendar Outlook duplicates

Outlook templates
PowerPoint

Outlook tips

Video

Sign in
Note. A criterion is case insensitive, meaning that if you type "roger federer" as the criteria
in the above formula, this will produce the same result.

Register
Log in

Excel COUNTIF function examples


As you have just seen, the syntax of the COUNTIF function is very simple. However, it allows for
many possible variations of the criteria, including wildcard characters, the values of other cells,
and even other Excel functions. This diversity makes the COUNTIF function really powerful and
fit for many tasks, as you will see in the examples that follow.

COUNTIF formula for text and numbers (exact match)


In fact, we discussed the COUNTIF function that counts text values matching a specified
criterion exactly a moment ago. Let me remind you that formula for cells containing an exact
string of text: =COUNTIF(C2:C15,"Roger Federer"). So, you enter:
A range as the first parameter;
A comma as the delimiter;
A word or several words enclosed in quotes as the criteria.
Instead of typing text, you can use a reference to any cell containing that word or words and
get absolutely the same results, e.g. =COUNTIF(C1:C9,C7).
Similar COUNTIF formulas work for numbers as well as for text values. As you can see in the
screenshot below, the formula =COUNTIF(D2:D9,5)perfectly counts cells with quantity 5 in
Column D.

Ultimate Suite for Excel Professionals

COUNTIF formulas with wildcard characters (partial match)


In case your Excel data include several variations of the keyword(s) you want to count, then you
can use a wildcard character to count all the cells containing a certain word, phrase or letters
as part of the cell's contents.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

2/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Suppose, you have a list of tasks assigned to different persons, and you want to know the
number of tasks assigned to Danny Brown. Because Danny's name is written in several
different ways, we enter "*Brown*" as the search criteria =COUNTIF(D2:D10, "*Brown*").

An asterisk (*) is used to find cells with any sequence of leading and trailing characters, as
illustrated in the above example. If you need to match any single character, enter a question
mark (?) instead, as demonstrated below.

Count cells beginning or ending with certain characters


You can use either wildcard character, asterisk (*) or question mark (?), with the criterion
depending on which exactly result you want to achieve.
If you want to know the number of cells that start or end with certain text no matter how
many other characters a cell contains, use these formulas:
=COUNTIF(C2:C10,"Mr*")- count cells that begin with "Mr".
=COUNTIF(C2:C10,"*ed")- count cells that end with the letters "ed".
The image below demonstrates the second formula in action:

If you are looking for a count of cells that start or end with certain letters and contain the exact
number of characters, you use the Excel COUNTIF function with the question mark character
(?) in the criteria:
=COUNTIF(D2:D9,"??own")- counts the number of cells ending with the letters "own" and
having exactly 5 characters in cells D2 through D9, including spaces.
=COUNTIF(D2:D9,"Mr??????")- counts the number of cells starting with the letters "Mr" and
having exactly 8 characters in cells D2 through D9, including spaces.
Tip. To find the number of cells containing an actual question mark or asterisk, type a tilde
(~) before the ? or * character in the formula. For example, =COUNTIF(D2:D9,"*~?*")will
count all cells containing the question mark in the range D2:D9.

Excel COUNTIF for blank and non-blank cells


These formula examples demonstrate how you can use the COUNTIF function in Excel to count
the number of empty or non-empty cells in a specified range.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

3/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

COUNTIF not blank


In some of other Excel COUNTIF tutorials, you may come across formulas for counting nonblank cells in Excel similar to this one:
=COUNTIF(range,"*")
But the fact is, the above formula counts all cells that contain any text, meaning that cells with
dates and numbers will be treated as blank cells!
If you need a universal COUNTIF formula for counting all non-blank cells in a specified range,
here you go:
=COUNTIF(range,"<>"&"")
This formula works correctly with all value types - text, dates and numbers - as you can see in
the screenshot below.

COUNTIF blank
If you want the opposite, i.e. count blank cells in a certain range, you should adhere to the
same approach - use a formula with a wildcard character for text values or another one (with
the "" criteria) to count all empty cells.
Formula to count cells not containing any text: =COUNTIF(range,"<>"&"*")
Translated into plain English, the criteria used in the above formula ("<>"&"*") means to find
cells not equal to *, i.e. not containing any text in the specified range.
Universal COUNTIF formula for blanks (all value types): =COUNTIF(range,"")
The above formula correctly handles numbers, dates and text values. For example, the formula
=COUNTIF(C2:C11,"")returns the number of all empty cells in the range C2:C11.
Note. Please be aware that Microsoft Excel provides another function for counting blank
cells =COUNTBLANK(range). For instance, the below formulas will produce exactly the same
results as the COUNTIF formulas you see in the screenshot above:
Count blanks: =COUNTBLANK(C2:C11)
Count non-blanks: =ROWS(C2:C11)*COLUMNS(C2:C11)-COUNTBLANK(C2:C11)
Also, please keep in mind that both =COUNTIF(range,"")and =COUNTBLANK(range)count
cells with formulas that only look empty. If you do not want to treat such cells as blanks, use
this formula instead: =ROWS(C2:11)*COLUMNS(C2:11)-COUNTIF(C2:11,"<>"&"").
For more information about counting blanks and not blanks in Excel, see the following
tutorials: 3 ways to count empty cells in Excel and How to count non-empty cells in Excel.

COUNTIF greater than, less than or equal to


To count cells with values greater than, less than or equal to the number you specify, you simply
add a corresponding operator to the criteria, as shown in the table below.
Please pay attention that in COUNTIF formulas, an operator with a number are always
enclosed in quotes.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

4/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Criteria

Formula Example

Description

Count if greater than

=COUNTIF(A2:A10,">5")

Count cells where value is greater than


5.

Count if less than

=COUNTIF(A2:A10,"<5")

Count cells with values less than 5.

Count if equal to

=COUNTIF(A2:A10,"=5")

Count cells where value is equal to 5.

Count if not equal to

=COUNTIF(A2:A10,"

Count cells where value is not equal to

<>5")

5.

=COUNTIF(C2:C8,">=5")

Count cells where value is greater than

Count if greater than or


equal to
Count if less than or
equal to

or equal to 5.
=COUNTIF(C2:C8,"<=5")

Count cells where value is less than or


equal to 5.

You can also use all of the above formulas to count cells based on another cell value, you will
just need to replace the number in the criteria with a cell reference.
Note. In case of a cell reference, you have to enclose the operator in quotes and add an
ampersand (&) before the cell reference. For example, to count cells in the range D2:D9 with
values greater than a value in cell D3, you use this formula =COUNTIF(D2:D9,">"&D3):

If you want to count cells that contain an actual operator as part of the cell's contents, i.e. the
characters ">", "<" or "=", then use a wildcard character with the operator in the criteria. Such
criteria will be treated as a text string rather than a numeric expression. For example, the
formula =COUNTIF(D2:D9,"*>5*")will count all cells in the range D2:D9 with contents like this
"Delivery >5 days" or ">5 available".

Using Excel COUNTIF function with dates


If you want to count cells with dates that are greater than, less than or equal to the date you
specify or date in another cell, you proceed in the already familiar way using formulas similar
to the ones we discussed a moment ago. All of the above formulas work for dates as well as for
numbers. Let me give you just a few examples:
Criteria

Formula Example

Description

Count dates equal to the


specified date.

=COUNTIF(B2:B10,"6/1/2014")

Counts the number of cells


in the range B2:B10 with
the date 1-Jun-2014.

Count dates greater than or

=COUNTIF(B2:B10,">=6/1/2014")

equal to another date.

Count the number of cells


in the range B2:B10 with a
date greater than or equal
to 6/1/2014.

Count dates greater than or


equal to a date in another
cell, minus x days.

=COUNTIF(B2:B10,">="&B2-"7")

Count the number of cells


in the range B2:B10 with a
date greater than or equal
to the date in B2 minus 7
days.

Apart from these common usages, you can utilize the COUNTIF function in conjunction with

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

5/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

specific Excel Date and Time functions such as TODAY() to count cells based on the current
date.
Criteria

Formula Example

Count dates equal to the current date.

=COUNTIF(A2:A10,TODAY())

Count dates prior to the current date, i.e.

=COUNTIF(A2:A10,"<"&TODAY())

less than today.


Count dates after the current date, i.e.

=COUNTIF(A2:A10,">"&TODAY())

greater than today.


Count dates that are due in a week.

=COUNTIF(A2:A10,"="&TODAY()+7)

Count dates in a specific date range.

=COUNTIF(B2:B10, ">=6/7/2014")COUNTIF(B2:B10, ">6/1/2014")

Here is an example of using such formulas on real data (at the moment of writing today was
25-Jun-2014):

Excel COUNTIF with multiple criteria


In fact, Excel COUNTIF function is not exactly purposed for counting cells based on multiple
criteria. There is another function, COUNTIFS, especially designed for this (it is the topic of the
next week's article). However, you can use COUNTIF to count values based on two or more
criteria by adding or subtracting several COUNTIF functions.
Example 1. COUNTIF with two conditions for numbers
One of the most common applications of Excel COUNTIF function with 2 criteria is counting
numbers within a specific range, i.e. less than X but greater than Y. For example, you can use
the following formula to count cells in the range B2:B9 where a value is greater than 5 and less
than 15.
=COUNTIF(B2:B9,">5")-COUNTIF(B2:B9,">=15")

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

6/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Example 2. COUNTIF with multiple conditions for text values


Let's consider one more example of the COUNTIF function that will count 2 different text
values. Suppose you have a shopping list and you want to find out how many soft drinks are
included. So, the following formula works a treat:
=COUNTIF(B2:B13,"Lemonade")+COUNTIF(B2:B13,"*juice")
Please pay attention to the wildcard character (*) in the second criterion, it is used to count all
kinds of juice on the list.

In the same manner, you can write a COUNTIF formula with several conditions. Here is an
example of the COUNTIF function with multiple conditions that counts lemonade, juice and
ice cream:
=COUNTIF(B2:B13,"Lemonade") + COUNTIF(B2:B13,"*juice") + COUNTIF(B2:B13,"Ice
cream")
You can find plenty more examples for text, numbers and dates in this tutorial - Excel
COUNTIFS and COUNTIF with multiple criteria.

Using COUNTIF function to find duplicates and unique


values
Another possible usage of the COUNTIF function in Excel is for finding duplicates in one
column, between two columns, or in a row.
Example 1. Find and count duplicates in 1 column
For example, this simple formula =COUNTIF(B2:B10,B2)>1 will spot all duplicate entries in the
range B2:B10 while another function =COUNTIF(B2:B10,TRUE) will tell you how many dupes are
there:

Example 2. Count duplicates between two columns

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

7/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

If you have two separate lists, say lists of names in columns B and C, and you want to know
how many names appear in both columns, you can use Excel COUNTIF in combination with the
SUMPRODUCT function to count duplicates:
=SUMPRODUCT((COUNTIF(B2:B1000,C2:C1000)>0)*(C2:C1000<>""))
We can even take a step further and count how many unique names there are in Column C, i.e.
names that do NOT appear in Column B:
=SUMPRODUCT((COUNTIF(B2:B1000,C2:C1000)=0)*(C2:C1000<>""))

Tip. If you want to highlight duplicate cells or entire rows containing duplicate entries, you
can create conditional formatting rules based on the COUNTIF formulas, as demonstrated in
this tutorial - Excel conditional formatting formulas to highlight duplicates.
Example 3. Count duplicates and unique values in a row
If you want to count duplicates or unique values in a certain row rather than a column, use one
of the below formulas. These formulas might be helpful, say, to analyze the lottery draw
history.
Count duplicates in a row:
=SUMPRODUCT((COUNTIF(A2:I2,A2:I2)>1)*(A2:I2<>""))
Count unique values in a row:
=SUMPRODUCT((COUNTIF(A2:I2,A2:I2)=1)*(A2:I2<>""))

Excel COUNTIF - frequently asked questions and


issues
I hope these examples have helped you to get a feel for the Excel COUNTIF function. If you've
tried any of the above formulas on your data and were not able to get them to work or are
having a problem with the formula you created, please look through the following 5 most
common issues. There is a good chance that you will find the answer or a helpful tip there.

1. COUNTIF on a non-contiguous range of cells


Question: How can I use COUNTIF in Excel on a non-contiguous range or a selection of cells?
Answer: Excel COUNTIF does not work on non-adjacent ranges, nor does its syntax allow
specifying several individual cells as the first parameter. Instead, you can use a combination of
several COUNTIF functions:

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

8/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Wrong: =COUNTIF(A2,B3,C4,">0")
Right: =COUNTIF(A2,">0") + COUNTIF(B3,">0") + COUNTIF(C4,">0")
An alternative way is using the INDIRECT function to create an array of ranges. For example,
both of the below formulas produce the same result you see in the screenshot:
=SUM(COUNTIF(INDIRECT({"B2:B8","D2:C8"}),"=0"))
=COUNTIF($B2:$B8,0) + COUNTIF($C2:$C8,0)

2. Ampersand and quotes in COUNTIF formulas


Question: When do I need to use an ampersand in a COUNTIF formula?
Answer: This is probably the most arcane part. I personally find the syntax of the COUNTIF
function very confusing, though if you give it some thought, you'll see the reasoning behind it.
An ampersand and quotes are needed to construct a text string for the argument. So, you can
adhere to these rules:
If you use a number or a cell reference in the exact match criteria, you need neither
ampersand nor quotes, e.g. or =COUNTIF(A1:A10,10)or =COUNTIF(A1:A10,C1).
If your criteria includes text, wildcard character or some operator with a number, you
enclose it in quotes, e.g. =COUNTIF(A2:A10,"lemons")or =COUNTIF(A2:A10,"*")or
=COUNTIF(A2:A10,">5")
If you use an expression with a cell reference or another Excel function, you have to use the
quotes ("") to start a text string and ampersand (&) to concatenate and finish the string off.
For example, =COUNTIF(A2:A10,">"&D2)or =COUNTIF(A2:A10,"<="&TODAY()).
If you are in doubt whether an ampersand is needed or not, try out both ways. In most cases
an ampersand works just fine, e.g. the formulas =COUNTIF(C2:C8,"<=5") and =COUNTIF(C2:C8,"
<="&5) work equally well.

3. COUNTIF for formatted (color coded) cells


Question: How do I count cells by fill or font color rather than by values?
Answer: Regrettably, the syntax of the Excel COUNTIF function does not allow using formats as
the condition. The only possible way to count or sum cells based on their color is using a
macro, or more precisely an Excel User-Defined function. You can find the code working for
cells colored manually as well as for conditionally formatted cells in this article - How to count,
sum and filter cells by color in Excel.

4. #NAME? error in the COUNTIF formula


Issue: My COUNTIF formula throws a #NAME? error. How can I get it fixed?
Answer: Most likely, you have supplied an incorrect range to the formula. Please check out point
1 above.

5. Excel COUNTIF formula not working


Issue: My COUNTIF formula is not working! What have I done wrong?
Answer: If you have written a formula which is seemingly correct but it does not work or
produces a wrong result, start by checking the most obvious things such as a range, conditions,
cell references, use of ampersand and quotes.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

9/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Be very careful with using spaces in a COUNTIF formula. When creating one of the formulas for
this article I was on the verge of pulling my hair out because the correct formula (I knew with
certainty it was right!) wouldn't work. As it turned out, the problem was in a measly space
somewhere in between, argh... For instance, look at this formula =COUNTIF(B2:B13,"
Lemonade"). At first sight, there is nothing wrong about it, except for an extra space after the
opening quotation mark. Microsoft Excel will swallow the formula just fine without an error
message, warning or any other indication, assuming you really want to count cells containing
the word 'Lemonade' and a leading space.
If you use the COUNTIF function with multiple criteria, split the formula into several pieces and
verify each function individually.
And this is all for today. In the next article, we will explore several ways to count cells in Excel
with multiple conditions. Hope to see you next week and thanks for reading!

Want to find more inventive tips, tricks and tutorials?


Please follow us on Google+:

Follow

1.5k

223 Responses to "COUNTIF in Excel - count if not blank,


greater than, duplicate or unique"
1

Karo says:
July 22, 2014 at 4:44 pm
I want to group or count values that start the same. In this short example YTOP.125 should
be grouped together - or counted. I can work with either. So I want to be able to say "if the
first, for example 8 characters are the same then...
For example
ColumnA
YTOP.125SP
HYEP.556M
YTOP.648
MNTK.593
HYEP.257
YTOP.125LO
Can you help? Is this possible?
Reply
Svetlana Cheusheva says:
July 23, 2014 at 12:26 pm
Hi Karo,
Yes, it is possible, but you will need to add a helper column to your table. If this is
acceptable, then create an additional column and copy the following formula across that
column, which will extract the first 8 characters =LEFT(A2,8). After that, you can proceed
in 2 ways.
Way 1 using Subtotal:
- Sort your table by Column A 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 the first 8 characters.
For more info about using subtotals please see this article - Using Subtotals in Microsoft
Excel
Way 2 using a pivot table:
- 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 column A to the

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

10/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Values section.
Reply

Richard says:
July 24, 2014 at 12:12 pm
Hello,
I want to formulate the following:
IF "cell value A" greater than(>) "cell value B", THEN "cell value A" = "cell value B" and
therefore the result "cell value C" is equal to zero
if this is doable can it be applied to multiple "cells"?
Reply
Svetlana Cheusheva says:
July 25, 2014 at 8:07 am
Hi Richard,
I understand your condition but cannot figure out what result you want to achieve : ) If
you want a formula to add a zero to column C if a value in cell A in the same row is
greater than in cell B, you can use the following IF formula: =IF($A2>$B2,0,"") where 2 is
your first row with data. Since we use a relative row reference (without the $ sign) the
formula with compare values in each individual row when copied across multiple cell. If
you are looking for some other result, please clarify.
Reply

Kelly-Ann says:
July 31, 2014 at 4:32 pm
Hi There,
I am trying to record attendance at my office and I am putting together an excel
spreadsheet to store the data. I need to be able to sum up the totals of vacation days,
personal days, business days, and sick days. The countif works well if I put 'V' for vacation,
'B' for business and so forth, but how can I calculate half days? Is there a way that I can set
up a second Countif function so when I put in something like 'VH' in the range it counts it
as 0.5 rather than one? Pretty much I am wondering if I can change the amount that the
countif function counts by.
Thanks
Reply
Svetlana Cheusheva says:
August 1, 2014 at 7:14 am
Hi Kelly-Ann,
I think you can just multiply the result of COUNTIF for "VH" by 0.5 to count half days,
e.g.:
=COUNTIF(RANGE, "V") + 0.5*COUNTIF(RANGE, "VH")
Reply

Clare says:
August 4, 2014 at 10:05 am
Hi,
I have a project list where activity is shown in a timeline. I need to count up if a column
'project stage' shows activity in any given month. I have set the countif for picking up
activity but now need to make it so that it only counts that activity if column 'project stage'
is a particular word.
Any idea?
BTW the above is great!
Reply
Svetlana Cheusheva says:
August 4, 2014 at 1:01 pm
Hi Clare,

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

11/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


You need to use the COUNTIFS function that allows setting multiple criteria in a formula.
Something similar to this:
=COUNTIFS(C2:C9, ">=6/1/2014", C2:C9, "<=6/30/2014", D2:D9, "SpecialWord")
Where C is the column with dates and D is the "Project Stage" column.
Please see the following article for more info:
http://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
Reply

Ruth says:
August 5, 2014 at 6:42 pm
Hi,
I need to combine an IF statement with a COUNTIF that will count 3 out of 5 text entry
options for a single column. If the COUNTIF =0, it needs to show as a dash. This is the
original formula that is working =IF(COUNTIF(B1:B10000,C1&D1)=0,"",COUNTIF(B1:B10000,C1&D1))
I need to add another criteria to the COUNTIFs, where there are 5 possible entries in
column E and I need it to count 3 of these (Allocated, Declined, Rejected). Any suggestions
is gratefully appreciated.
Ruth
Reply
Svetlana Cheusheva says:
August 6, 2014 at 1:05 pm
Hello Ruth,
Let me check if I understand the task correctly. Do you want to count values in column B
only if column E has any of these values: Allocated, Declined, Rejected? Or, are you
looking for something different? It will be very helpful if you can paste the values from a
couple of rows in columns B-E and the result you expect a formula to return.
Reply

Dean BROWN says:


August 11, 2014 at 9:37 pm
Hi There,
I am wanting to extract some values and I thought COUNTIF might be able to do it.
I have a cell that contains some data eg: ABC-BBC-ABC-SII-BBC-ABC
I get COUNTIF to count how many times BBC appears in that cell, seems it only counts the
FIRST instance of BBC.
How do I get it check the entire contents of the cell and correctly record the result eg: BBC
appears twice in that cell
Thanks!
Reply
Svetlana Cheusheva says:
August 12, 2014 at 8:49 am
The COUNTIF function cannot count specific text or characters inside a cell, it deals with
the entire contents of a cell, as if you selected the option "Match entire cell contents"
when performing search in Excel.
Please use this formula instead:
=(LEN(A2)-LEN(SUBSTITUTE(A2,"BBC","")))/LEN("BBC")
Where A2 is the cell containing "ABC-BBC-ABC-SII-BBC-ABC", and "BBC" is the search
text. Instead of "BBC", you can enter a cell reference with the search text, e.g. B1,
sometimes it is a more convenient way to work with formulas.
Reply

Robert says:
August 12, 2014 at 12:41 pm
I'm after something similar to what you were asking Ruth please.
I've set up the formula to count up all the instances of "*banananas*" in column B.
I then have a list of places in column A. So say the total amount of banananas is 300 I want

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

12/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


to know how many banananas I have for each of the individual places. So it only counts
the banananas entries that are next to specific text in column A.
Thanks.
Reply
Svetlana Cheusheva says:
August 13, 2014 at 12:51 pm
Hi Robert,
In this case, you'd better use the COUNTIFS function rather than COUNTIF. It allows you
to apply several criteria to different cell ranges. You can find more information about
the COUNTIFS function in this article:
http://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
As for your task, you can use the following formula:
=COUNTIFS(B:B,"*bananas*",A:A,"PlaceName")
Reply

lara says:
August 13, 2014 at 8:03 am
Hi
Im also after something similar to Robert.
In column A i have a number of different status ie. "On Programme", "Rejected",
"Completed" etc. and in column B i have a number of programmes ie. "Cleaning",
"Customer Service", etc and i want to could how many for example On programme
cleaning there are?
Ive tried and other formulas similar to this but none seem to be counting what i want.
=SUM((COUNTIF(A2:A32,"On Programme"))*OR((COUNTIF(B2:B32,"CLEANING"))))
Can you help?
Reply
Svetlana Cheusheva says:
August 14, 2014 at 7:08 am
Hello Lara,
The same as Robert, you should also use the COUNTIFS function rather than COUNTIF,
because COUNTIFS can count cells based on multiple criteria. The formula is as follows:
=COUNTIFS($A2:$A32,"On programme",$B2:$B32,"CLEANING")
You can find the full details in this tutorial:
http://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
If you want to use the SUM function, you should enter the following array formula
(remember to press Ctrl + Shift + Enter to complete it):
{=SUM(($A2:$A22="On Programme")*($B2:$B32="CLEANING"))}
Reply

V Sorensen says:
August 18, 2014 at 2:18 pm
HELP! I'm trying to create a list of email addresses, based on wireless carrier. So if one
column has their wireless number, next column has carrier, I then want to combine
wireless number with the appropriate text email. Where these are the extensions I want to
add:
Verizon = @vtext.com
AT&T = number@txt.att.net
Sprint = number@pm.sprint.com
Tmobile = number@tmomail.net
So if someone lists
5556667777 Verizon
6667778888 Sprint
How do I create a cell that says If A6=Verizon, then 5556667777@vtext.com??
It's a list of a few hundred, so I'd rather no do manually. Thanks so much for the
assistance!
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

13/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
August 19, 2014 at 10:23 am
Hello Virginia,
To fulfill your task, you need to create a lookup table "CarrierName = Domain" in
another worksheet. Then, you will be able to pull a domain by the Carrier name using
the below formula below and concatenate it with the telephone number. Here is the
formula:
=IF(AND(A2<>"", B2<>"", MATCH(B2,WirelessCarriersData[Name], 0)>0), A2 &
VLOOKUP(B2,WirelessCarriersData,2,FALSE),"")
Where A2 is the first cell in the Phone column not including headers, B2 is the first cell
in the Carrier column, and WirelessCarriersData is the name of the lookup table.
We have created an example for you, feel free to download it using the link below:
http://www.ablebits.com/_img-blog/_comments/virginia.sorensen@capitalone.com-1.xlsx
Reply

10

Dawn Weber says:


August 19, 2014 at 2:06 pm
I am trying to create an auto Vacation equation template. I have completed the template
and it is working well except, I would like it to do something like this.
Example:
=COUNTIF(D3:J20, "BBB-V") Currently the template is counting one for each one it sees, but
what I would like it to is to equate 1 with a (NUMBER) like "10" to allow for actual hours
employee is being deducted from balance the employee has. So if it sees one I would like
it to see it is 1=10 and display the number in the cell as 10... Have I made this clear?
Reply
Svetlana Cheusheva says:
August 20, 2014 at 10:54 am
Hello Dawn,
I am not sure I fully understand your task. You can try one of the following solutions:
Solution 1 you can just multiply the result by a certain number, say 10, othe formula
will be as follows:
=COUNTIF(D3:J20, "BBB-V")*10
If you want to pull the number from a certain cell, replace "10" with a cell reference.
Solution 2 if you want to show 10 for COUNTIF=1, and for the other cases you want to
do something different (e.g. multiply by 9):
=IF(COUNTIF(D3:J20, "BBB-V") = 1, 10, COUNTIF(D3:J20, "BBB-V") * 9 )
If neither solution work for you, please send a sample workbook with your data at
support@ablebits.com and we will try to help.
Reply

11

Rod says:
August 20, 2014 at 9:43 pm
Hi Svetlana!, I hope you can help me...
I am making a sample-test exam where the correct answer will be hidden in column C and
column B will be where the person who is taking the exam will place his/her answer. I
need a formula to tell me how many correct answers were given. For example:
-X1- = test takers' answer
-X2- = correct answer
-X1- -X2AB
CC
AD
DD
BB
I need a formula that will tell me that the test taker answered 3 questions correctly and
then divide that value by the number of questions, in this case 5 questions. FYI: The
answers will be side-by-side, however many blank rows will separate each answer (to

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

14/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


facilitate the question and multiple answers in column A).
Thank you,
Rod
Reply
Svetlana Cheusheva says:
August 22, 2014 at 6:42 am
Hi Rod!
You can use the following array formula. Change 30 to the number of your last row with
answers, and remember to press Ctrl + Shift + Enter to complete the formula:
=SUM(NOT(ISBLANK(C2:C30))*(B2:B30=C2:C30))
Then you can divide the result by the number of questions.
BTW, please be aware that one can easily see the content of a hidden column. More
details are in this blog post:
http://www.ablebits.com/office-addins-blog/2014/07/30/excel-unhide-columns/#disableunhide-columns
Reply
Uldis says:
April 7, 2015 at 1:23 pm
Hi Svetlana!
I tried to use this sample You provided for Rod, but it doesn't seem to work, and I
don't get what's wrong...
1) I entered some values in B and C columns
2) entered formula exactly as it is in Your sample and pressed Ctrl+Shift+Enter
as a result I see that formula as a text, and no result... why is that so? What am I doing
wrong?
Here is the screenshot how it looks:
http://screencast.com/t/QRsaafuSvzw
Hope, You can help!
P.S. This is a really nice and helpful blog post!
Reply
Uldis says:
April 7, 2015 at 1:48 pm
OK, I gound what's wrong... i didn't know that brackets {} are added automatically and
I don't have to enter them manually :)
Reply
Svetlana Cheusheva says:
April 8, 2015 at 11:53 am
Hi Uldis,
It's great that you sorted this out! Those brackets might be confusing indeed, I
added them to show that is an array formula. But may be I'd better remove them
not to confuse someone else :)
Reply

12

Samantha says:
August 21, 2014 at 5:42 pm
I tried using the countif(range,""&"") to count the cells within a range in my sheet that
have something written in them and it keeps counting all of the cells selected.
If I tried counting all the cells that are blank instead and write countif(range,""&"*") it
brings me to 0.
Any idea of why it wont count my cells that have data?
Reply
Svetlana Cheusheva says:
August 22, 2014 at 12:47 pm

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

15/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Hi Samantha,
Please try using the formulas described in the Excel COUNTIF for blank and non-blank
cells section. They should work.
Reply
Samantha says:
August 26, 2014 at 10:11 am
Hi Svetlana,
Unfortunately when using both functions to count non blank cells it still counts all the
cells for me.
The way I input the function is : =COUNTIF(E21:E27,""&"")
Is that a correct way?
I only have test1 in 1 of the cells written yet that function comes out as 7.
Any ideas of what might be going on in the excel?
Reply
Svetlana Cheusheva says:
August 26, 2014 at 1:12 pm
Hi Samantha,
This is the correct formula to count non-blank cells.
=COUNTIF(E21:E27,"<>"&"")
Does it work for you?
Reply

13

Lance says:
August 26, 2014 at 6:09 pm
Trying to calculate the number of times certain words appear in a column. Some of the
cells works others don't and I am using the exact same formulas for both. Even when I
click in on the fx button the total is correct in the formula, but it won't replicate it to the
cell. The cell just shows the formula an not the number. I have all the cells formatted to
general, even the ones that are working correctly.
Reply
Svetlana Cheusheva says:
August 27, 2014 at 10:22 am
Hello Lance,
It's hard to pin down the cause of the problem without seeing your data. If you can send
you sample workbook at support@ablebits.com, we'll try to figure it out.
Reply

14

Bilal says:
August 27, 2014 at 2:24 am
Is there any site where we can get online support for MS office (Excel) I mean through
chat...
Reply
Svetlana Cheusheva says:
August 27, 2014 at 10:18 am
Hi Bilal,
I am sorry, I do not know any website that provides free online consultancy / support for
Microsoft Office.
Reply

15

Gayle says:
August 29, 2014 at 1:19 pm
I need to count the number of names in a column, but exclude any that have been struck
through.
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

16/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

16

Shams says:
September 4, 2014 at 11:09 am
Greetings
Making an attendance sheet
Want 5 T=Tardies to couny as a 1
Ex. 28 periods a week one has 12 Tardies which means 2 absents so 112 periods a month
in average so how or which formula can help me count 5 T=Tardies as 1
Thanks in advance
Reply

17

Sam says:
September 4, 2014 at 3:42 pm
Not sure if its possible, but can you Count the Blank spaces in One Column (say Column A)
if there is specific text in Column B that corresponds to the blank area. For example, I need
to know how many have responded to my invitation (blanks)in column A, but have
informed me they are available (Word: Available)in column B. I have tried to combine a
=CountBlank with a =COUNTIF but it doesn't seem to be working for me.
Thank you!
Reply

18

Alex says:
September 9, 2014 at 8:19 am
Hi
I want to be able:
If column A = certain text, then I want all the Values in Column B(same row) be summed
together:
For example:
Profession Mark
Nurse 5
Doctor 2
Careworker 2
Doctor 6
Doctor 7
Nurse 8
Nurse 5
Nurse Doctor Careworker
(sum) (sum) (sum)
Reply

19

Alex says:
September 9, 2014 at 8:52 am
Hi
Never mind, I figured it out.
thank you
Reply

20

Tommy says:
September 10, 2014 at 10:16 am
Hello,
I want to count the number of blank cells from a specific character.
The problem is that the range is extended with one cell, each day. Can you automatically
extend that range each day?
Also, eventially the specific character will appear again in later cells, then I want it to start
the count of blank cell from this "new" specific character.
Example:
The letter P is in cell B2 the range is B2:G2, hence 5 blank cells. Two days after I want the
range to be B2:I2 i.e. 7 blank cells.
Another three days later the the letter P appears in cell K2 (range is now B2:L2), hence it
should start the count from K2 i.e. 1 blank cell.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

17/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Thank you
Hope I didn't complicate the explaination?! =)
Thank you
Reply

21

Heather says:
September 10, 2014 at 1:13 pm
I am trying to identify and account for duplicates. I would like the COUNTIF formula to tell
me if there is a duplicate anywhere else in that column. If a unique value it would result in
a "1" and if a duplicate is found it will result in a "0." However, I would also like the 1st
occurance of a value to result in a "1" and all other duplicate values to be a "0." How can I
get that 1st occurance of a value to result in a "1" separate from its duplicates?
Reply
Ange says:
February 4, 2015 at 10:47 pm
=IF((COUNTIF($A$1:$A1))=1,1,0)
Reply

22

Pina L C says:
September 16, 2014 at 12:08 pm
This is so useful Svetlana, and your answers to the questions here helped a lot today at
work. Thanks!
Reply

23

Carol says:
September 17, 2014 at 5:01 am
Hi. i have 6 sheet tabs. The 5 sheet tabs are the summary report of 5 different branches
and the other sheet tab is for my summary report. All column A of 5 sheet tabs refers to
different sports while column B refers to number of votes for different sports. I need to
get the top 3 sports for all branches.
For example,
In Branch 1, the top 3 sports listed are basketball, football and volleyball with 85, 74 and
65 votes. For branch 2, the top 3 listed are tennis, basketball and badminton with 65, 54
and 32 votes and so on. How will i get the top most sports from 5 different branches that
will also add the votes if for example all branches have basketball in their list? Hope you
can help me with this.
Thank you
Reply

24

Al Imran Monju says:


September 18, 2014 at 2:19 am
Hi,
I have seen this. When i feel that i have need more than i will find out. But for this time it
is very helpful to me. Thank you.
Reply

25

Al+Imran+Monju says:
September 18, 2014 at 4:49 am
Hi,
I want to know from you that how can I count the two cell data at a time like:
ColA Col B
1M
2F
3F
6M
2F
3M
I want to know for 1 how many M of F and for 2 how many M or F Like ------------

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

18/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Reply
Ashish says:
June 15, 2015 at 12:00 pm
If you have got answer pls. share with me. Even I also need solution.
Reply

26

Karla says:
September 24, 2014 at 8:12 pm
Can you please tell me what the formula is if I want when if a # is less than 35 then add
$5.75 if it's greater than 35 add $12.75 please help thanks
Reply
Svetlana Cheusheva says:
September 25, 2014 at 6:18 am
Hi Karla,
I am not sure I can exactly follow you. Do you want to enter a number in some cell based
on a value in another cell? For example, if a number in cell A1 is less than 35, than put
5.75 in cell B2, if it's greater than 35, than put 12.75? And what if it is equal to 35?
Reply

27

Rick says:
September 26, 2014 at 4:29 pm
Does the COUNTIF function only compare the first 15 characters? I use it to check for
duplicate values. It flags 2 of my cells as being duplicates. The only difference is the 16th
character.
Reply
Rick says:
September 26, 2014 at 5:45 pm
I tested this theory of mine using the right 15 characters of a concatinated string. That
fixed the problem.
Reply
Svetlana Cheusheva says:
September 29, 2014 at 4:52 pm
Hello Rick,
Thank you for the information and the update.
To my best knowledge, the COUNTIF function has 255 characters limitation since Excel
2007. And one can bypass this limitation by using the Exact function in array
formulas.
The issue you describe may occur either in a very old version of Excel, or more likely, if
your sheet contains only numeric data and Excel treats it as numbers. As you
probably know, Excel has a 15 digit limitation when it comes to numbers, and after the
first 15 digits, it replaces everything with 0's. Please check out the following Microsoft
answer for more details:
http://answers.microsoft.com/en-us/office/forum/office_2007-excel/15-digit-numberlimitation-non-text-workaround/a4974853-7c3c-4830-8562-2e88369d981b
Reply

28

Johann Sebastian says:


September 26, 2014 at 9:28 pm
I have a spreadsheet where I input my current weekly sales in Column C and last year's
weekly sales is already typed in Column B; I want to make a REAL month-to-date weekly
comparison at my weekly manager's meeting.
To do this I would need the weekly sales from last year in Column B to count ONLY when if
I input the weekly sales figure in Column C; otherwise I need Column B "blank" or to count
as "0".
Note: please keep in mind that last years weekly sales in Column B is taken from last
year's monthly sales in Column A divided by 4 (accounting for four weeks in a month)

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

19/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


whereby the value of cell B1 is "=A1/4"
So, I need Column B to display last year's weekly sales ONLY when I input last week's sales
in Column C.
Can someone please help me?
Thank You,
Johann Sebastian
Reply
Svetlana Cheusheva says:
September 29, 2014 at 4:31 pm
Hello Johann,
Enter the below formula in cell B1:
=If($C1<>"",$A1/4,"")
And then copy/paste it to the whole column.
Reply

29

Dushyant Dodiya says:


September 28, 2014 at 1:34 pm
I have one problem in my work sheet.
Pls any one help me.
I have total no. of data.
Like
Year Total 1 2 3 4 5
of Cell
1993 5 136 591 888 960 1006
1994 3 107 177 347
1995 5 408 1238 1352 1521 1581
3 2215 2414 2444
1996 5 112 1093 1144 1298 1351
1997 5 122 238 388 458 485
4 1104 1105 1432 1479
1998 5 77 88 464 467 574
5 1165 1182 1190 1374 1430
1999 5 421 480 531 844 900
4 1913 1935 2005 2019
2000 5 16 36 79 95 97
5 572 574 655 656 674
5 1209 1275 1280 1481 1507
3 1834 1851 1875
i want the when ever year combined that time total of cell sum.
Reply
Svetlana Cheusheva says:
September 29, 2014 at 4:25 pm
Hello Dushyant,
I am sorry, your data posted in the comment got distorted. For us to be able to assist you
better, please send your workbook to support@ablebits.com and include the result you
expect to get. We'll try to help.
Reply

30

Vamsi says:
October 5, 2014 at 6:09 pm
HELLO,
Please help me in this problem
Formula: =IFERROR(LOOKUP(C2,Sheet1!$A$30:$A$39,Sheet1!$B$30:$B$39), "")
Required condition: If C2 cell in not equal to A2 " additional conditon to be added in above
formula with the existing.
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

20/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
October 6, 2014 at 4:05 pm
Hello Vamsi,
Please specify what exactly additional condition you want to add, and in what part of the
formula you want to add it.
Reply

31

Vamsi says:
October 6, 2014 at 5:34 pm
Hello,
DESCRIPTION OF FORMULA MADE IN EXCEL WORKSHEET.
C2 WILL BE ENTERED BY USER.
In D2 the entered value of user will be searched (LOOKUP)in other worksheet with in
specified range of column (Sheet1!$A$30:$A$39) and output will be the specified range in
other column (Sheet1!$B$30:$B$39).
If there no entry in the cell (C2) by user the cell (D2) will remain Blank.
Here my requirement:
In addition to above condition the value entered in C2 should not be equal to Value of A2,
if equal then it should be an error message (N/A).
PARAMETERS OF THE CELLS in worksheet 2:
A2 DUTY CODE NORMAL
C2 DUTY CODE OVERTIME
D2 TIMING OF DUTY
Sheet1!$A$30:$A$39 - Worksheet 1 A30 to A39 are duty codes
Sheet1!$B$30:$B$39 - Worksheet 1 Duty timing
---END--Reply
Svetlana Cheusheva says:
October 8, 2014 at 4:30 pm
Hello Vamsi,
If you can send us your sample workbook at support@ablebits.com and we'll try to find
a solution.
Reply

32

Rachana says:
October 8, 2014 at 2:20 pm
Hi Svetlana,
What formula can i use if i want a value "N" in 1st coulmn based on blank cells that
appear in 2nd column and want value "Y" in 1st column based on non-blank cells that
appear in 2nd column. Please advise.
Y/N Names
N
Y abc
Thanks
Reply
Svetlana Cheusheva says:
October 10, 2014 at 12:09 pm
Hello Rachana,
You can use the following formula for your 1st column:
=if(B2<>"", "Y","N)
Where B is your second column.
Reply
Rachana says:
October 15, 2014 at 11:15 am
Thank you Swetlana!!!

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

21/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


One more help i would need on a formula.
I have one column "A" with names e.g. Mike, Tony etc goes till A12, and the names are
repeated.
other column "B" having some numbers with % sign e.g. 90%, 80% etc.. goes till B12
Now i want to count non blanks ones in B1:B12 for Mike in B1:B12
I tried as below , but it didnt work. Please can you advise which forula fits better..
=countifs('Block Inspections'!B1:B12,'Block Inspections'!A12:A150,"=Mike")
Thanks,
Rachana
Reply

33

Amber says:
October 8, 2014 at 4:11 pm
Hi Svetlana,
I have three columns that are populated via a pivot table (in tabular format). They are site
(a), manager (b) and rep (c). Only one cell populates per row across the three columns. I'm
trying to build 1 formula that can be applied to all rows in one column (d), that counts the
# of items entered in a given month for either site, manager or rep...depending on which
column (a-c) is populated in that row.
I recently built the below formula that looks at the rep column first. If it is populated, it
counts the # of times that reps name shows up in column b on the data tab. If it is blank,
then it knows it needs to refer to column b for the manager name and then count the #
times that managers name shows up on the data tab in column f.
=IF(C6="",COUNTIF(DATA!$F$3:$F$3000,B6),COUNTIF(DATA!$B$3:$B$3000,C6))
I need help adding an additional (nested if or and) function that says if both column b and
c are blank, refer to column a and then search the # of times that site shows up in column
d of the data tab. Let me know if I am not explaining this well enough. I appreciate your
help in advance!
Thanks!
Reply
Svetlana Cheusheva says:
October 10, 2014 at 12:06 pm
Hi Amber,
I think we will be able to help you better if we can have a look at your data. I possible,
please send your sample workbook at support@ablebits.com.
Reply

34

Vamsi says:
October 9, 2014 at 7:15 pm
Hellow Svetlana Cheusheva, Forwarded the workbook file by mail for your guidance and
support. Hope you can help me.
Thanks
Reply

35

COUTNING says:
October 11, 2014 at 11:26 am
I need a formula that says:
if column I = cell A1 count it, but if column I is blank then go to column g only count it if
column g = cell A1
Reply

36

Satheesh says:
October 14, 2014 at 4:10 am
If a sheet arranged as bellow
Col A col B col C
Name rank age

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

22/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Arun dy co 25
Philips si 30
Joseph dy co 27
Vinod dy co 29
stphen si 26
Then how can count how many dy co become between the age 25 to 30 by using excel
formula.
Please help
Reply
Svetlana Cheusheva says:
October 14, 2014 at 11:21 am
Hello Satheesh,
You can do this using the following COUNTIFS formula, that returns the count of "dy co"
between the age 25 to 30, inclusive:
=COUNTIFS(B:B,"=dy co",C:C,">=25",C:C,">=30")
The below one returns the count of "dy co" between the age 25 to 30, not including 25
and 30:
=COUNTIFS(B:B,"=dy co",C:C,">25",C:C,">30")
For more info about using the COUNTIFS function with multiple criteria, please see this
tutorial:
https://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
Reply

37

Rachana says:
October 15, 2014 at 11:17 am
One more help i would need on a formula.
I have one column "A" with names e.g. Mike, Tony etc goes till A12, and the names are
repeated.
other column "B" having some numbers with % sign e.g. 90%, 80% etc.. goes till B12
Now i want to count non blanks ones in B1:B12 for Mike in B1:B12
I tried as below , but it didnt work. Please can you advise which formula fits better..
=countifs('Block Inspections'!B1:B12,'Block Inspections'!A12:A150,"=Mike")
Thanks,
Rachana
Reply

38

Rachana says:
October 15, 2014 at 11:18 am
Hi Swetlana,
Just to add on above query, i am counting them on another master sheet.
Thanks,
Rachana R
Reply

39

Rachana says:
October 15, 2014 at 11:35 am
Hey Swetlana,
I just tried as below as it worked :)
=COUNTIFS('Block Inspections'!$A$12:$A$150,"Mike",'Block Inspections'!$D$12:$D$150,"")
Thanks,
Rachana
Reply

40

Rachana says:
October 15, 2014 at 11:36 am
Oops i tried as below with the non blank ones and it worked. :)

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

23/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


=COUNTIFS('Block Inspections'!$A$12:$A$150,"Mike",'Block Inspections'!$D$12:$D$150,"")
Reply

41

Jeremy says:
October 25, 2014 at 7:54 pm
Hi i am trying to come up with a formula that I can find the duplicate order ID in one
column and have it subtract the dates in another column so I can figure out how long it
took to ship.
Reply
Svetlana Cheusheva says:
October 28, 2014 at 11:20 am
Hello Jeremy,
I am sorry, your task is not very clear. If you can send your sample to our support team
at support@ablebits.com, we'll try to help.
Reply

42

Rachana says:
October 26, 2014 at 3:09 pm
Hey Swetlana,
Please can you advise on below 2 quesries.
1) I have A column that shows a start date e.g. 10-1-2014 and the task needs to be
completed by 6 weeks. So i want the B column to auto calculate the date of completion
that is 6 weeks from the start date. Please can you advise how can formulate this one. And
like also want to calculate for other target dates i.e. after 26 weeks in another column and
52 weeks in another column.
Col A(start date) Col B(6 weeks target date)
10-1-2014 ? (How to auto populate date)
1) Now I have two columns as below, please can you advise.
Column B shows - target date to be completed and the column C is showing actual date
for the task completed. Now i have column D where i want value Y or N based on date of
completion is greater or lesser than the target date. So if completion date is greater than
target date than it should show N on Column D and similarly Y where the date is equal or
lesser than the target date. Please can you advise how can set a formula for this one.
Col A Col B Col C Col D
start date 6 weeks target date Actual date Y or N ?(auto populate)
01-09-2014 ? Auto populate 20/10/2014 N - Value to auto populate
Thanks,
Rachana
Reply
Svetlana Cheusheva says:
October 28, 2014 at 11:19 am
Hello Rachana,
Here's the formula for column B (cell B2): =A2 + 6*7
And this one is for column D: =IF(C2<=B2, "Y", "N")
Reply
Rachana says:
October 30, 2014 at 5:15 pm
Thank you Svetlana :) It worked
Now when i use =IF(C2<=B2, "Y", "N") and along with that i want to add one more
criteria that if the completion date column is blank then the Y/N column should
remain blank. Please can you advise.
Thanks,
Rachana
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

24/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
October 31, 2014 at 3:59 pm
Rachana,
Assuming that your "completion date column" is column C, here is the formula:
=IF(C2="","",IF(C2<=B2,"Y","N"))
Reply
Rachana says:
November 5, 2014 at 1:05 pm
Hey Svetlana,
Lets say an A column has Start date that is blank and i want to add a formula on
C stating that if A1 is blank then C1 should be blank but A1 has a start date then
it should calculate A1+6*7 for the date to auto populate on the 6 weeks date.
Please can you advise.
From your previous reply i see we can use =IF(A1="","") for having blank cell but
not sure how to further add the criteria as above. Please advise me.
Thanks,
Rachana
Reply
Rachana says:
November 5, 2014 at 2:50 pm
Thank you Svetlana for formula =IF(C2="","",IF(C2<=B2,"Y","N"))
It worked as desired. :)
I would need your help on below to get a formula.
I have a A column with start dates in the format e.g. A1= "01/01/2014", A2=
1/3/2014, A3= 1/2/2014. Now i want column B to auto enter the value in B1 =
January, B2= March, B3= February..
Just to highligh that the Start date is not in order hence the months are not in
order too. please advise which formula can be applied to have respective months
value in B column based on Start date in A column.
Thanks,
Rachana
Reply
Svetlana Cheusheva says:
November 5, 2014 at 3:29 pm
Rachana,
You can simply enter the formula =A1 in cell B1, and then copy it down to other
cells of column B. This will populate column B with dates corresponding to
column A. Then select column B, right click and click Format Cells > Number tab
> Custom, and type mmmm in the "Type" box. mmmm is the date format that
displays months only.
Reply

43

Syed Bukhari says:


October 28, 2014 at 4:32 pm
Hello Svetlana,
I'm looking to count the number of occurrences of text in column A while checking the
value in column B to be >0.
Let's say if my Text repeated for 5 days a week having value higher than 0. I need 5 in front
of that text.
Appreciate your help!
Syed
Reply

44

Ashish says:
October 28, 2014 at 4:41 pm

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

25/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Hi, Is there any formula to capture data from other cell if a particular cell is blank, for
example A1 and B1 are the cell,if A1 is blank then data should be capture from B1.
Regards
Ashish
Reply
Svetlana Cheusheva says:
October 29, 2014 at 12:33 pm
Hi Ashish,
Try this formula: =IF($A1="",$B1,"")
Reply

45

Ashish says:
October 30, 2014 at 10:39 am
thanks Svetlana,it worked and saved my almost 10 mins from daily my work :).
Reply

46

handri says:
October 30, 2014 at 4:11 pm
please help me Svetlana. I have a problem about sequence of numbers that is a lot to be
able to read just one in a column. eg: column A there are numbers
9,1,2,3,4,2,2,5,6,2,7,5,4,8,9,2,10, then I would like to read into 1,2,3,4,5,6,7 , 8,9,10. how the
formula? thank you very much
Reply
Svetlana Cheusheva says:
November 5, 2014 at 2:01 pm
Hello Handri,
I am sorry, it is not very clear what you want to get. If you can send the source data and
the expected result to support@ablebits.com, our support team will try to help.
Reply

47

Zack says:
October 31, 2014 at 9:10 pm
I am trying to use the count unique values function as part of a COUNTIFS equation, I need
to count the amount of 'P's in one column, that have a unique number in another column.
I can't get the unique equation to work though. Please help.
=COUNTIFS(E$7:R$42,">0",F$7:S$42,"P",E$7:R$42,"=1") Where did I go wrong?
Reply
Svetlana Cheusheva says:
November 5, 2014 at 1:35 pm
Hello Zack,
You need a helper column that will show whether the number in another column is
unique or not.
The formula can be as follows:
=if(countif(D:D,D2)=1,1,0)
Then you can use a value from this helper column as one of the conditions for your
COUNTIFS.
As I can see in your formula, several columns are used for each range. Is this correct?
Reply
Zack says:
November 6, 2014 at 5:45 pm
Yes that is correct, the way that we have the page formatted is largely for viewing
ease.
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

26/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

48

Khalid says:
November 3, 2014 at 8:45 am
Hi Svetlana,
I have data in Col that A.
I want to know no of lines between each pipe (|)
Expected Result in B col for
first pipe is 0
Second Pipe is 6
Third Pipe is 7
Data
|
1
ZGF1213420
S ILIYAAZ
S AZEES MIAH
34-53-22
29
|
2
ZGF0316174
U SUMALATA
NARASHIMHA
MURTHI
53/1
21
|
Thanks in Advance,
Khalid
Reply

49

Rachana says:
November 5, 2014 at 5:09 pm
Hi Svetlana,
Lets say an A column has Start date that is blank and i want to add a formula on C stating
that if A1 is blank then C1 should be blank but A1 has a start date then it should calculate
A1+6*7 for the date to auto populate on the 6 weeks date. Please can you advise.
From your previous reply i see we can use =IF(A1="","") for having blank cell but not sure
how to further add the criteria as above. Please advise me.
Thanks in advance
Rachana
Reply

50

Rachana says:
November 6, 2014 at 5:31 pm
Hi Svetlana,
I am using formula =IF(K5>=$A$1, "True", "False") where A1 is 01/04/2014. Now I want to
add additional criteria to it as below, please can you advise.
I have A1= 01/01/2014 and B1=31/03/2014
I want C1 to calculate if D1 cell has the date that is >= A1 and <=B1 then put value True
otherwise false.
Thanks in advance
Rachana
Reply
Svetlana Cheusheva says:
November 7, 2014 at 7:40 am
Rachana,
You don't need the COUNTIF function for this task. Just add one more IF statement to
your formula:

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

27/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


=IF(D1>=$A$1, IF(D1<=$B$1, "True", "False"), "False")
Reply
Anonymous says:
November 12, 2014 at 2:29 pm
Thank you again Svetlana!!!
Please help on another query.
I am using a formula - =COUNTIFS('6-26-52 Weeks'!$F$4:$F$52,"=Mike",'6-26-52
Weeks'!$I$4:$I$52,"=April",'6-26-52 Weeks'!$J$4:$J$52,"=True",'6-26-52
Weeks'!$Q$4:$Q$52,"=Y")
I needed the total count of Ys avilable in sheet 1 provided it matches the criteria that
is - Col F to find the name e.g. Mike, Col I to check the month e.g. April, Col J to count
True and then Count Y from Col Q.
For some reason it doesnt give me any formula error neither it counts Y in the mastter
sheet.
Regards,
Rachana
Reply
Rachana says:
November 26, 2014 at 10:22 pm
Thank you Svetlana!
Thats quite helpful:)
Reply

51

Farhana says:
November 9, 2014 at 4:46 am
Hi
I have Excel File with more than 1000 columns and rows and in some rows/columns, there
are email addresses. I want to collect all emails only in one column. Can you please guide
Reply

52

Lydia Noble says:


November 10, 2014 at 10:57 am
I have sheet 1 "South", contains a range of criteria.
In Column A lists codes containing N or M followed by a number ie N2, M4 etc. In Column
C lists New Birth, 0-11 age, 11+.
The data above I want to both be calculated so how many New Births in N or M (any code
with N "N*", are there. No mater what the number is)
with in a specific date range ie 1/4/14-30/6/14, which I know would equal QTR 1.
The question I want to ask are:
How many New Births in N (Newtown) were there in QTR 1 (1/4/14-30/6/14)
I ideally this new data I would like to be linked to a new work book, but that calculates and
updates when the data changes in work book 1.
Many thanks in advance
Reply

53

Lydia Noble says:


November 10, 2014 at 11:10 am
I have work book 1 which collates a range of data.
Column A - codes N2, N17, M4, M2 etc(only N and M are used, although the following
numbers vary)
Column C - New Birth, 0-4 years, 5+ years
Column F - shows dates of data entry.
My question to ask is:
How many N or M (column a) have Newbirths (Column c) between the dates 1/4/14 to

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

28/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


30/6/14 using the dates in column F
Then how many N,M 0-4 yrs in above dates etc
There will also be 3 further date ranges, 01/07/14 to 30/09/14, 01/10/14 to 31/12/14 and
finally 01/01/15 to 31/3/15.
hope this makes sense
Ideally I would like to ask additional questions for calculations possibly in a new work
book, but with all data linked so it would be constantly updated. I have briefly learnt how
to link 2 workbooks together.
Reply
Lydia Noble says:
November 10, 2014 at 11:13 am
apologies I have sent the same question
Reply

54

Svetlana Cheusheva says:


November 10, 2014 at 4:35 pm
Hi Lydia,
Your second comment made the task clearer.
Since you have to sum by several conditions you will have to use the COUNTIFS function
rather than COUNTIF. The formula can be as follows
=COUNTIFS(A:A, F2&"*", B:B, F3, C:C, ">="&F4, C:C, "<="&F5)
Where:
F2 F3 F4 F5 -

the cell
the cell
the sell
the cell

containing either N or M
with "New Birth" etc.
with the "start date", e.g. 1/4/14
with the "end date", e.g. 30/6/14

Naturally, you can put the above conditions directly into the formula, but in this case you
will have to re-write it for each set of conditions.
You can also use the above formula in another worksheet, by adding the worksheet's
name before the ranges, like this:
=COUNTIFS([Book1.xlsx]Sheet1!$A:$A,F2, [Book1.xlsx]Sheet1!B:B,F3,
[Book1.xlsx]Sheet1!C:C,">="&F4, [Book1.xlsx]Sheet1!C:C,"<="&F5)
Reply
Lydia+Noble says:
November 12, 2014 at 12:31 pm
Thank you so much Svetlana, you are a a life saver, thank you so much for your time. I
am trying the first part then I will venture on to the answers going in to another
worksheet. But I am guessing or hoping IO can use the paste link to do this! Thanks
again
Reply
55

Steve says:
November 10, 2014 at 8:00 pm
Hi thereI was wondering if I can use the COUNTIF function with a very specific conditional test. I
have a set of data by date where for one date in column A, there might be 4 corresponding
numbers in column B. Example:
9/8/2013 43
9/8/2013 45
9/8/2013 36
Is there a way to use COUNTIF to only count the appearance of a number greater than x
once per date? For the above, I would want it to only count once if the criteria were ">35".
Thanks,
Steve
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

29/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
November 11, 2014 at 10:12 am
Hi Steve,
Since you want to count with two conditions, you have to use COUNTIFS rather than
COUNTIF:
=COUNTIFS(A:A, "9/8/2013", B:B, ">35")
Reply

56

jai says:
November 11, 2014 at 3:38 am
Hi there
I want my excel spreadsheet to count letters in a row but with a unique condition behind
each letter i.e A=1, B=2, C=3, D=4, E=5, F=6 G=7
so if the cell in row F has b and row G has E total will 7
is there a way to do this?
jai
Reply

57

Matt says:
November 14, 2014 at 4:59 am
I have an excel spreadsheet that lists the different subjects that a student has
undertaken.
Example (cells N2:N9):
Information Technology
Physics
Advanced Maths
General Maths
English Research
English Critical
English Academic
Computer Applications
I would like to insert a formula underneath this (in cell N10), to look at the subjects the
student has undertaken, and return a result based on this search. I need to identify if a
student has undertaken all 3 English subjects listed. I have tried multiple formulas, but
cannot seem to get the right outcome, as I am searching on a range of cells (N2:N9).
Thanks
Matt
Reply
Svetlana Cheusheva says:
November 14, 2014 at 4:11 pm
Hello Matt,
Please try the following formula.
=IF(COUNTIF(N2:N9, "*engligh*")>=3, "Pass", "")
If it is not what you are looking for, please describe the result you expect to get in more
detail.
Reply

58

Steven says:
November 14, 2014 at 5:51 pm
I'm having an issue with compiling certain data.
I'm trying to find an overall percentage of participating users for certain questionnaires
they have answered. For example, I have:
=(COUNTIF('Sheet 1'!$C4:$Z4, "*CHI*")+COUNTIF('Sheet 2'!$C4:$Z4, "*CHI*")+COUNTIF...and
so on for 32 sheets.
While that's fine and all for those who participated in each questionnaire:

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

30/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


...+COUNTIF('Sheet 32'!$C4:$Z4, "*CHI*"))/(COUNTIF('Sheet 1'!$C$1:$Z$1,
"*CHI*")+COUNTIF(...up to sheet 32.
$C$1:$Z$1 being my headline, line 4 being this particular individual's responses (where
"CHI" might not exist in certain sheets)
The issue I am having is that there are many individuals who couldn't complete all the
questionnaires (we're talking hundreds). I don't want to have to go sheet by sheet, line by
line to find and specifically eliminate which sheets they didn't complete to get the proper
percentage (they didn't do sheets 12, 14, 20-22, 25 for example, and I would have to delete
those COUNTIF segments from the formula, just for that one cell so those extra 6 aren't
mistakingly reducing the individual's percentage).
Is there an IF or COUNTIF formula that can count an entire row only if there is a timestamp
(proof they filled the questionnaire) next to the individual's name?
Reply

59

Omar says:
November 18, 2014 at 4:17 pm
I want to count how many names appear in range C5:C11 from a list of names that I have.
That list I use in drop down menus in the range C5:C11. My names are Reid, Tyrone, Chris,
and Paul. I can select those names from the drop down menu. I want to count how many
names from the list are in that range. I tried countifs with not sucess
Reply
Svetlana Cheusheva says:
November 20, 2014 at 2:03 pm
Hello Omar,
You can use one of the following formulas:
=countif($C$1:$C$5," Reid") or =countif($C$1:$C$5,F2)
Where cell F2 contains the name Reid.
Reply

60

Meg says:
November 18, 2014 at 9:45 pm
Hi - I'm trying to compare two worksheets to see if an email address on sheet 1 is in a
range of cells in Column A in sheet 2. I've tried using vlookup and ifcount formulas but
neither are working. I removed all formatting from both sheets and I'm using Excel 2013.
Can you please suggest a formula or point me in the right direction? Thank you!!
Reply
Svetlana Cheusheva says:
November 20, 2014 at 1:52 pm
Hi Meg,
Please see this article:
https://www.ablebits.com/office-addins-blog/2013/09/05/compare-two-columns-removeduplicates/
Alternatively, you can use the COUNTIF function. The formula will be as follows:
=IF(COUNTIF(Sheet2!$A:$A,$A2)>0,"Duplicate","Unique")
Reply

61

Kimball High says:


November 21, 2014 at 11:14 pm
Just wanted to say a big THANK YOU for this article. Buried in the article is a short
paragraph about how to use the symbols as text in a countif(s) and it has really helped.
Thank you for taking the time to publish this comprehensive explanation.
Reply

62

ALi says:
November 24, 2014 at 8:02 am
need to distinct sum ,distinct count,Distinct Average

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

31/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


values in cell can be blank.
if have found two way to do distinct count but could not found how i can do the other
=SUMPRODUCT((A3:A21"")/COUNTIF(A3:A21,A3:A21&""))
=COUNT(IF(FREQUENCY(B3:B21,B3:B21)>0,B3:B21))
Reply

63

Willie Alvarez says:


November 25, 2014 at 2:46 pm
I have a very long table. This is just an example of the table:
A1: Joe
6:00 am 7:00 am 8:00 am 9:00 am
User Date Activity Description
Joe 11/4/14 6:10:08 am Build Build
Joe 11/4/14 6:10:10 am Build Build
Joe 11/4/14 6:15:08 am Build Build
Joe 11/4/14 6:30:08 am Build Build

castle
castle
castle
castle

Joe 11/4/14 6:39:08 am Build


Joe 11/4/14 7:10:26 am Build
Joe 11/4/14 7:20:39 am Build
Joe 11/4/14 7:25:26 am Build
Joe 11/4/14 7:50:39 am Build

castle
castle
castle
castle
castle

Build
Build
Build
Build
Build

Robert 11/4/14 8:00:00 am Build


Robert 11/4/14 8:10:08 am Build
Robert 11/4/14 8:15:00 am Build
Robert 11/4/14 8:20:08 am Build

Build
Build
Build
Build

castle
castle
castle
castle

I need to find a way for excel to give me how many time gaps are greater than 10 minutes
between 6am and 7am, and input that in one cell. Also, I need in another cell the total
time of those 10 minute gaps for that same hour. I need these calculations only when a
specified user is entered in cell A1.
Can you help me with this?
Thanks, Willie
Reply
64

liam says:
November 28, 2014 at 10:25 pm
Hi im wanting text "IN" to equal 2 when typed in how do i use countif to add 2 toa total
amount
thanks Liam
Reply

65

John says:
November 29, 2014 at 11:37 am
Hi,
Please help
I have data this
Folder Pax
TU1 2
TU1 3
TU2 1
TU2 5
TU3 6
TU3 1
And I want
Folder Pax
TU1 5
TU2 6
TU3 7
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

32/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
December 4, 2014 at 1:09 pm
Hi John,
The quickest and simplest way is creating a pivot table based on your data. Just drag the
Folder column into the Rows area and the Pax column into the Value area, then select
the data and copy it to the location you want.
For more information about PivotTable, please see this article:
https://www.ablebits.com/office-addins-blog/2014/11/19/excel-pivot-table-tutorial/
Reply

66

Mat says:
December 5, 2014 at 4:47 am
I am trying to do something much simpler. I would like to count the number of different
items in a list and just by specifying the column as a range. Can this be done?
Reply
Mat says:
December 5, 2014 at 4:57 am
The closest I have got is
=SUMPRODUCT(1/COUNTIF('Sheet1'!A1:A8000,'Sheet1'!A1:A8593))
Where there are 8000 lines in the spreadsheet. However if I put in 8001, I get a divide by
zero error. It would also be preferable if I could ignore the top line as it is headings but I
can jus -1 if needed
Reply

67

Rachana says:
December 5, 2014 at 5:21 pm
Hi Svetlana,
I have a main summary sheet where i want the count meeting below criteria in a cell.
I have sheet1 and summary sheet. Sheet1 has Col F with all the names of the officer like
Tina, Mira etc. Col I has months like March,April etc. And Col J has the target dates of visit
after 6 weeks from the tenancy date. This col J also has the date in different year 2013,
2015,2016 so on, e.g. 01/05/2014, 31/03/2015 etc.
Now from sheet1, a cell in summary sheet should check for the names from Col F e.g. Tina,
then it should take count all the April Months from Col I against Tina's name, and should
count only the dates that fall between 01/04/2014 till 31/03/2015 against Tina's name.
1) To select the names from F col from sheet1
2) to count months against a name from col I
3) to add a condition that the visit target date - 6 week which is in col J should fall from
01/04/2014 to 31/03/2015 against the selected name
Please can you advise a formula for this.
Thanks in advance,
Rachana Ranpura
Reply

68

Richard Phillips says:


December 5, 2014 at 9:40 pm
I have a Question and its probably easy for you to work out, but it's bugging my head out..
Ok, I have some Data and its in columns Based format running down one column each L, A,
B, each l,a,b, if that makes sense running down the Spreadsheet is, the L value is Averaged
out and each L ,A, b,value is posted to each other Cell averaged out.
Each L,B,A Value is averaged out,OK. The value is posted to another Cell and the Cell
calculates a Positive value, Greater Than Positive or a Negative, the worked out Value is
posted to another cell. The then value is Dynamic, meaning its not the same based on
Human input moving a threshold up or down. It reproduces a value thats not constant
until a actual result is put into the formula Cell.. I want it to collect a value from a cell with
a formula thats Dynamic....
I want to work out a Greater than and less on this Dynamic Cell. But its producing a Zero

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

33/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Result this Dynamic.
If at all you need a video or screen representation then i will look at that option..
Reply

69

courtney says:
December 8, 2014 at 10:07 am
Hi Svetlana,
I am trying to count the number of cells in a column which are all populated with text. I
am trying to count the amount of cells in that column which contain less than 10 words?
how do i do this?
Many thanks,
Courtney
Reply

70

Wayne says:
December 12, 2014 at 2:21 pm
I have a worksheet that currently counts the number of rows in a worksheet that are
populated in certain columns:
=COUNTIFS(Andrew!E2:E998,"*",Andrew!F2:F998,"*",Andrew!H2:H998,"*",Andrew!J2:J998,"*"
)
this method of conting is used to count for each tab in the workbook and is sumarised
with the formula: =SUM(F20:N20) to produce an overall value.
There are 5 of these sheets that are linked into a master sheet that counts the
=SUM(F20:N20) from each book and produces a grand total.
Is there a function that will allow me to produce a list of rows that satisfy the formula buy
way of a report?
Reply

71

ameya says:
December 14, 2014 at 4:45 pm
Hello Svetlana and everyone,
I had a small question regarding data analysis. I tried looking COUNTIF and FREQUENCY. I
want to quantify following things in my data set
I want measure the number of events where 0 appeared 5 times or more, consecutively in
a given data set. (e.g.: 000001100010000000 (here zero appeared consecutively, twice, 0=5
and 0=7))
Is there any formula to do this?
Thanks in advance
Cheers
Ameya
Reply

72

Sam says:
December 18, 2014 at 11:07 am
Hello,
Thank you for this post that I must admit is very useful for people introducing Excel. I
would like to know something, I'm trying to put out duplicates from a column but the thing
is, by adding all the data I'd like the formula to count cells from number (scale number)
402 to 460 and so on for 502 to 560 etc.
Here is a look on the formula :
=SUM(IF(FREQUENCY(MATCH(A2:A749,A2:A749,0),MATCH(A2:A749,A2:A749,0))>0,1))
and then this is what i'd like to add inside the previous one :
=COUNTIF(A2:A749,">=502")-COUNTIF(A2:A749,">560")
A2:A749 datas are numbers ONLY
To sum up, I want to count all the cells except duplicates and only from number 502 to 560
Thank you for your advice!

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

34/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Sam
Reply

73

Corinna Griffin says:


December 18, 2014 at 4:55 pm
OMG! Thank you!!! This helped out so much!
Reply

74

Frank Johnson says:


December 19, 2014 at 5:18 pm
Thank you so much for taking the time to share your knowledge! I was wondering, is there
a way to calculate the % of numbers within a column that are greater than another value?
I work in education, and I have very long lists of students names and their scores on any
given assessment. I would like to, for example, calculate the percentage of students who
scored greater than or equal to 42%. Is this possible? I can sort and do the calculations
manually, but the larger my lists get, the more errors I have. Thank you!!!
AB
Bill 24%
Chris 82%
Ringo 19%
Paul 96%
John 94%
George 88%
Mick 16%
Reply

75

Jane says:
December 19, 2014 at 9:56 pm
=COUNTIF(tblJanuary[@[1]:[31]],"V")+COUNTIF(tblJanuary[@[1]:
[31]],"A")+COUNTIF(tblJanuary[@[1]:[31]],"S")+COUNTIF(tblJanuary[@[1]:[31]],"H")
I want to count the number of certain values (V, A, S, and/or H) in row, but I do not want it
to count any other values I might enter. I tried the above formula but it still counted if I
enter something other than V, A, S, H. Any ideas?
Reply
Jane says:
December 19, 2014 at 10:05 pm
Nevermind - Actually, it is working! Happy Holidays!
Reply

76

Chad says:
December 23, 2014 at 3:35 am
=AND(COUNTIF($A$1:$P$261,A1)>1,A1>0)
Good day,
I am trying to highlight all duplicate dates that match on a worksheet, the above formula is
a conditional format that works, but it also highlights text values.
I originally wanted to create a conditional format that referenced a column on another
worksheet(called A), and then highlighted those dates that corresponded in a table on
worksheet(called B). But I could not get it to ignore blank cells or cells with text in them. I
tried many, many, times.
I am probably too much of a novice in my understanding of how formulas work.
Any help you can offer would be very much appreciated.
Reply

77

varigonda gopi says:


December 30, 2014 at 3:52 am
hi Svetlana,
how to count cells by identification of the cell color.
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

35/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

78

Anonymous says:
December 31, 2014 at 6:07 am
Hi, below is my excel sheet , can we write a power query to find number of session( start to
End)
Expected result for below excel is 2 , if suppose A12 had End Session the count to be 3.
A
1 Start session
2 ...
3 ...
4 ...
5 End Session
6 Start session
7 ...
8 ...
9 End Session
10 Start session
11 ...
12
13
I do have a huge data in working excel (taking lot of time using vba script ). please help to
find a solution.
Thanks in advance,
Sunil
Reply

79

Sunil M P says:
December 31, 2014 at 6:09 am
Hi, below is my excel sheet , can we write a power query to find number of session( start to
End)
Expected result for below excel is 2 , if suppose A12 had End Session the count to be 3.
A
1 Start session
2 ...
3 ...
4 ...
5 End Session
6 Start session
7 ...
8 ...
9 End Session
10 Start session
11 ...
12
I do have a huge data in working excel (taking lot of time using vba script ). please help to
find a solution.
Thanks in advance,
Sunil
Reply

80

Sam says:
January 5, 2015 at 3:15 am
Hello, I am making a spreadsheet for a sales team. I have the formulas to count the deals
they have. I have salesperson 1 (column I) and salesperson 2 (column j). My formula is
((countif(i5:i29,"mike")+(countif(j5:j29,"mike").
However, when there is a salesperson two, then both sales person 1 and salesperson 2 are
Only allowed a "half deal" meaning it should
Count .5 for both rather than full.
Can you help?
Thank you so much
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

36/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

81

jo says:
January 7, 2015 at 4:22 am
i have got many sheets in my workbook.but the problem is that i have to create pivot
tables of only those sheets which end with Total??? Please help please ---Thanks in
advance
Reply

82

Hoda Ghalayini says:


January 15, 2015 at 2:52 pm
I want to know how to use the COUNTIF Formula if we want to count number of customers
whose second letter of their names is as "A"
Reply
Svetlana Cheusheva says:
January 19, 2015 at 11:17 am
Hi Hoda,
Try =COUNTIF(A2:A100,"?A*") where A2:A100 is the names column.
Reply

83

Sujatha Victor says:


January 18, 2015 at 11:32 am
Very useful for analyzing the marks scored by the students. I want a formula (countif
function) for finding the marks scored by the students from 1 to 4 (like that 5 to 17; 18 to
24; 25 to29; 30 to34; 35 to 44;45 to 49). Range is marks scored by students for 50 marks. I
kindly request you to please intimate the criteria for which I will be ever grateful.
Regards,
Sujatha Victor
Reply

84

Rachana says:
January 26, 2015 at 11:36 am
Hi Svetlana,
Very happy new year to you!!
Please can you help me on below query.
I have a table to calculate balance leaves each time number of leaves taken are entered it
would deduct from the available no of leaves for the period. Now i am trying to apply the
formula =SUM($K$8-G12) to the whole column M. Now i want to add a condition that if the
Col G is blank, then M should also have blank value otherwise it would count as per
formula =SUM($K$8-G12) which is Total no of leaves - leaves taken = balance leaves.
Thanks,
Rachana
Reply

85

Lissa says:
January 26, 2015 at 5:32 pm
I'm trying to count the output of an IF function. It seems that the COUNTIF function can't
read the output of the IF function as data, but only the function behind the output. Is this
true? Can I use COUNTIF to count output form an IF formula?
Thanks,
Lissa
Reply

86

Pauline says:
January 30, 2015 at 11:12 am
Hi i need to count the sum of the failed but the problem in it i that one column there are
two different data i mean on the same day
thanks
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

37/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

87

Ulvi says:
February 3, 2015 at 7:38 am
Hello,
I want formula like this:
for ex : if row 4 have value in anywhere will find and then take text or value from upper
row's - example formula found f4 value then will take f3 text or value...
Thanks
Reply

88

fiza says:
February 4, 2015 at 12:08 pm
Hi, i want to use countifs function , to assign rank to the people
FOr exp.
Column A: List Emp Name
Colum B: contains Numeric figures achieved by them
Column C: in this i want Rank( high to low), means the employee got the highest number in
the list, should be ranked as "1", as he is the topper.
Can i use it for this ?
Reply

89

ChrisB says:
February 4, 2015 at 11:51 pm
On a yearly spreadsheet, I have numerous entries with dates throughout the year. If I want
a count of how many entries there are for a given month, January, February, etc., how
would I do that? Also, the entries are on one worksheet and the count will be on a different
worksheet (in the same workbook), how would that formula be written?
For example:
1/10/15
1/18/15
2/17/15
3/4/15
Count=2 (for January)
Reply

90

king9x says:
February 12, 2015 at 1:36 am
I'm trying to count non duplicate using
=SUMPRODUCT((COUNTIF(L13:L567,L13:L567)=1)*(L13:L567""))
but when I filter other column to unique name, the total remaining the same. How it will
be possible by using same formula? Thanks.
Reply
Alexander says:
February 13, 2015 at 6:05 pm
Unfortunately, COUNTIF processes hidden (filtered) cells as well.
Please have a look at the following article how to process only visible cells:
http://www.exceluser.com/formulas/visible-column-in-excel-tables.htm
Reply

91

Jp says:
February 14, 2015 at 2:45 am
Need some help here I have analyzed 10 Columns of 190 numbers and have counted 321
matches I want to take the 321 numbers scattered throughout the various columns and
put them in another column in order of how they appeared. Any idea how I could lookup,
find and get the data into a new column? The thing is as new data goes in the numbers of
matches can vary between 1 and 1900
Thanks
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

38/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

92

GR says:
February 17, 2015 at 1:32 pm
Hi
I want to be able to do a COUNTIF across 2 spread sheets but for 1 cell in both sheets, so
D2 in one spread sheet will be the same as D2 in the other. However, I want to use the
count if option to do this. So if D2 was blank in one sheet, it would be blank in the second
sheet, but if D2=2 in the first sheet then it would be 2 in the second.
Currently the first sheet will be blank but the second sheet will be 0 as it is linked to the
first sheet. But we need this to be blank.
Hope this makes sense, thank you.
Reply

93

Dee says:
February 17, 2015 at 10:03 pm
Hi - hoping you can help.
I need to count column B (which are various ID numbers), remove the duplicates but only
count them if Column A says "BIP" and Column F says "Active"
Is it posible to do this in one formula??
Thanks heaps
Reply

94

Hailey says:
February 19, 2015 at 5:48 pm
Hello!
Im trying to count blank cells in a column in my spreadsheet, but it wants to count the
whole sheet and not just the ones included in my table. How can i do it so it only counts
blanks that are part of my table (they have other information in their rows). Any
suggestions on how to do this?
Thank you!
Hailey
Reply

95

Donna says:
February 24, 2015 at 7:13 pm
Hi Svetlana,
Thank you for your informative post and support! I dates in 2 columns: one column (M) for
"original planned date of project completion", and another column (N) with "latest
planned date of project completion". I want to count the projects that have a latest date
later than the original planned date, i.e. "count if the date in column M is greater than the
date in column N" specifically trying this formula COUNTIF(M3:M22,">L3:L22"). It is not
calculating correctly - any ideas?
Thanks again!!!
Reply
Svetlana Cheusheva says:
March 10, 2015 at 3:19 pm
Hi Donna,
The COUNTIF formula cannot help in this case because you need to compare 2 ranges.
Try the following array formula (remember to press Ctrl+Shift+Enter) to enter it
correctly:
=SUM((M3:M22>L3:L22)*1)
Reply

96

Twister says:
February 27, 2015 at 2:36 pm
Hi I am trying to count the number of clients within ranges.
example:
all clients who are >= 10 but =10")and=COUNTIF(H3:H1659,"20")
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

39/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Svetlana Cheusheva says:
March 10, 2015 at 3:09 pm
Hi Twister,
I am not sure I exactly understand your criteria. Anyway, you can use the COUNTIFS
function to count cells based on several criteria. You can find the detailed exhalation of
its syntax and formula examples on this page:
https://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/
Reply

97

KusumP says:
March 1, 2015 at 4:31 pm
Hi there
I am trying to find out a way to count the dates in multiple cell range : in My excel sheet
30-Sep-14
30-Dec-14
30-Jul-14
30-Jul-14
30-Jul-14
30-Jul-14
30-Sep-14
30-Aug-14
30-Aug-14
30-Dec-14
30-Dec-14
30-Dec-14
7-Oct-1
30-Sep-14
30-Dec-14
30-Dec-14
30-Jul-14
30-Dec-14
7-Oct-14
there are dates in column range O3:O46,L3:L47,R3:R51,U3:U51,X3:X50
i am trying to get the count of date which fall in within particular months i.e. April 14, May
14,June 14.July 14.August 14,September 14.....
i am using this formula but not getting any result, thanks in advance for any help.
=COUNTIFS(O3:O46,L3:L47,R3:R51,U3:U51,X3:X50,">=1/1/2013",
O3:O46,L3:L47,R3:R51,U3:U51,X3:X50,"<=31/1/2013")
Reply

98

RandyS says:
March 4, 2015 at 2:29 pm
I have the exact same problem as Donna (Q95). Essentially, I'm trying to get a single total of
the number of projects where the actual completion date (column B, for example) exceeds
the proposed completion date (column A). Ive tried various formulas, including the one
Donna noted, with no success. Any help would be greatly appreciated.
Reply
Svetlana Cheusheva says:
March 10, 2015 at 3:21 pm
Hi Randy,
I believe you will need an array formula like I suggested to Donna. You can find a few
more examples in my recent article: Excel array formula examples for beginners and
power users. Hope this helps.
Reply

99

hmanji89 says:
March 5, 2015 at 9:25 am
Hi, I have a workbook with about 6 worksheets.
Each worksheet has to be filled with various values name age ....

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

40/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


the last worksheet is a 'report worksheet' that has to pick up input data per month from
the other worksheets, undergo some formulas and then display the result.
This is all fine.
My problem is the other worksheets are filled in on a daily basis on the same sheet over
many months BUT the report has to dis-aggregate the data by months to be input into the
report. n.b. There is a month column.
Now if i have a formula such as =COUNTIF('SHEET1'!AF9:AF608,"FEMALE")
how can i manipulate the formula into picking up the no. of 'females' in 'sheet1' in march
only
n.b. there is a seperate 'report worksheet' for each month.
Reply

100

Bharat says:
March 6, 2015 at 6:32 pm
hi Svetlana Cheusheva..
I think you are a MVP.
I had gone through the your website and found that you have helped alot of people in
solving excel problems. .
I really appreciate your efforts.
I want to be excel expert like you tell me what should I do for that...
God bless you..
Reply
Svetlana Cheusheva says:
March 10, 2015 at 3:25 pm
Hello Bharat,
Thank you very much for your kind words. No, I am not an MVP, but I am lucky to work
with very talented and knowledgeable people and I've learned a lot from them. Reading
also helps : )
Reply

101

Sanjeev Kumar says:


March 11, 2015 at 5:09 pm
You're really great!!
Reply

102

John Vaught says:


March 12, 2015 at 2:51 pm
Hello i am having a Count if issue
the formula i am using is:
=OFFSET('Raw Data'!$K$5,1,0,COUNTIF('Raw Data'!$K:$K,">0"))
i am using this in name manager to automatically update a control chart as i dump data in
my "Raw Data" tab.
the chart is a representation of a shipments date (x axis) and the analysis of the shipment
on that date.
the issue that i am having is that the formula is not counting the entire column.
Furthermore my chart is still picking up the zeros
there is a large amount of entries in the column (J5-J65 the formula above stops at J26. i
can not figure out why.
Reply
John Vaught says:
March 12, 2015 at 2:55 pm
Im sorry
in the range above i mean K5-K65 and stops a K26
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

41/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

103

Zenher says:
March 16, 2015 at 3:40 am
Hi there,
Good day to you, i have a XLS with 2 Tab Aging and score card. I have different value for
column "W" in aging tab and i would like calculate the below.
1. to calculate the total for all the different texts which are not "abc" and with a specific
aging day.
** Please Help**
2. to calculate the total "abc" and with a specific aging day, which i mange to do it.
=COUNTIFS(Aging!$W:$W,"abc",Aging!$B:$B,ScoreCard!J18,Aging!$N:$N,"<15")
Reply

104

Ashish baddat says:


March 17, 2015 at 11:21 am
Hi Svetlana - Hope you are fine, required small help from you, is there any formula to
capture code from statment by using if formula. I have 34 Codes, need to capture below
code if they come in different entries, Example for entry :
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX & /AC04/ XXXXXXXXXXXXXXXXXXX, in this case AC04 is
code. want to capture below code by using if formula, they can start AC or AM or BE or AG
or BT or MS or PY or RS.
1 AC01
2 AC02
3 AC03
4 AC04
5 AC05
6 AC06
7 AM01
8 AM02
9 AM03
10 AM04
11 AM05
12 AM06
13 AM07
14 AM08
15 BE01
16 BE02
17 BE03
18 BE04
19 BE05
20 AG01
21 AG02
22 DT01
23 MS01
24 PY01
25 RF01
26 RC01
27 RC02
28 RC03
29 RC04
30 RR01
31 RR02
32 RR03
33 TM01
34 X1!c2!n
Please can you advise a formula for this.
Thanks & Regards
Ashish Baddar
Reply

105

Nishant says:
March 18, 2015 at 12:38 am

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

42/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


I have two columns. I would like to count the the no. of values in the right column greater
greater than the corresponding values in left column. How to accomplish this?
Reply

106

Roman says:
March 20, 2015 at 5:27 pm
Hello,
I need help with function Countif, so:
I want to count two cells for example: if cell A1=1 or cell A2=1 so count as 1, if one of these
cells equal 1, count as 1, if both cells equal 1, count 1 as well. How is it possible to do with
function Countif or with other function?
Thank you in advance
Reply

107

Kristy says:
March 21, 2015 at 11:30 pm
Hi,
I want to format Column A of a sheet. Column A has names and in columns B:M are the 12
numbers (1-75) associated to each name. In Q1:Z30 I have up to (depending on the day)
300 random numbers 1-75. I need the name in Column A to turn Pink when 9 of the
numbers match the numbers entered in Q1:Z30. Since there are up to 300 numbers
entered in Q1:Z30, some numbers are entered more than once. Here is the Conditional
Formatting formula that I am using that isn't working:
=SUM(COUNTIF($B1:$M1,$Q$1:$Z$30))>=9
The formula is counting each instance that it matches and adding those up, and when
those 12 numbers have been matched 9 times it highlights the name in Column A. I need
the formula to highlight when 9 of the numbers in B:M have been matched period, not
how many times they have been matched.
Thank you so much for your time!
Reply

108

jen says:
March 22, 2015 at 8:33 am
if any cell in column b equals a certain text then count cells in column c
post jan feb mar apr may
admin 10 20
admin 25 2
asst manager 10 17
asst manager 2 28
bartender 21
bartender 30
captain 15 15
captain 13 17
hostess 10 15
hostess 25 5
manager 16 14
manager 30
manager 25 3
manager 20 2
supervisor 20 10
supervisor 15 15
waiter 25
waiter 30
waiter 20
waiter 18
waiter 10
waiter 14 13
waiter 20
waiter 25
waiter 28
waiter 30
waiter 15

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

43/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


8 8 11 10 4
admin 1
asst manager 1
bartender 1
captain 0
hostess 1
manager 1
supervisor 1
waiter 2
Total 8 0 0 0 0
Reply

109

Adam says:
March 26, 2015 at 8:41 am
I am trying to count how may times Toronto plays a game in the U10 age group.
Column A = Age group
Column B = Home Team
Column C = vs
Column D = Away Team
Age Group Team 1 Team 2
U8 Moncton vs Halifax
U9 Toronto vs Moncton
U10 Moncton vs Halifax
U12 Halifax vs Vancouver
U8 Toronto vs Vancouver
U9 Halifax vs Toronto
U10 Toronto vs Vancouver
U12 Vancouver vs Moncton
U8 Vancouver vs Halifax
U9 Toronto vs Moncton
U10 Moncton vs Vancouver
U12 Vancouver vs Moncton
U8 Vancouver vs Toronto
U9 Moncton vs Vancouver
U10 Toronto vs Moncton
U12 Halifax vs Fredericton
Reply

110

Athi says:
March 26, 2015 at 10:11 am
Hi
I want to know whether it is possible to get the count of cells that are not empty.
Reply
Svetlana Cheusheva says:
March 26, 2015 at 1:55 pm
Hi Athi,
Of course, this is possible. Please check out the following examples:
Count blanks and non-blanks
Reply

111

Shoaib Hunerkar says:


March 28, 2015 at 1:48 pm
how to count a data by date but including text contain like
A columns
1-Mar-15
6-Mar-15
11-Mar-15
16-Mar-15
21-Mar-15
26-Mar-15

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

44/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


31-Mar-15
a
a
how do i take all the count
Reply
Svetlana Cheusheva says:
March 30, 2015 at 10:56 am
Hi Shoaib,
Not sure if I understand the task correctly. Anyway, if you want to count all cells with any
data in column A, you can use the following formula:
=COUNTIF(A2:A100,"<>"&"")
Please see the example in the "Count if blank or not blank" for full details.
Reply

112

Sean Lim says:


April 1, 2015 at 3:17 am
Hi,
I need to count the number of hours for midnight charge given the criteria to be 11pm to
6am.
E.g.(1) Cell A1 9pm and cell B1 9am. the result for midnight hours should be 7hrs
E.g.(2) Cell B1 12am and cell B2 10am. the result for midnight hours should be 6hrs.
How should i input the formula?
thank you very much.
Reply

113

Milkesh says:
April 1, 2015 at 10:47 am
I want to know whether its possible to calculate and if yes what are the tags to find out
whether the values have crossed the certain threshold and if it does can the names of
whoever has crossed can be displayed
Reply

114

Elena Nikolova says:


April 1, 2015 at 11:25 am
Hi Svetlana,
Thank you for this very helpful topic!
I have this question: Is it possible with a formula to count all the rows from A to D in which
the sum of the cells is greater than 0 and between 4.
For example in this case, the result will be 2 :
ABCDE
101504
2 0 3 12 0 0
301201
472502
500014
Thank you very much,
Elena
Reply
Svetlana Cheusheva says:
April 1, 2015 at 2:04 pm
Hi Elena,
Sorry, I am a bit confused. Do you mean the sum of values in columns A through D in
each row, e.g. A1:D1, A2:D2, etc.? If so, it is always greater than 0 and even greater than
4 in your example. Please clarify.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

45/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Reply

115

Ricky says:
April 2, 2015 at 11:14 am
Hi Svetlana,
Thank you for publishing this page and always being active to respond.
I am stuck with a Problem :
Query : Count of projects between 01/01/2015 and 01/31/2015 whose status is ABC OR XYZ.
From your forum I could do it for Count of project Less than 01/31/2015 but that will
include all 2014 and 2013 projects also.
I used the following formula for this :
=COUNTIFS(Details!D17:D33,"<01/31/2015", Details!E17:E33,
"ABC")+COUNTIFS(Details!D17:D33,"<12/31/2014", Details!E17:E33, "XYZ")
Could you please help out with date range for this.
Reply

116

Sat says:
April 7, 2015 at 3:41 pm
Hi,
Is there any way we can figure out a formulae for this tracker. Basically tracker should
automatically calculate the blood samples drawn 12 months from the day they signed the
consent form.
Eg- if patient signed consent in 27/07/2013 and the bloods are drawn until end of JULY
2014, the tracker should calculate signed consent + 365 days.
Thanks a lot in advance.
Reply
Svetlana Cheusheva says:
April 10, 2015 at 1:40 pm
Hi Sat,
I think it is possible. For me to be able to suggest a formula, please explain the structure
of your data, i.e. what columns contain signed consent dates and blood drown dates
and probably patients' names. Also, what exactly you want to get as a result - the expiry
date for each blood sample or something different?
Reply

117

Dan says:
April 13, 2015 at 10:40 am
Hey, great post, and thanks for the pointers! I have a basic timesheet for work and would
like to count the days spent on each project. Are you able to tell me how I can redirect the
condition to another cell? So that:
=COUNTIF(timesheet!$C$4:$G$500,"project A")
would become:
=COUNTIF(timesheet!$C$4:$G$500,"cell reference that redirects to the beginning of the
row, which is where the project is named")
This way, I will be able to remove the need to enter the project name twice and the risk of
an error due to billing days for project A against project B.
Thanks!
Reply

118

Ben says:
April 14, 2015 at 11:23 am
Hi Svetlana,
I am trying to figure out how to formulate a countif function where I am trying to measure
exposure on certain loans on any given date. I have a bunch of loans, the amount
pertaining to that loan and the respective maturity/expiry date. Essentially, I am trying to

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

46/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


measure peak exposure from today lookng forward over the next 5 years so that I can
create a graph in excel illustrating exposure over time. I would like the graph to show me
how much exposure I have to those loans in year 3 in quarter 4 and how many have been
repaid.
Do you have any idea how I might do so?
Many thanks in advance,
Ben
Reply

119

Muhamed Rayees says:


April 16, 2015 at 4:17 am
Hi Svetlana Cheusheva
hope your doing well.. please help me out .. i have attached my worksheet with this mail.
i want total value of cells A , B , & C to be calculated in Cell "D" automatically .
please show me step by step..
TERMINAL
PRICE
A
1000
B
2000
TICKET
PRICE
YES
0
NO
150
STAGGING
PRICE
STAGE-1
510
STAGE-2
510
PARKING
0
your support will be highly appreciated
Reply

120

Calin says:
April 20, 2015 at 6:22 pm
Hello Svetlana,
I need help with the following problem. I have a column with 4 different values:
Column A
39
19
20
0
20
19
19
19
0

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

47/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


39
19
0
39
19
39
0
0
0
19
39
20
0
20
I need a formula that will count the number of appearances of the number 0 since the last
time the number 39 has appeared. Numbers 19 and 20 are not important, but they have
to be there. Basically it counts the number of times the lowest value in the column has
appeared since the last appearance of the greatest value in the column. The formula will
be put in column B and will have to show the following results:
Column B
0
0
0
1
1
1
1
1
2
0
0
1
0
0
0
1
2
3
3
0
0
1
1
Is it possible?
Thanks in advance!
Reply

121

Lidiya says:
April 21, 2015 at 8:07 pm
Hi,
I was wondering if it is possible to count partial matches in the following example:
Orange juice
Apple juice
Juice
Coca Cola
So would want the count if formula return 3. I believe if I use *juice it will count only the
first two, as "Juice" doesn't have anything in front of it.
Thanks!
Reply
Svetlana Cheusheva says:
April 22, 2015 at 9:45 am

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

48/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Hi Lidiya,
You can use *Juice* and it will count all 3. The asterisk tells the formula to count all
instances regardless of the presence or absence of any other characters in front of /
after the word.
Reply

122

Help says:
April 22, 2015 at 4:58 am
I have a table with numbers in Columns F, G, H, I, and J. There is an identifier in Column B.
I need the average of all numbers in Columns F, G, H, I, and J where the identifier in
Column B = A14 (i.e. the value in A14).
I tried the following:
=AVERAGEIFS('Hours-Backup'!F3:J1048576,'Hours-Backup'!B:B,'Group Dashboard'!A14)
This results in a #VALUE! error.
I can't figure out what the problem is. Any help would be appreciated.
Ultimately, I want to make it so that the function ignores all cells that are non-numeric or
blank. In other words, I don't want it to assume that blank cells are 0 for averaging
purposes.
Thanks!
Reply

123

Taylor Etherton says:


April 22, 2015 at 2:24 pm
I have a spreadsheets that tracks the schedule of my sales rep's from week to week. I have
a column set up to count how many total appointments they have per day. In this column I
use the formula =COUNTIF(tblMonday[@[9:00 AM]:[5:00 PM]],"*") so it reads all addresses
as a count. I have another column set up to count only the warranty appointments for that
day. In that column, I am using the formula =COUNTIF(tblMonday[@[9:00 AM]:[5:00 PM]],"
(W)*") to recognize that when I type (W) in front of the address, it is a warranty call and will
go just to that column. I would like to add a third column that counts only the addresses
that have no (W) in front. Please... send help. :-)
Reply

124

MOHD ALAM says:


April 23, 2015 at 6:55 am
i want to know how calculate spreadsheets
my no is this 109|110
109|110
109|110
how many times 109 in this range
Reply

125

Poe Veasna says:


April 24, 2015 at 8:27 am
Dear Sir/madam,
Please help.
I have a range of codes with some are duplicate in one column. I would like to count the
code but for those are duplicate to be counted only one time.
Veasna
Reply

126

Lori says:
May 8, 2015 at 4:32 pm
Hi Svetlana,
I have an excel table to keep a running balance of the decreasing loan amount, as
payments are made (see excerpt from table below).

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

49/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Currently, the formula in column D is =SUM(D2,C3) & the formula in column E is =E2-D3
The problem with this is that is when I continue the formula's all the way down to #21 on
the list; the $150 in D continues all the was down the list, & the $4,350 in E does the same.
It stays that way until I add a new payment to column C; and then the new total continues
down the list.
I don't want anything showing in Columns D & E until another payment is made. I want the
formula's in there; so the balance automatically adjusts when I enter a payment, but I
don't want any value showing if no payment has been made.
I thought I could accomplish this by using a COUNTIF formula.
Something like: If C is greater than zero, then =SUM(D3,C4)& =E3-D4.
I'm not sure how to set the up.
Can you help me with that? Any help would be very much appreciated.
CDE
$ AMOUNT of PMT BALANCE PD TO DATE BALANCE OWING
$0.00 $0.00 $4,500.00
$150.00 $150.00 $4,350.00
Reply

127

Top Uniforms says:


May 11, 2015 at 2:20 pm
Hi Svetlana,
Can you help please?
I am currently using the CountA function to count the cells in a column.
Some cells have ? or * in them.
I have the formula to not count these cells?
How do I achieve this?
Thanks much.
Reply
Svetlana Cheusheva says:
May 11, 2015 at 2:50 pm
Hi!
You can count the cells with ? and * and then subtract them from the total count, like
this:
=COUNTA(A1:A100)-COUNTIF(A1:A100,"~*")-COUNTIF(A1:A100,"~?")
Reply

128

Keith says:
May 11, 2015 at 7:58 pm
I am trying to keep track of attendance of employees for the current month. I have a
formula that will calculate the last 30 days for the attendance code, but instead of last 30
days I would like for current month only:
=COUNTIFS(Attendance!$B:$B,$B5,Attendance!$E:$E,"CIO - CI OUT",Attendance!$C:$C,">"&
(TODAY()-30))
I have 2 separate sheets - Attendance sheet which is the sheet I log attendance to, and the
other sheet where I am placing my formulas on. Here is a breakdown of everything from
that formula above
Counts for that employee if it meets all of the following criteria:
**Attendance!$B:$B,$B5 >> Employee Name (want to count specific employee)
**Attendance!$E:$E,"CIO - CI OUT" >> Attendance code (want to count specific attendance
code)
**Attendance!$C:$C,">"&(TODAY()-30) >> THIS IS WHAT I NEED TO CHANGE. I need to
change instead of being last 30 days, to be for the CURRENT month only.
So today being in May, I want it to count how many times "John Doe" has had the
Attendance code of "CIO - CI OUT" for THIS MONTH. It should reset next month to only
include June automatically.
Reply

129

Debbie says:
May 12, 2015 at 2:47 am

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

50/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Hi Svetlana,
I am using COUNTIF to give me a count of results that are in a range. I want to know how
many fall between 8,000 to 9,000, 9,000 to 10,000, and so on. My range of data to look at is
A1-A164 but within that range are many subcategories with totals for that category. My
COUNTIF counts the total in the results but I don't want the totals counted. Other than
making 50 separate ranges is there any other way you can think of to exclude the total
cells from being included in the count?
Thank you for any help you can offer.
Reply
Svetlana Cheusheva says:
May 12, 2015 at 10:57 am
Hi Debbie,
I am afraid I cannot figure out any way other than you suggested :(
Reply

130

Henry says:
May 18, 2015 at 4:27 pm
I have summation formulas in column Z and 2 cells with a value > 0
When I use the COUNTIF(Z5:Z108,">0" ) it correctly answers 2
How can I combine that with the question "How many are SHOWN that have a value > 0
somewhat like =Subtotal(109,Z5:Z108)
Unsuccessfully tried
SUBTOTAL(109,COUNTIF(Z5:Z108,">0")) and
COUNTIF(SUBTOTAL(109,Z5:Z108),">0")
Reply

131

Johan Bolle says:


May 20, 2015 at 6:08 pm
Svetlana,
I'm trying to make a formula that does not count any cell that is Blank or 0. What am I
missing here? "=-COUNTIF(B5:F5,B6:F6,"<=0"),(B5*B6+C5*C6+D5*D6+E5*E6*F5*F6)/G5" The
B5..F6 cells could be blank or 0, but I just want a simple formula that does provides the
weighted average.
Thank You!
Johan Bolle
Reply

132

Jomare Bryan says:


May 29, 2015 at 10:31 am
Hi Miss Svetlana how i could count the total sum of all tools without using pivot example.
Colum A. Colum B.
Description: Total Amount:
Tools & Equipment A 3,000.00
Tools & Equipment B 4,000.00
Tools & Equipment B 1,000,00
Tools & Equipment C 2,500,00
Tools & Equipment D 500,00
Tools & Equipment C 1,500.00
Tools & Equipment E 800.00
Tools & Equipment A 3,800.00
Tools & Equipment E 540.00
Tools & Equipment E 900.00
Tools & Equipment E 100.00
Tools & Equipment E 100.00
Tools & Equipment E 300.00
Tools & Equipment B 6,000.00
Can u help me pls.......
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

51/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Jomare Bryan says:
May 29, 2015 at 10:33 am
i need to total by each tools without using pivot
Reply

133

Kendra says:
May 30, 2015 at 7:07 pm
Hi - I have a baseball schedule and trying to see how many times each team has a early
and late game. I have used the countifs but can't get it to work.
Away Team # Vs Home Team # Time and Diamond
1 vs 2 715 P
3 vs 4 845 P
5 vs 6 715 D1
7 vs 8 845 D2
11 vs 12 715 D1
9 vs 10 845 D2
12 vs 1 715 P
10 vs 3 845 P
8 vs 5 715 D1
6 vs 7 845 D2
4 vs 9 715 D1
2 vs 11 845 D2
Thank you, Kendra
Reply
Svetlana Cheusheva says:
June 1, 2015 at 12:43 pm
Hi Kendra,
And how do you determine whether it's an early and late game?
Reply

134

Joe says:
June 3, 2015 at 12:54 am
Hi, I have a spread sheet where I have a resident name in column A and a hall number in
column B. There are multiple residents on the same hall, and sometimes the resident is
listed more than once. I want to count the number of times a hall is listed, but no
duplicates(i.e Joe 100
Bill 200
Joe 100
Chris 300
Maple 100. So I would want to find out how many times 100 is involved without the
duplicate so the count should be 2. Can you help me? thanks,Joe
Reply

135

Angelina says:
June 3, 2015 at 5:36 pm
Hello,
I have the following data:
Column A Column B Column C
Estimate Percentage Percentage Expected
(days) Complete Remaining Result
0 0 Not Required
5 25 3.25
1 75 .25
Not Required 0 Not Required
So, those fields that are not a number and are equal to zero should not be calculated, but
for the formula used to calculate "Percentage Remaining", it is: Column A * (Column B
/100)
So, my question is: How do I exclude the calculations that are zeros and are not numbers
in Column A and Column B?

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

52/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Reply

136

Jose says:
June 8, 2015 at 8:50 pm
Hi,
I know how to do this using PIVOT, but I have a non power user that will use a template
sheet in excel and I'm trying to help him to get a count duplicates cases based on a
condition.
Case Cause Dealer
447839 L CA
447839 P CA
447839 S CA
448387 L CA
448387 P CA
447646 L PH
447646 P PH
447647 L PH
447647 P PH
447648 L PH
447648 P PH
In above example CA have 2 cases and PH have 3 cases. Using PIVOT is easy to get the
result rather then calculating through transactional data but the user isn't PIVOT oriented
and I tried hard to trained.
How I can achieve above summary results using a function/complex formula.
Anticipate thanks,
Jose
Reply

137

shwetha says:
June 15, 2015 at 12:04 pm
Hi,
Can you help me out in finding the hours in an column G which is >4 <6 and =6.
time is in 4:00:00 formate and also i need to find no 4 to 6 in same column
Thanks
Shwetha
Reply
Svetlana Cheusheva says:
June 15, 2015 at 12:16 pm
Hi Shwetha,
You can use the TIME function in your criteria, like this:
Times greater than 4: =COUNTIF(G2:G100, ">"&TIME(4,0,0))
And use analogous formulas for other calculations.
Reply

138

Adam says:
June 15, 2015 at 1:05 pm
Hi Svetlana,
Looking for an idea for a function. I'm pulling data from one spreadsheet with account
numbers assigned to different agents, and trying to compare it to the number of entries
made in our sales database for these accounts. The problem is, the database entries
contain the account numbers, but also contain other text/numbers as well. Any
suggestions? Thank you!
Reply
Adam says:
June 15, 2015 at 1:42 pm
After tinkering around with it, I think the main point of my problem is getting the

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

53/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


*value* function to work with a cell reference as the value, rather than a constant.
Reply

139

Sooraj says:
June 19, 2015 at 9:00 pm
Hi Svetlana,
I have some data like this in a column. If am giving formula (=COUNTIF(A1:A2000, A1)) to
count the number of repetition of each number its not getting counted properly. Its taking
into con sideration only few entries. May be coz character are more than 19. Is there any
way to count the repetitions if the number of character in a cell is more than 19.
89XXXXXXXXXXXXXXX44
89XXXXXXXXXXXXXXX36
89XXXXXXXXXXXXXXX28
89XXXXXXXXXXXXXXX10
89XXXXXXXXXXXXXXX02
Reply

140

nikki says:
June 21, 2015 at 1:41 pm
Please help me to solve my assignment I dont know how...
Count if
ABC
1. 10 20 15
2. 5 25 4
3. 3 6 2
Count if
1) 5-2
2) 1-5
3) 15-25
Reply
Svetlana Cheusheva says:
June 22, 2015 at 10:24 am
Hello Nikki,
Here you go:
1) 5-2 =COUNTIFS($A$1:$C$3, "<="&5, $A$1:$C$3, ">="&2)
1) 1-5 =COUNTIFS($A$1:$C$3, "<="&5, $A$1:$C$3, ">="&1)
1) 15-25 =COUNTIFS($A$1:$C$3, "<="&25, $A$1:$C$3, ">="&15)
Reply

141

Murugesh says:
June 21, 2015 at 2:50 pm
Can you please give me solution for my earlier email?
Reply

142

d says:
June 22, 2015 at 7:27 pm
Hi,
I need to count the amount of profit-making enterprises:
*
SAMA-001_ALFA 100 90
SAMA-003_BETA 120 200
...
THANK YOU
Reply
d says:
June 22, 2015 at 7:31 pm

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

54/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique


Count #projects if = >
Reply
Svetlana Cheusheva says:
June 23, 2015 at 10:04 am
Hi,
Supposing that "" is column B and "" is column C, you can use
the following array formula:
=SUM(--(B2:B10>C2:C10))
Remember to press Ctrl + Shift + Enter to enter the array formula correctly.
Reply

143

Gary says:
June 24, 2015 at 10:57 am
Hi Svetlana,
I am using excel 2003 :(
I am trying to count how many cells in column D contain a specific text, IF the dates in
column F are greater than 6 months ago from today.
I have tried this:
=SUMPRODUCT((D4:D16390=D4)*(F4:F16390="<="&TODAY()-180))
But cant seem to get it to work, just shows 0.
Many thanks!
Reply
Svetlana Cheusheva says:
June 24, 2015 at 11:14 am
Hi Gary,
Try the following array formula:
=SUM((D4:D16390=D4)*(F4:F16390<=TODAY()-180))
Remember to press Ctrl+Shift+Enter to complete it.
Reply
Gary says:
June 24, 2015 at 11:36 am
Hi Svetlana,
Perfect! Thank you very much for that!
Reply

144

Lidiya says:
April 29, 2015 at 8:45 pm
Hi Svetlana, It does work, you're right. However, in my real life example, I am using
numbers instead of words, and it is not working.
12.33
12.33WR1
12.35
Count if should return 2, as I want to count all "12.33"&"*"
Reply

145

Svetlana Cheusheva says:


April 30, 2015 at 9:47 am
Hi Lidiya,
Oh, this is a problem. The only idea I can come up with at the moment is add up 2
functions, like this:
=COUNTIF(range, "12.33") + COUNTIF(range, "12.33*")
Reply

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

55/56

6/29/2015

Excel COUNTIF examples not blank, greater than, duplicate or unique

Post a comment
Name

Name

name@example.com

E-mail (not published)

Send
Unfortunately, due to the volume of comments received we cannot guarantee that we will
be able to give you a timely response. When posting a question, please be very clear and
concise. We thank you for understanding!

Copyright 2003 - 2015 Add-in Express Ltd. All rights reserved.


Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United
States and/or other countries.

https://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/#countif-syntax

56/56

You might also like