Excel do not count if duplicate

Data analysis usually involves large data sets, and at some point, one may need to find out the number of values that appear only once in the dataset. In this case, you will be counting without duplicates. Unique values are values that appear only once in a dataset.

If you are faced with mountains of data, then counting without duplicates might be very arduous. More so, Excel does not have a special formula for counting without duplicates. However, there is always a way out! This tutorial will serve as a guide on how to count unique and distinct values without duplicating them.

Take a look at the numbers in the table above; the unique values are not duplicated. They don’t appear more than once. Whereas, distinct values are the different numbers in the collection. In the table below, we have separated the unique values from distinct values.

1. Using the array COUNTIF formula

The COUNTIF function counts the frequency of occurrence of each value within the range. To get the number of the unique values, you have to sum them up. You can do this efficiently by combining SUM and COUNTIF functions. A combo of two functions can count unique values without duplication.

Below is the syntax:

=SUM(IF(COUNTIF(data, data)=1,1,0)).

The formula contains three separate functions – SUM, IF, and COUNTIF.

COUNTIF function» counts how many times a particular number appears within the range.

«IF function» analysis the results returned by the «COUNTIF» function. It maintains the 1’s for unique values and replaces other values with «0.»

Note: Always press Ctrl + Shift + Enter when entering your array formula.

CTRL+SHIFT+ENTER allow excel to recognize the formula as an array function.  unique value= =SUM(IF(COUNTIF(A2:A10, A2:A10)=1,1,0))

Alternatively, you can use the SUMPRODUCT formula to avoid the use of CTRL+SHIFT+ENTER.

Below is the syntax:

=SUMPRODUCT(1/COUNTIF(range, criteria)).

In the example below, we have a list of items with duplicates.

If we use the SUM formula to count the total number of items, there will be duplicates. To exclude the duplicates, you have to follow these steps.

Step 1: Go to cell D1 and enter this formula “=SUMPRODUCT(1/COUNTIF( B1:B11,B1:B11)). B1:B11 is the array range you want to count the total number of unique values in the list.

Step 2: Press enter and the results will be displayed in cell D1. From the displayed results (6) we can see there are no duplicates.

The above formula counts the values of the six items A/B/C/D/E/F.  

2. Using a combination of SUM, IF, FREQUENCY, MATCH, and ROW Function

If we want to count unique values that exclude all duplicates (that appear in more than one product), use the combination of these functions.

  • The sum function allows you to add the values.
  • For each true condition of IF function, assign value 1.
  • The FREQUENCY function allows you to count the number of values ignoring texts and zeros. In the first occurrence of the distinct value, it returns an equal number to the number of occurrences of that value. It returns zero for the occurrences that have the same value after the first occurrence.
  • The MATCH function returns the position of the text value in an array range. The return value acts as the function argument for FREQUENCY.
  • The ROW function returns the row reference number. 

Example: Enter the following formula to count unique values by excluding all duplicates

=SUM(IF(FREQUENCY(MATCH(B1:B11,B1:B11,0),ROW(B1:B11)-ROW(B1)+1)=1,1))

Press enter. The unique value is 3 (Item D/E/F).

3. Using ISNUMBER Function to count numeric numbers

The function we used earlier counts, both texts and numbers, without duplicating. To count only numerals without duplicating, you have to include ISNUMBER function in the formula for finding unique values.

=SUM(IF(ISNUMBER(A2:A10)*COUNTIF(A2:A10,A2:A10)=1,1,0))

Note: Always press Ctrl + Shift + Enter when entering your array formula.

Meanwhile, the lowdown in this function is that it also counts dates and times.

4. Using ISTEXT Function to count text values

You can count the number of texts without duplicating by including the ISTEXT function in the array formula as stated below:

=SUM(IF(ISTEXT(A2:A10)*COUNTIF(A2:A10,A2:A10)=1,1,0))

This formula will display the number of unique texts. It excludes errors, blank cells, logical numbers, numbers, etc.

Always press Ctrl + Shift + Enter when entering your array formula.

5. Using Pivot Table to count text values

Easies way to count the value is by creating the pivot table and using the Count of items

1. Create a pivot table

2. Use Count of Items

3. Output Table

6. Using A Filter

The Filter method is the simplest approach that allows you to remove duplicates and remain with unique values. You can, therefore, use two tricks to get unique values as discussed below.

6.1: Filtering for Unique Values

Steps:

1. Select and make sure the range of cells you want to make unique is in a table.

2. Click on Data then select the Advanced option in the soft & filter group.

3. When the Advanced Filter box pops up, you can filter the range of cells or tables by clicking on the Filer the List, in-place option.

4. You can also copy the result of the filter to another location by clicking on the Copy to another location option.

5. Enter a cell reference in the Copy To box.

6. Alternatively, you can click the Collapse Dialog option to hide the popup window temporarily, select a cell on the worksheet, and then click the Expand option.

7. Finish by checking the Unique Records Only and click OK.

6.2: Removing The Duplicates

The method only affects the values in the range of cells or tables and not values outside. After removing the duplicates, you will keep the first occurrence of the value in the list, while the identical values will be deleted. Therefore, remember to copy the original range of cells to the table to another worksheet before deleting duplicates.

Steps:

1. Start by selecting the active range of cells in a table.

2. Select the Data Tab and click Remove Duplicates in the Data Tools group.

3. You can select one or more columns under the Columns face. Alternatively, you can click Select All to select all columns quickly or Unselect All to clear all columns quickly.

4. Click OK and a message will pop up showing how many duplicates you have removed or how many unique values remain. To dismiss the message, click OK.

5. You can undo the change by clicking Undo or pressing Ctrl + Z

7. Using Amazing Excel Tools

Another simple way to count without duplicates in excel is tools like Kutools by the following steps.

1. Select a blank cell to output the result.

2. Click Kutools>Formula>Helper>Formula Helper.

3. Do the following steps in the formula helper dialog;

  • Check and select Count unique values in the Choose a formula box. You can check the filter box and type some words to filter the formula names.
  • Then choose the range in which you want to count unique values in the range box.
  • Press the OK button.

8. Using A Data Model with A Pivot Table to Count Unique Values

The method applies to newer versions of Microsoft Excel, including Microsoft 365, Excel 2019, Excel 2016, and Excel 2013. To count unique values using this approach, follow these steps:

1. Select any cell in the data and click on the Insert tab in the ribbon.

2. Click on Pivot Table to open a dialogue box.

3. Select the Add this data to the Data Model at the bottom and click OK.

4. In the resulting window, drag the Name column into the Name field and the Profession column or any other in the dataset into the Values field.  

5. Click on the small arrow next to the Count of Profession option in the Pivot Table fields.

6. Select the Value Field Settings at the bottom.

7. Finish by selecting the Distinct Count or Unique Count option and click OK.

8. You will have your unique values in the Pivot Table.

9. Using Power Pivot

Power Pivot is also another powerful method you can use to count unique values. However, you will need an enabled Power Pivot tab in your ribbon. That means if your Excel version does not have an already-enabled Power Pivot add-in, you will have to enable it first. Once you have enabled it, you can proceed with the following steps:

1. Go to the Data Model and select the Manage Button.

2. This will open a new blank window if it is your first time importing data.

3. Click on Home Tab and select the “Get External Data” option.

4. You will see various sources and options to upload data. Since you want to upload simple Excel, select the «From Other Sources» option.

5. Scroll down to the end of a new dialogue box opened, select “Excel File”, and click Next.

6. You will need to rename the connection created. For simplicity, you can rename it “Excel”. After that, click on “Browse” to choose an Excel file path.

7. You can click on the “Use the first row as column header” option to make the top column the header. Click on the Next Button to finish.

8. You will see the file imported to the Data Model. Click the Finish button.

9. After importing all the rows successfully, hit the Close Button.

10. With your new worksheet, you will have to create a Pivot Table by clicking on Home and then Pivot Table.

11. Click on the small triangle next to it to expand the columns. That is because you already have the data on the first sheet.

12. After dragging and dropping all the data in their respective fields, you will get a simple Pivot Table.

13. Go back to the Power Pivot window and select the Measure option to create a New Measure.

14. Add your desired description name by typing in the box and the suggestions will pop up automatically. Since you want to count unique values, select the Unique Count function.

15. Press the Tab button or use the bracket to select which column you need the unique count for. For example, if you want the unique count for Profession, your formula will be like this;

=DISTINCTCOUNT (Sheet1[Profession]))

16. Select the Number category since you want to count unique values.

17. Change the format to “Whole Number’ and hit OK to create a new column with unique entries.

I hope this tutorial is comprehensive. Kindly share with friends & thanks for reading!

Filter for unique values or remove duplicate values

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

In Excel, there are several ways to filter for unique values—or remove duplicate values:

  • To filter for unique values, click Data > Sort & Filter > Advanced.
    The Sort & Filter group on the Data tab

  • To remove duplicate values, click Data > Data Tools > Remove Duplicates.
    Remove Duplicates

  • To highlight unique or duplicate values, use the Conditional Formatting command in the Style group on the Home tab.

Filtering for unique values and removing duplicate values are two similar tasks, since the objective is to present a list of unique values. There is a critical difference, however: When you filter for unique values, the duplicate values are only hidden temporarily. However, removing duplicate values means that you are permanently deleting duplicate values.

A duplicate value is one in which all values in at least one row are identical to all of the values in another row. A comparison of duplicate values depends on the what appears in the cell—not the underlying value stored in the cell. For example, if you have the same date value in different cells, one formatted as «3/8/2006» and the other as «Mar 8, 2006», the values are unique.

Check before removing duplicates: Before removing duplicate values, it’s a good idea to first try to filter on—or conditionally format on—unique values to confirm that you achieve the results you expect.

Follow these steps:

  1. Select the range of cells, or ensure that the active cell is in a table.

  2. Click Data > Advanced (in the Sort & Filter group).

    The Sort & Filter group on the Data tab

  3. In the Advanced Filter popup box, do one of the following:

To filter the range of cells or table in place:

  • Click Filter the list, in-place.

To copy the results of the filter to another location:

  • Click Copy to another location.

  • In the Copy to box, enter a cell reference.

  • Alternatively, click Collapse Dialog Button image to temporarily hide the popup window, select a cell on the worksheet, and then click Expand Button image .

  • Check the Unique records only, then click OK.

The unique values from the range will copy to the new location.

When you remove duplicate values, the only effect is on the values in the range of cells or table. Other values outside the range of cells or table will not change or move.  When duplicates are removed, the first occurrence of the value in the list is kept, but other identical values are deleted. 

Because you are permanently deleting data, it’s a good idea to copy the original range of cells or table to another worksheet or workbook before removing duplicate values.

Follow these steps:

  1. Select the range of cells, or ensure that the active cell is in a table.

  2. On the Data tab, click Remove Duplicates (in the Data Tools group).

    Remove Duplicates

  3. Do one or more of the following:

    • Under Columns, select one or more columns.

    • To quickly select all columns, click Select All.

    • To quickly clear all columns, click Unselect All.

      If the range of cells or table contains many columns and you want to only select a few columns, you may find it easier to click Unselect All, and then under Columns, select those columns.

      Note: Data will be removed from all columns, even if you don’t select all the columns at this step. For example, if you select Column1 and Column2, but not Column3, then the “key” used to find duplicates is the value of BOTH Column1 & Column2.  If a duplicate is found in those columns, then the entire row will be removed, including other columns in the table or range.

  4. Click OK, and a message will appear to indicate how many duplicate values were removed, or how many unique values remain. Click OK to dismiss this message.

  5. Undo the change by click Undo (or pressing Ctrl+Z on the keyboard).

Note: You cannot conditionally format fields in the Values area of a PivotTable report by unique or duplicate values.

Quick formatting

Follow these steps:

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Style group, click the small arrow for Conditional Formatting, and then click Highlight Cells Rules, and select Duplicate Values.
    Duplicate values

  3. Enter the values that you want to use, and then choose a format.

Advanced formatting

Follow these steps:

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow for Conditional Formatting, and then click Manage Rules to display the Conditional Formatting Rules Manager popup window.
    Conditional Formatting menu with Manage Rules highlighted

  3. Do one of the following:

    • To add a conditional format, click New Rule to display the New Formatting Rule popup window.

    • To change a conditional format, begin by ensuring that the appropriate worksheet or table has been chosen in the Show formatting rules for list. If necessary, choose another range of cells by clicking Collapse Button image button in the Applies to popup window temporarily hide it. Choose a new range of cells on the worksheet, then expand the popup window again Button image . Select the rule, and then click Edit rule to display the Edit Formatting Rule popup window.

  4. Under Select a Rule Type, click Format only unique or duplicate values.

  5. In the Format all list of Edit the Rule Description, choose either unique or duplicate.

  6. Click Format to display the Format Cells popup window.

  7. Select the number, font, border, or fill format that you want to apply when the cell value satisfies the condition, and then click OK. You can choose more than one format. The formats that you select are displayed in the Preview panel.

In Excel for the web, you can remove duplicate values.

Remove duplicate values

When you remove duplicate values, the only effect is on the values in the range of cells or table. Other values outside the range of cells or table will not change or move. When duplicates are removed, the first occurrence of the value in the list is kept, but other identical values are deleted.

Important: You can always click Undo to get back your data after you have removed the duplicates. That being said, it’s a good idea to copy the original range of cells or table to another worksheet or workbook before removing duplicate values.

Follow these steps:

  1. Select the range of cells, or ensure that the active cell is in a table.

  2. On the Data tab, click Remove Duplicates .

  3. In the Remove Duplicates dialog box, unselect any columns where you don’t want to remove duplicate values.

    Note: Data will be removed from all columns, even if you don’t select all the columns at this step. For example, if you select Column1 and Column2, but not Column3, then the “key” used to find duplicates is the value of BOTH Column1 & Column2.  If a duplicate is found in Column1 and Column2, then the entire row will be removed, including data from Column3.

  4. Click OK, and a message will appear to indicate how many duplicate values were removed. Click OK to dismiss this message.

Note: If you want to get back your data, simply click Undo (or press Ctrl+Z on the keyboard).

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Count unique values among duplicates

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

When you are working on a large number of data then you will encounter a few duplicate entries.

Sometimes these duplicate values are very useful but many times you want to remove the duplicate data. If you have 1000 data then it becomes quite difficult to find and remove the duplicate data.

Here we have provided the step-by-step process on how to find duplicates in excel.

Take a look and follow the process.

There are many ways to find duplicate items and values in excel. You might be thinking as to why should I apply any formula or method to find duplicate values as it is easy.

But it’s not about few data, you can apply a formula or method when you have lots of data.

The method or formula to find and remove the duplicate items make the process easier and saves your time. Here you can check three different processes.

1. Find Duplicates in Excel using Conditional Formatting

To find duplicate values in Excel, you can use conditional formatting excel formula, Vlookup, and Countif formula. After finding out the duplicate values, you can remove them if you want by using different methods that are described below.

Find-duplicate-values

Remove duplicate values

  • Select all the duplicate cells or highlighted cells
  • Delete the values by pressing the Delete button.
  • After deleting the values, go to the conditional formatting.
  • Choose Clear rules.
  • And then choose clear rules from an entire sheet.

Duplicate-values

Another way to remove the duplicate value

This method will delete all the duplicate data permanently. If you want the duplicate data again, then copy the data on another worksheet.

  • Select the cells on which you want to find and remove the duplicate values.
  • Go to the ribbon and find the data option.
  • In the data tab, you will find the remove duplicates option.Remove-duplicate-values
  • Now check or uncheck the column on which you want to apply this constraint.
  • Then click OK.

2. Find Duplicates in One Column using COUNTIF

Another way to detect duplicates is via the COUNTIF function. If you want to apply the COUNTIF function then check here how to find duplicates in Excel using the Excel COUNT function.

  • If you have the list of items from where you want to find duplicates, then you need to apply the COUNTIF formula to it.
  • The syntax for COUNTIF: “=COUNTIF(B:B, B2)>1”.Remove-and-delete-duplicate-values
  • In column A, you have the Buyer’s name and in column B, you have the fruits name that he or she likes. Now you want to find the duplicate items.
  • Put this COUNTIF formula in column C.
  • For all duplicate fields, it shows TRUE whereas, for non-duplicate fields, it shows FALSE.
  • Now by following the above step-by-step process, you can delete all the duplicate items that you do not need.

Find Duplicates in Two Columns in Excel

Above we have seen how to find duplicate values in one column, now we will see here how to find duplicates in two columns in excel.

In this example, we have taken a table where the candidate name is in column A and Fruits is in column B. Now we want to find duplicate values having the same name and fruits.

The formula to find duplicate values in two columns is

=If (Countifs($A$2:$A$8, $A2, $B$2:$B$8, $B2)>1, "Duplicate Values"," ")

How to Count Duplicates in Excel

If you want to know the total number of duplicate values then you need to use the Count function. For counting duplicate values you need to use the countif formula.

=Countif($A$2:$A$8, $A2)

3. Filter Duplicates in Excel

Another method to find duplicates in excel is to filter data to get duplicate values.

Remove Duplicates Online

To remove duplicates, you need to follow the below-mentioned process

  • Select the table by dragging the mouse.
  • Right-click on the table.
  • Delete the row by choosing the Delete Row option.

Highlight Duplicates in Excel

In order to highlight the duplicate values, you can either use a conditional formula to find duplicates in excel or follows the below-mentioned process.

  • Select the duplicate values.
  • Go to the Fill color option and select the color.How-to-find-duplicates-in-excel-2
  • This will highlight the duplicate values in excel.

Apart from these, there are other processes available by which you can find the duplicate items available in your data set. After finding out the duplicate values, you can remove them easily. Stay connected with our website to know other Excel features.

Related Queries

Here we have listed a few queries that are asked by Excel learners. If you are also facing this kind of problem then you can check it here.

Q1. How to delete duplicate e-mail addresses if you have 10,000 emails in your data set?

Ans. If you have all email addresses in a single column then select the column and go to the “Data” ribbon. You will find the ‘Remove Duplicates’ tab in data tools.

Click on Remove Duplicates and you will find another dialog box where you need to make a selection. Press Ok and you receive the unique email addresses.

Q2. How to find the repeated teacher’s name in Column A? The data is

  • B1= Maths/English Jasmine, Eon
  • B2= Physics Johana
  • B3= History Poole
  • B4= English/Physics Sam, Jasmine
  • B5= Chemistry Romeo

Ans. To solve this problem, create three separate columns. In the first column, mention the class name. In the second column, put the teacher’s name, and in the third mention another teacher’s name. Now in the fourth column, put the formula =COUNTIF(B:B,B1)>1

Using this formula, you will find “TRUE” if the value is duplicate.

Q3. How to sort data before applying a filter?

Ans. To sort data you need to choose the Sort tab in excel. Sorting a data set is quite an easy process. Follow the process mentioned below and sort your data completely.

  • Select the data set.
  • Go to the Data ribbon.
  • In the Sort & Filter section, you will find the Sort icon. Click on the icon and sort your data.

Q4. How to compare two columns in excel?

This question was mainly asked by the interviewer at the time of the interview. There are many ways to compare the two columns:

  1. =A2=B2 This is the simple formula used to compare two columns.
  2. Conditional Formatting: In this, you need to follow the above process, you can check the conditional formatting excel link to get detailed information.
  3. Vlookup: You can also use the Vlookup formula to compare two columns using Vlookup for research, ISNA for performance, and If to customize the result.
  4. Excel If Statement: This is a quite useful function in excel and it can be used in many ways. To get the detailed information Click Here.

Q5. How to filter data in excel?

Filtering in Excel is an easy process. In the sort & filter section, you will find the Filter icon. Click on the icon and filter your data.

In this tutorial, we have covered all the excel topics that are best for beginners and experts. We always try to solve all the problems that people face while working on excel. If you have any other query or want to ask something then you can mention in the comment box below. One of our team members will be back with the answer.

You may also like the following Excel tutorials:

  • How to Remove Formulas in Excel (and keep the data)
  • How to Fill Blank Cells with Value above in Excel
  • How to Generate Random Numbers in Excel (Without Duplicates)
  • How to Find Merged Cells in Excel
  • Highlight Cell If Value Exists in Another Column in Excel
  • Using Conditional Formatting with OR Criteria in Excel
  • How to Remove Duplicate Rows based on one Column in Excel?
  • Get Unique Values from a Column in Excel
  • How to Count Unique Values in Excel (Formulas)
  • How to Use Greater Than or Equal to Operator in Excel Formula?

How do I count text in Excel without duplicates?

Jul

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.

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.

In essence, COUNTIF formulas are identical in all Excel versions, so you can use the examples from this tutorial in Excel 2016, 2013, 2010 and 2007.

  • 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.

For example, you can write a COUNTIF formula to find out how many cells in your worksheet 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).

The syntax of the COUNTIF function is very simple:

COUNTIF(range, criteria)

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

  • 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, 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:

How do I count text in Excel without duplicates?

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.

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).

Similarly, COUNTIF formulas work for numbers. As shown in the screenshot below, the formula =COUNTIF(D2:D9,5) perfectly counts cells with quantity 5 in Column D.

How do I count text in Excel without duplicates?

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.

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*»).

How do I count text in Excel without duplicates?

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.

Tip. It is also possible to use wildcards with cell references with the help of the concatenation operator (&). For example, instead of supplying «*Brown*» directly in the formula, you can type it in some cell, say F1, and use the following formula to count cells containing «Brown»: =COUNTIF(D2:D10, «*»&F1&»*»)

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:

How do I count text in Excel without duplicates?

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.

COUNTIF not blank

In some of other Excel COUNTIF tutorials, you may come across formulas for counting non-blank cells in Excel similar to this one:

COUNTIF(range,»*»)

But the fact is, the above formula counts only cells containing any text values, meaning that cells with dates and numbers will be treated as blank cells and not included in the count!

If you need a universal COUNTIF formula for counting all non-blank cells in a specified range, here you go:

COUNTIF(range,»<>»)

Or

COUNTIF(range,»<>»&»»)

This formula works correctly with all value types — text, dates and numbers — as you can see in the screenshot below.

How do I count text in Excel without duplicates?

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 and with the «» criteria to count all empty cells.

Formula to count cells not containing any text:

COUNTIF(range,»<>»&»*»)

Since an asterisk (*) matches any sequence of text characters, the formula counts 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, here’s how you can get the number of empty cells in the range C2:C11:

=COUNTIF(C2:C11,»»)

Please be aware that Microsoft Excel has another function for counting blank cells, COUNTBLANK. For instance, the following 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 and COUNTBLANK count cells with empty strings that only look blank. If you do not want to treat such cells as blanks, use this formula instead:

=ROWS(C2:C11)*COLUMNS(C2:C11)-COUNTIF(C2:C11,»<>»&»»)

For more information about counting blanks and not blanks in Excel, please see:

  • 3 ways to count empty cells in Excel
  • 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.

CriteriaFormula ExampleDescriptionCount 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,»<>5″)Count cells where value is not equal to 5.Count if greater than or equal to=COUNTIF(C2:C8,»>=5″)Count cells where value is greater than or equal to 5.Count if less than or equal to=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):

How do I count text in Excel without duplicates?

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:

CriteriaFormula ExampleDescriptionCount 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 equal to another date.=COUNTIF(B2:B10,»>=6/1/2014″)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 specific Excel Date and Time functions such as TODAY() to count cells based on the current date.

CriteriaFormula ExampleCount dates equal to the current date.=COUNTIF(A2:A10,TODAY())Count dates prior to the current date, i.e. less than today.=COUNTIF(A2:A10,»<«&TODAY())Count dates after the current date, i.e. greater than today.=COUNTIF(A2:A10,»>»&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/1/2014»)-COUNTIF(B2:B10, «>6/7/2014»)

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

How do I count text in Excel without duplicates?

Excel COUNTIF with multiple criteria

In fact, Excel COUNTIF function is not exactly designed to count cells with multiple criteria. In most cases, you’d use its plural counterpart, the COUNTIFS function to count cells that match two or more criteria (AND logic). However, some tasks can be solved by combining two or more COUNTIF functions in one formula.

COUNTIF — COUNTIF to count numbers within a range

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″)

How do I count text in Excel without duplicates?

COUNTIF + COUNTIF to count cells with multiple OR criteria

In situations when you want to get several different items in a range, add 2 or more COUNTIF functions together. Supposing, you have a shopping list and you want to find out how many soft drinks are included. To have it done, use a formula similar to this:

=COUNTIF(B2:B13,»Lemonade»)+COUNTIF(B2:B13,»*juice»)

Please pay attention that we’ve included the wildcard character (*) in the second criterion, it is used to count all kinds of juice on the list.

How do I count text in Excel without duplicates?

In the same manner, you can write a COUNTIF formula with several conditions. Here is an example of the COUNTIF formula with multiple OR conditions that counts lemonade, juice and ice cream:

=COUNTIF(B2:B13,»Lemonade») + COUNTIF(B2:B13,»*juice») + COUNTIF(B2:B13,»Ice cream»)

For other ways to count cells with OR logic, please see this tutorial: Excel COUNTIF and COUNTIFS with OR conditions.

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:

How do I count text in Excel without duplicates?

Example 2. Count duplicates between two columns

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<>»»))

How do I count text in Excel without duplicates?

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<>»»))

How do I count text in Excel without duplicates?

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:

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)

How do I count text in Excel without duplicates?

2. Ampersand and quotes in COUNTIF formulas

Question: When do I need to use an ampersand in a COUNTIF formula?

Answer: It is probably the trickiest part of the COUNTIF function, which I personally find 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. For example:

=COUNTIF(A1:A10,10)
or
=COUNTIF(A1:A10,C1)

If your criteria includes text, wildcard character or logical operator with a number, enclose it in quotes. For example:

=COUNTIF(A2:A10,»lemons»)
or
=COUNTIF(A2:A10,»*») or =COUNTIF(A2:A10,»>5″)

In case your criteria is 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. both of the below formulas work equally well.

=COUNTIF(C2:C8,»<=5″)
and
=COUNTIF(C2:C8,»<=»&5)

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.

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!

You may also be interested in

  • Count cells in Excel: COUNT and COUNTA functions with formula examples
  • Count distinct and unique values in Excel
  • Count characters in Excel: total or only specific characters in a cell / range

Excel: featured articles

  • Merge multiple sheets intoone
  • Combine Excel files into one
  • Compare two files / worksheets
  • Merge 2 columns in Excel
  • Compare 2 columns in Excel for matches and differences
  • How to merge two or more tables in Excel
  • CONCATENATE in Excel: combine text strings, cells and columns
  • Create calendar in Excel (drop-down and printable)
  • 3 ways to remove spaces between words in Excel cells

Table of contents

Older Comments

Newer Comments

  1. renjith says:

    December 9, 2016 at 10:13 am

    i have data of 500 employee ID’s with different tasks. I want to use the function countif to get the no of tasks per employee id in mass, it is possible please help me

    Reply

  2. Nitin says:

    December 9, 2016 at 8:16 am

    Please help me i want to calculate electricity rate in excel
    Example:
    Sr. No House no Name Meter reading
    1 1 ABC 50
    2 2 XYZ 56
    Criteria is if reading 0 to 50 then 0 rs charges if reading >50 but 100 but 150 then 4 rs charges.

    Reply

  3. Azam says:

    December 3, 2016 at 2:04 pm

    Qty. Rate
    2 699
    1 899
    1 809
    2 539
    1 719
    1 539
    3 685
    1 539

    More then 599 and lees or equal to 799
    I require output : 6
    Detail .
    (699 -> 2)+(719 -> 1) +(685 -> 3) = 6

    Reply

  4. Azam says:

    December 3, 2016 at 2:03 pm

    Qty. Rate
    2 699
    1 899
    1 809
    2 539
    1 719
    1 539
    3 685
    1 539

    I use
    =COUNTIFS(A:A,»>599″,A:A,» 2)+(719 -> 1) +(685 -> 3) = 6

    Reply

  5. Gavin says:

    November 30, 2016 at 9:59 am

    hi i was wondering if you can use the countif function with a cell reference as part of the criteria. basically instead of saying =countif(Range,»<5″) rather saying =countif(range,»<A7″). your help would be greatly appreciated.

    thanks
    Gavin

    Reply

  6. Parminder says:

    November 7, 2016 at 8:38 am

    A B C D E F G H I J
    B 1 0 1 1 1 0 1 1 1
    C 0 1 0 0 0 1 0 0 0
    D 0 0 1 1 0 0 1 0 1
    E 1 1 1 0 1 1 0 1 0
    F 0 1 0 1 0 0 1 0 1
    G 0 0 1 0 0 1 0 0 0
    H 1 0 0 1 1 0 1 1 1
    I 0 1 1 0 0 0 0 0 1
    J 1 0 1 1 1 1 1 1 0

    find duplicate column..
    highlight it

    Help me with this…

    Reply

    • Parminder says:

      December 6, 2016 at 9:48 am

      can anyone help me with this ??

      i can find the duplicates column in alphabetic mode but i can’t in numeric mode

      please help me out with this

      Reply

  7. Khamkeo says:

    October 26, 2016 at 4:37 pm

    What about count if greater than 5 and less than 8 for example? or between something?

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      October 27, 2016 at 8:37 am

      Hi Khamkeo,

      In this case, you need to use the COUNTIFS function, for example:

      =COUNTIFS(A2:A10,»>5″, A2:A10,»<8″)

      Reply

  8. Traian says:

    October 23, 2016 at 11:30 am

    i need help: I have a leads excel (clients) and i plan to calculate how many leads we got:
    -yesterday
    -today
    -last7days
    -this month
    I have P column that have «7» standard possible answers; like the state of the lead. I need a formula for each state of the lead to count the nr of leads for the above time periods.

    Thanks,
    I really appreciate this answer i tried for one week to do it.

    Reply

  9. Usman says:

    October 20, 2016 at 2:10 pm

    Hi,
    I need help, if I have same words from sheet 1, and i want to count the words in 6 rows in sheet 2. how?
    e.g.
    sheet 1 — ABC (AE1) criteria
    Sheet 2 — A1-F1 range
    By using countif formula.

    once i put the this formula:COUNIF(‘Sheet1’!AE1,»*ABC*»)

    but it is calculating multiple.

    Reply

  10. Jenna says:

    October 20, 2016 at 3:18 am

    Hi, I am having a problem counting how many part numbers with shortages on a multiple data. See below data:

    YV756A YV756B YV441G YT081A YT081B
    4100023-003 -1 0 -1 -1 -1
    4100024-001 0 0 0 0 -1
    4100142-001 -1 -1 -1 -1 -1

    Need to count how many part number with shortage on following models:
    YV756 =
    YV441 =
    YT081 =

    this is considering if YV756A and YV756B has -1 on each, it will take only as 1 part number with shortage.

    Please help me create formula to count this.

    thanks a lot!
    Jenna

    Reply

  11. GREG says:

    October 19, 2016 at 7:59 am

    I WANT TO COUNT WITH IF BUT AT NEGATIVE
    EXMPL
    SUMIF -> IF ISNT «THIS»
    ?

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      October 19, 2016 at 9:39 am

      Hi Greg,

      You can use the «not equal to» operator (<>) e.g.:

      =COUNTIF(A1:A10, «<>»&5)

      =COUNTIF(A1:A10, «<>»&»text»)

      Reply

  12. Krishna says:

    October 19, 2016 at 4:56 am

    Sir
    COUNTIF(G7:G315,»SC») is 38
    and I want to count How many R is entered in the next column exact SC means in column H7:H315. pl do the needful and Give formula

    Reply

  13. JMK says:

    October 18, 2016 at 6:52 pm

    I need help counting unique invoices touched by the collector per work day. I used If(I1=I2,0,1) but still getting some duplicate invoices for others. I need column I to give the count of unique invoices touched that day.
    Thanks,
    JM

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      October 19, 2016 at 9:51 am

      Hello!

      Please check out the following tutorial, hopefully you will find a proper formula for your task there:
      How to count distinct and unique values in Excel

      Reply

  14. Reshma says:

    October 17, 2016 at 7:37 am

    I need a formula to get the total count of non empty columns in excel which is having «n» number of columns.

    Reply

  15. Dominy says:

    October 14, 2016 at 5:05 pm

    Ok I have bee through a few help forums now and got tired of searching. I was trying to utilize a Countifs formula to determine employees available to work during certain time frames. Due to the way our system exports the information, an excel formula would work best. Here is how info is exported to excel:
    A B C D E F
    Name From To Sun Mon Tue
    Employee 13:00 00:00 TRUE TRUE FALSE

    What I need to do is count how many employees are available during certain times each day, example:
    Time Sun Mon Tue
    1pm-7pm 1 1 0

    Any assistance would be greatly appreciated cause this type of formula is not my strong suit.

    Reply

  16. Manssor says:

    October 12, 2016 at 7:54 am

    Thank you for the simple clear detailed information.
    You are an angel.

    Reply

  17. Denis says:

    October 11, 2016 at 1:54 pm

    Hi, how do I count the number of cells in a range that are bigger than 0?
    The numbers in the cells are the results of formulas though.
    Thanks for your help.

    Reply

  18. Stella M says:

    September 30, 2016 at 1:53 pm

    Hi there,

    I have a complex spreadsheet and I want to have a formula calculating the following:
    From a range of cells to take a particular value (name) and then from another range of cells (column) to take another value matching the row with the name, then to count the matches in the cell.
    I have tried this formula
    =IF(AND(‘Domain 1′!E6=»Andrea»,’Domain 1’!Q6=»Food»),1,0)

    but the thing is that I need the formula to look at a range of cells in two different columns and then to sum up these values.

    I would really appreciate if you can help me

    Reply

  19. Shivani says:

    September 29, 2016 at 8:18 pm

    Hi, I have a spreadsheet for analysing exam results. I need to count and summarise each student’s results against each course, e.g. for each student, indicate:
    pass (where all 4 subjects passed)

    or fail in maths, fail in english (the rest are pass so silent).

    or
    CNC (where absent)

    So how do I insert the text depending on pass or fail per subject.

    Thanks.

    Reply

  20. Naveed Khalil says:

    September 23, 2016 at 9:48 am

    Hi,,You are doing best.
    I need help.
    in column A, i will enter the due date, e.g. due date is 15/09/2016. now i want that if the due date expires and extends to 19/09/2016 then fine of Hundred dollar per day comes automatically in column B and for 19/09/2016 fine will be 400.
    Your nice help will be appreciated.
    reply should be on email.
    Thanks

    Reply

  21. Tiffany says:

    September 21, 2016 at 5:25 pm

    Hello,

    I have a list of departments that I am trying to find <=2.0 hours for each department from a pivot table list of employees. I cannot figure out the best way to use the countif function to find only that department name and how many times that department comes up with less than or equal to 2 hours.

    Column A: Employee Name
    Column B: Department They Work In ex. Pack Room
    Column C: Total number of hours worked

    I need the Countif function to know to only look up the Pack Room Hours in column B and only count hours that are <=2.0.

    I’ve tried using DCount but still can’t get my result.

    Reply

  22. Kristiane Esporas says:

    September 18, 2016 at 2:28 pm

    Hi Svetlana,

    Thank you for this very helpful article. :) I’m trying to use the countifs function, however it’s not working for me. Here’s the scenario.

    I have one question which shows a list of anawer.

    Ex: How likely will you buy this?
    Product 1, Produt 2, Product 3
    In each cell there’s a drop down list of the answers such as 3- will buy it, 2-somehow will buy it ans 1-not going to buy it.

    I’m using =countifs(A2:A102,»3″, A2:A102,»2″, A2:A102, «1»)

    but it’s not even counting :(

    Hope you could help with this.

    Thanks a lot!

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      September 19, 2016 at 8:39 am

      Hi Kristiane,

      First off, remove double quotes surrounding numbers because they turn numbers into text strings.

      If you need to get the total count of answers 1, 2 and 3, then add up 3 different COUNTIF functions, because COUNTIFS works with the AND logic while you need OR:
      =countif(A2:A102,3) + countif(A2:A102, 2) + countif(A2:A102,1)

      If you want the individual count for each type of answers, then use 3 separate formulas like this: =countif(A2:A102,3)

      Reply

  23. Rakesh says:

    September 16, 2016 at 8:54 am

    hi
    i want to know the formula which can give me best answer

    example-

    30 qty pack is equal to 1 duty

    he pack 35 then also 1 duty

    he pack 25 then also 1 duty

    if he pack 60 then will be 2 duties

    Reply

  24. Christine says:

    September 15, 2016 at 5:26 pm

    Hello:
    I am trying to count blank cells within a range (rows). I’m only interested if there are 3 or more blank cells beside each other. If cells A1 and B1 are blank and C1 is not blank, I don’t need to know about cells A1 and B1. However if cells A1, B1, C1 are blank, then I want to know. In addition, if there are subsequent series of blank cells, for example M1, N1, O1, P1, I also want to know.

    Is there a way to do this?
    Thanks!
    Christine.

    Reply

  25. Anupam says:

    September 2, 2016 at 4:41 am

    Hi,

    I want to use the countif formula for the list of the descriptions (in one column). In these descriptions, there are many cells with more than 255 characters. How to use countif here. I am getting the answers for all the description cells wherever the character length is less than 255. For others, » #value! «.

    Can you please help me?
    Also, I want to use vlookup for these description columns. How to do that?

    Reply

  26. Kayla Kedel says:

    September 1, 2016 at 9:29 pm

    Hi!

    I have a spreadsheet with employees, hire dates, managers, department. I have a second tab that keeps count by all employees, then broken down by each company and department.. I cannot figure out how to group the hire date and department to automatically count for me when I add a new person. we are about to hire 200+ so having it automatically update would be so much help. can you help me figure out what I need to put in the date part and how do I group hire date (ex. Jun-16) and department (ex. Maintenance) to make my formula work?

    Reply

  27. nats says:

    September 1, 2016 at 3:22 am

    hi, please help… i need to have a formula that will count entries in the specified range, with two conditions. ive tried this but it doesn’t work

    =COUNTIFS(D13:Q13,»C», D13:Q13,»X»)

    I really need help on this, thanks and God bless

    Reply

  28. Rich says:

    August 26, 2016 at 10:36 am

    Hi,

    I am using this formula

    =IF(COUNTIFS($B$3:$B$1100:$G10:$G$1100,B10,$B$3:$B$1100:$G10:$G$1100,G10)>1,»FT»,»PT»)

    I have two colums AM and PM, I am trying to use this to highlight the duplicate number for a person i.e if the persons number shows up in AM an PM it will show FT and if it shows in AM but PM is blank will show PT. — This formula works but the problem Im having is when both Am and PM show «0» or are blank the formula still gives me FT when I need it to stay blank.

    Can you help?

    Reply

  29. jim says:

    August 25, 2016 at 12:27 pm

    please help need to find a way to to count how many times a person was late,i.e. d2:d25 =paul,e2:e25 =are times started ie 10:00,10:15 ect.start time is 10:00. i use this,COUNTIF(e2:e25″>10:00″)for the total count,but i need to find a way
    to count for each employee thank you

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      August 25, 2016 at 3:52 pm

      Hi Jum,

      You can use COUNTIFS to count with multiple criteria:

      =COUNTIFS(E2:E25, «>10:00», D2:D25, «paul»)

      Reply

  30. sz says:

    August 25, 2016 at 10:12 am

    How to count duplicates of 2nd column based on 1st column in a large excel file. Eg :

    1 a
    1 b
    2 a
    2 a
    2 d
    2 c
    2 c
    4 e

    Output Required :
    1 a 1 [ Count of «a» in «1» : One Time ]
    1 b 1
    2 a 2
    2 c 2 [ Count of «c» in «2» : Two Time ]
    2 d 1
    4 e 1

    Reply

  31. Per says:

    August 22, 2016 at 11:51 am

    Hello! What a great post.

    I have some trouble counting a specific value in excel. I have a cell that I want to count the amount of cells from a row that contains the specific value «em». So far so good, but there is a catch. I only want it to count it as 1 if the cells with «em» comes after each other. Meaning if it finds three cells in a row like this: «em» «em» «em» «sm», it should only count it as 1. And: «em» «em» «sm» «em» «em» as two.

    Hope you understood the question, and thanks a lot for any help! :)

    Reply

  32. Andrea says:

    August 18, 2016 at 1:19 pm

    Hello…

    Do you know if this is possible ?
    I have a workbook. One workbook per Month. Each workbook will have 1 worksheet per day (so between 29 and 31 sheets per workbook)

    (In this example I have August 1 — August 4 and a Summary Sheet)

    I need a formula that will Find a name (In this case I used Captain1 or FF1 etc. instead of actual names) and find what is in the time Off column and total it on the Summary sheet.

    I want the summary sheet to populate as new sheets are created. Is there a way to write a formula telling Excel to look in ANY and ALL sheets in the entire workbook and total those form me??

    I can’t figure out how to do it as technically the sheets haven’t been created yet…..

    Reply

  33. Michael Mwenda says:

    August 16, 2016 at 1:49 pm

    hi
    I wanted to enter these values 2724742560in a cell of a spreadsheet but after pressing the enter key the cell displayed #########. please explain why and how could I rectify the situation.

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      August 17, 2016 at 10:16 am

      Hi Michael,

      Most likely the cell is not wide enough to display the value, so just make it a bit wider. To quickly change the column width to fit the contents, select the column, and double-click the boundary to the right of the selected column heading.

      Reply

  34. Michael Mwenda says:

    August 16, 2016 at 1:39 pm

    state the results of the function,=IF(COUNT IF(B2:B9,»>65″)>5,»YES»,»NO»)

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      August 17, 2016 at 10:23 am

      Michael,

      If the range B2:B9 contains more than 5 cells with values greater than 65, return YES, otherwise NO.

      BTW, COUNTIF should be spelled with no space in between like this:
      =IF(COUNTIF(B2:B9,»>65″)>5,»YES»,»NO»)

      Reply

  35. Carl says:

    August 11, 2016 at 10:17 pm

    Hi,

    Using Excel 2013. I want to return the count of the number of cells that are colored a specific color AND have a specific value.
    FOR EXAMPLE: I have APPLES (red), GRAPES (green) and STRAWBERRIES (red). I want to only return the number of red apples, not everything red. Can I do this? Please help
    P.S. I am not using COUNTIF to count apples only as I am using that formula to return that value in a different cell.

    Reply

  36. Somasundaram says:

    August 10, 2016 at 1:08 pm

    Hello,

    I want to count the Entry in excel what are entries are entered as well as i have to sum the pages in pages column.

    for example

    Name Pages Stage
    1234_AAA 100 Stage1
    1345_AAA 200 Stage2
    1234_AAA 300 Stage1
    1568_BBB 400 Stage3
    1345_AAA 500 Start2

    I need below output automatically

    Count Total Pages
    1234_AAA 2 400
    1345_AAA 2 700
    1568_BBB 1 400

    Stage wise total pages
    Stage 1 Stage 2 Stage 3
    1234_AAA 2
    1345_AAA 2
    1568_BBB 1

    Reply

  37. Maria says:

    August 3, 2016 at 7:27 pm

    Hello,

    Can you break this formula down for me?

    COUNTIF9G31:BC31,»*x*»)/2

    Thank you.

    Reply

  38. Ester says:

    August 3, 2016 at 9:33 am

    Hi Svetlana,
    I’m trying to count the blank cells in a column after a specific date. For example, I have a list with several projects I need to close before 31/03/2017. I’ve foreseen a column with the date of closure and I can count the project that I’ve closed allready and those I’ve closed to late: =COUNTIF(P2:P33;»>31/03/2017″) but when the project stays open, and the cell is empty, I can’t count those. I’m looking for a formula that can count the projects that have passed 31/03/2017.
    Can you help me?
    Thank you

    Reply

  39. Sanjeet Shokeen says:

    July 30, 2016 at 10:48 am

    I have a table in which first column i add date 1 July to 26 July 2016. In second column, I give rating to me (e.g. 0 to 10). I want to sum my rating only past 5 days but when last 5 day rating is less than 2, then add one more day. e.g.
    Date Rating
    15 July 5
    16 July 3
    17 July 0
    18 July 8
    19 July 2
    20 July 6
    21 July 7
    23 July 1
    24 July 5
    25 July 6
    26 July 3

    when I sum last 5 day (21 July to 26 July) is 22, but 23 July my rating is less than 2 than I add one more day in rating (20 July to 26 July) than my rating is 27, I remove 23 July in my life.

    Can you you help me in this.

    Than You.

    Reply

    • sanjeet shokeen says:

      August 6, 2016 at 8:45 am

      any one can help me in this.

      Reply

  40. Cmcd says:

    July 28, 2016 at 11:25 pm

    I want to count when a range of cells (m8:m17) are not equal to 0 but only when cell m6 isn’t 0.
    Is this possible?

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      July 29, 2016 at 8:49 am

      Hi!

      The following formula counts how many cells in the range M8:M17 are not equal to 0 when M6 is not equal to zero, and returns an empty string (blank cell) otherwise:
      =IF(M6<>0, COUNTIF(M8:M17,»<>»&0), «»)

      If you are looking for something different, please clarify.

      Reply

  41. Shahrul says:

    July 13, 2016 at 11:31 am

    Hi, I would like to count how many rows (in total) that fulfil more than 2 criterias. For each row, there is a unique ID. For example, one unique ID has 5 rows of Product A and 3 rows of Product B. Under Product A and B, the unique ID has different amount.

    The criteria is Product A has amount more and equal to 1,000. Product B has amount more and equal to 1,000.

    My question is what formula to use to calculate how many rows (in total) that this unique ID has and it need to fulfil the 2 criterias.

    Appreciate your assistance on this.

    Thank you.
    Shahrul

    Reply

  42. joanna says:

    July 12, 2016 at 8:05 am

    sheet1 i have item and quantity then i want to transfer the value of all items that has >=1 to sheet2? how can i do that?? thank you

    Reply

  43. Sydney says:

    July 9, 2016 at 10:52 pm

    Please help me to come up with a formula used to show exact date in which data was entered in a cell.

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      July 11, 2016 at 9:14 am

      Hello Sydney,

      Please check out the following example:

      How to insert today date & current time as unchangeable time stamp

      Reply

  44. Ross says:

    July 5, 2016 at 4:18 pm

    Hi, I am trying to evaluate the results of suppliers / products against specifications. In particular I am wanting to calculate the % of intakes from a particular item that meet a specification. e.g.;

    SUPPLIER PRODUCT Spec No. in spec % meeting spec
    Joe blogs Apples 0.10 50 98

    For the ‘No. in spec result’ I am using a COUNTIFS formula where ‘criteria 1’ is the spec value inputted another cell («<=»&C2). This seems to work fine where the there is a value in the ‘spec’ cell, but for some products there isn’t a spec so I enter N/A. In such instances the COUNTIFS formula returns a seemingly random numeric figure, instead of an error. This in turn returns a false value in the % meeting spec column… Please can anyone help?

    Reply

  45. Amanda says:

    July 5, 2016 at 2:58 pm

    I have a mixed text and number format array that I am trying to use multiple conditions to count items. Columns are numbered for course rotations 1-13. rows are random and not important. Individual cells contain student name, rotation name and MAY contain which weeks withing a 4 week rotation they will be there. Eg one cell may have Smith GI which corresponds to a student for all 4 weeks and another have Green GI (1,2) meaning they are there only 2 weeks. I am trying to get the output in number of students per week per rotation. for the above would be 2,2,1,1. Goal would be to express results in an array of rows by rotation#/week and columns by rotation name. Tried using multiple countif functions as follows: =COUNTIFS($C$2:$C$18,»*GI*»&»*weeks*»&»*1*») + COUNTIFS($C$2:$C$18,»*GI*»,$C$2:$C$18,»weeks») but didn’t work. Also figure there should be an easier way to use a reference cell for the rotations text (GI) and the week (for the above formula used week 1) Any suggestions? Thanks in advance!!!

    Reply

  46. jen says:

    June 30, 2016 at 8:35 pm

    column A column B
    1200018401 9000035943
    1200018402 9000035944
    1200018392 blank
    1200018393 blank
    1200018396 blank
    1200018397 blank

    How can I calculate whenever column A has a number and column B has a blank. I need to know that total blank number

    Reply

    • Vijaykumar Shetye says:

      July 28, 2016 at 9:19 pm

      Dear Jen,

      Use the formula
      =COUNTIFS(A1:A100,»>»&0,B1:B100,»»)

      Change the range of the cells as required.
      Do let me know if this is what you wanted to do.

      Regards

      Vijaykumar Shetye, Goa, India

      Reply

  47. jen says:

    June 30, 2016 at 8:32 pm

    Im trying to count blank cells. I have column A with numbers in it and column B with both numbers and blanks. What I need to know is how to count column A with numbers with Column B to get only the total number of blanks

    Reply

  48. Amjad says:

    June 28, 2016 at 12:28 pm

    i want to count 2 values in one cell from different column

    ex. count A for me from one column (means column A) and < 5 from another column (means column B)in one cell.
    what will be the formula
    thanks

    Reply

  49. Matt says:

    June 10, 2016 at 12:07 pm

    I’m trying to use the COUNTIF function to count cells in a column that are >0, but I don’t want it to include hidden cells. How do I select an entire column as my range, but not include hidden cells in my count?

    Reply

    • Matt says:

      June 10, 2016 at 12:15 pm

      Here is the formula that I tried using =COUNTIF(Compile!N:N,»>0″)

      Reply

  50. Gary says:

    June 8, 2016 at 9:16 pm

    What do I do if I want to refer to a text cell to find values in a range?

    For example, I have a table with service time. The header for columns will have text for «10-14» or «15-19″, etc. I want to use the header text as a variable for my criteria, kind of like =Countif($B$2:$B$2000,»>=»&Value(Left(Header,2)),$B$2:$B$2000,»<=»&Value(Right(Header,2)))

    (the above does not work, wondering if I need an Indirect() function in there somewhere…?

    Reply

  51. Elaine says:

    June 7, 2016 at 2:28 pm

    Hi I have a question:
    I have a list of values in Column A on tab 1 — Product
    potato
    tomato
    squash
    corn etc and they are unique

    On the tab 2 I have 2 columns:
    Column A has the same values as column A on tab 1 but they could repeat, and column B has some text, for example color. Not all column B is populated
    potato brown
    tomato red
    potato purple
    squash
    corn yellow

    I need to calc. value in col B on tab A, where it will count for each of the col A entries on tab A it will count how many have values on tab 2
    So it will be on tab A
    Potato 2
    tomato 1
    squash 0
    corn 1

    Thank you!

    Reply

  52. Manish Gupta says:

    May 28, 2016 at 2:31 pm

    In column «S», I have numbers 1,2,3… (based on the formula that checks a value in Column A (if blank, gives blank… else a number in Ascending Order).
    I have a similar value in Column X as well. 1,2,3,… etc.
    in between, I have Certain values in Columns U & V (derived from certain formula). In column Y3 I am trying to calculate using the below formula…

    =COUNTIFS(S:S,»<«&X3,V:V,U3)
    but I am getting everything as ‘0’.

    Please advice.

    thanks,

    Manish Gupta

    Reply

  53. sonam says:

    May 27, 2016 at 12:08 am

    =COUNTIF($D$9:$D$38,»B»)+COUNTIF($J$9:$J$38,»>=16″)

    with the above formula,I wanted to find out total numbers of boys passed and failed in three subjects,English,Maths,and science.Full mark is 40 and pass mark is 16

    this is my table

    sl Name gender english maths science
    1 Sunny M 22 21 18
    2 mike F 14 12 19
    3 Bunny M 22 21 18
    4 mike F 14 12 19

    so I wanted to find out total boys and girls failed and passed using the formula

    Reply

  54. Jeff H says:

    May 19, 2016 at 5:53 pm

    I have been reading up on this but have been unsuccessful in assembling a working formula to solve my issue.

    I am downloading a YTD sales report weekly and need to report out some key KPI’s.

    The goal is to dump the sales report YTD extract into the model weekly and have all the KPI’s update based on date ranges, dsum logic, etc.

    I need to calculate the # of orders and the # of shipments (referencing a weekly date range).

    The data from the extract has columns for order date, order #, item # and qty.

    I need to calculate shipments, which would be the sum of all the unique order #’s for the date range (there are duplicated order #’s in the data extract).

    I also need to calculate the # of orders by item. This is more tricky as there can be multiple lines for the same item on an order.

    Please let me know if you have some suggestions for a simple formula based solution without sorting the data extract or using a pivot table.

    Thanks in advance for any support.

    Reply

  55. TopX says:

    May 16, 2016 at 4:00 pm

    B1 contains p.qdg2, p.qdg2xh
    B2 contains p.qdg2x, p.qdg2
    B3 contains p.qdg2xfe
    B4 contains p.qdg2

    Need to count number of times p.qdg2 occurs in range B1:B4
    Only p.qdg2 should be counted — not p.qdg2x or p.qdg2xh or p.qdg2xfe
    ie/ result should be 3

    Can anyone can give me the formula please?

    Reply

  56. srinu says:

    May 11, 2016 at 10:53 am

    hi,

    we have to required result how many R0715, R0716, R0718

    R07150101
    R07160110
    R07150122
    R07180129
    R07150132
    R07180137
    R07170139
    R07120147
    R07150163
    R07150168
    R07150172

    Reply

    • Poljakov says:

      May 13, 2016 at 1:04 pm

      If your codes are in coloumn A…

      =COUNTIF(A1:A12,»R0715*»)

      Reply

  57. Neil says:

    May 11, 2016 at 10:46 am

    please help. how to make formula in numbering like this:

    1. MMPSI16040052
    1. MMPSI16040052
    1. MMPSI16040052
    2. MMPSI16040053
    2. MMPSI16040053
    3. MMPSI16040054
    3. MMPSI16040054

    Reply

  58. confused user!! says:

    May 7, 2016 at 2:41 pm

    Hi All,

    Can I count a value that exists in columns rather than cells? For example, I want to know how many columns contain the number say 3, even if a single column has more than once cells that contains «3». I am interested in knowing the number of columns not how many times number «3» exists

    Thanks in advance!

    Reply

    • Jeffrey H says:

      May 9, 2016 at 6:17 pm

      I would start by setting up a helper column containing an IF formula wrapped around a COUNTIF, for each column you are searching. For example, if columns A-F are the ones you are searching, then use G-L for these formulas. Each IF formula is to convert the results of a COUNTIF, into a 0 or 1, indicating whether that column contains that value.

      Then in column M, use a SUM function to add up the results from the Helper columns G-L.

      Reply

    • Vijaykumar Shetye says:

      July 28, 2016 at 9:37 pm

      Below is the formula,

      =COUNTIF(A1:Z100,3)

      Change the range of the cells as required.

      Vijaykumar Shetye, Goa, India

      Reply

  59. Poljakov says:

    May 3, 2016 at 11:04 pm

    I inserted a wrong formula, sorry. Here it is what I tried.

    =COUNTIFS(
    Sheet1!$E$2:$E$5000;»>=»&A2;
    Sheet1!$E$2:$E$5000;»<«&A3;
    Sheet1!$B$2:$B$5000;»C»
    )

    Reply

  60. Poljakov says:

    May 3, 2016 at 5:39 pm

    Hello,

    this makes me really crazy.

    I have 3 different values in a column B and a timestamp in a column E. I have to create a graph with daily sum of values. (Line chart for A, B, C,…)

    Sheet 1
    ========
    A;2016.01.26. 15:55
    A;2016.01.26. 18:11
    A;2016.01.26. 21:10
    A;2016.01.27.,01:02 —> extra comma here
    B;2016.01.27. 10:10
    B;2016.01.27. 10:01
    C;27/01/2016 11:55 —> other time format
    A;2016.01.28. 11:50
    C;2016.01.28. 11:04
    C;Fr 2016.01.28. 12:22 —> extra day field
    B;2016.01.28. 12:09
    A;2016.01.28. 13:31

    I have thousands of records and well, some times the timestamp field has another format or has some error. :/

    Sheet 2
    ========
    Column A contains the date values (for the graph).

    A2 = 2016.01.01
    A3 = 2016.01.02
    .
    .
    .
    A32 = 2016.01.31

    I tried this formula, not worked.

    B2: =COUNTIFS(Sheet1!$E$2:$E$5000;»>=»&A2;Sheet1!$E$2:$E$5000;»=»&A2;Sheet1!$E$2:$E$5000;»=»&A2;Sheet1!$E$2:$E$5000;»<«&A3;Sheet1!$B$2:$B$5000;»C»)

    So, the result matrix should be like this:

    2016.01.01; count-of-A-on-0101; count-of-B-on-0101; count-of-C-on-0101;
    2016.01.01; count-of-A-on-0102; count-of-B-on-0102; count-of-C-on-0102;
    2016.01.01; count-of-A-on-0103; count-of-B-on-0103; count-of-C-on-0103;
    .
    .
    .
    2016.01.31; count-of-A-on-0131; count-of-B-on-0131; count-of-C-on-0131;

    I tried also name the ranges because I’d like to use the autofill function with the date parameters as running values.

    Cheers:

    Poljakov

    Reply

  61. Venkataramanan V says:

    April 29, 2016 at 7:53 am

    Hi
    Value in cell A3 is 10
    I want to check this value tn 4 Different Criteria
    1)Less than 20
    2)Greater than 20 but less than 50
    3)Greater than 50 but less than 80
    4)greater than 80
    Please help
    Regards
    Venkat

    Reply

    • Newbie says:

      May 4, 2016 at 1:01 pm

      Hi Venkat,

      Can you give more details on what you want to do? It looks like you have just 1 cell with a value but multiple mutually-exclusive criteria (10 cannot be less than 20 and also greater than 20). You may want multiple cells that use the COUNTIF function, or if you want to test the same cell for multiple criteria, use COUNTIFS.

      Hope that helps!

      Reply

  62. Newbie says:

    April 25, 2016 at 9:39 pm

    Hello all,

    I’m trying to build a dynamic graph where the x-axis and the data graphed are based on which checkboxes (January 2015, February 2015, …, December 2016) are checked off. If the first checked checkbox is April 2015, I want that to be the first value on the x-axis. Similarly, if October 2016 is the last checked checkbox, I want the graph to end there.

    To accomplish this, I have a table with True/False cells linked to each checkbox. If the checkbox is checked, then the corresponding cell value is TRUE and the cell next to that reads «January 2015» or whatever the corresponding month is.

    If the checkbox is NOT checked, the value is FALSE and the cell next to that is «». I then created a named formula of «Months» that I have defined as =OFFSET(E3:E1000,0,0,COUNTA(E3:E1000),1).

    However, this is counting all the cells with «» in them as not blank, and therefore is graphing all the months (i.e. x-axis is static). How can I define Months as only being the months that are checked off and not also the cells with «» in them?

    Thank you!

    Reply

  63. princess says:

    April 22, 2016 at 5:30 pm

    i mean di ko po alam formula sa lahat na may #name?..

    Reply

  64. princess says:

    April 22, 2016 at 5:28 pm

    Sales Representative Month Amount
    Jones Jan 20,000.00
    Jones Jan 22,500.00
    Rogers Jan 40,000.00
    Rogers Mar 15,000.00
    Rogers Jan 25,000.00
    Franklin Apr 80,000.00
    Franklin Feb 20,000.00
    Jones Feb 35,000.00
    Franklin Jan 12,000.00
    Rogers Feb 90,000.00
    Franklin Feb 75,000.00
    Jones Feb 80,000.00

    Total Sales for January 119,500.00
    Total Sales for February 300,000.00
    Total Sales of Jones 157,500.00
    Total Sales of Franklin 187,000.00
    Total Sales of Jones in January only #NAME?
    Total Sales of Jones in February only #NAME?
    Total Sales of Roger greater than 10000 #NAME?
    Count Sales greater than 20000 8
    Average sales of all agents in January #NAME?

    itong my name po, pwede malaman kung ano formula nito?

    Reply

  65. elamparithi says:

    April 21, 2016 at 9:44 am

    Hi friends i need how to count the status,

    Eg: Category A Category B
    AAA Progress
    AAA Quoted
    AAA Quoted
    BBB Awarded
    CCC Quoted

    I need AAA how many numbers Quoted respectively…

    Reply

  66. ngan Le says:

    April 19, 2016 at 1:46 pm

    I want to count total of student in a certain month , for example: April 2015
    I used =COUNTIF(A3:A4006,»April 2015″) and I got zero.
    it works but I think I missed something. Could you tell me?

    Reply

  67. Thomas Dawson says:

    April 16, 2016 at 11:58 pm

    Hi, I have a spreadsheet that is asking me to add a total of car rentals, there is a yes and no categoery going down to show if the customer is filling the car $65 so I need a function that will sub just the totals for the cust. that have n’s and then sub + the $65 for only the cust with the y’ here is an example.

    A B C D E F
    Date Dys rented Dly.rate T.bfore gas option Total
    gs option
    1 3 49.99 3×49.99 n(no +$65)
    2 1 53.00 2x 53.00 y(+$65)
    3 2 75.00 2×75.00 y (+65)

    on A9 it says $65 , so A9 needs to go in the func and added to the y’s for a grand total.but not added to the n’s. Please help me with this function! The function needs to be in F1 and then I will copy the function down to the rest.

    Reply

  68. Muhammad Shahbaz says:

    April 15, 2016 at 10:37 am

    Hi,

    How to link Hlook up data value with vlookup on a excel workbook between two spreadsheets . if i change a value in Hlookup Sheet it might be automatically change in v lookup sheet .your spurt is required . Thanks in Advance .

    Reply

  69. Cheryl says:

    April 5, 2016 at 4:34 pm

    I am trying to count the number of cells in column j that is between 0 and 91, and that falls between a certain date (ie:4/30/2016)with the dates being in column L

    example: How many people have worked less than 90 days during a particular month.

    Reply

  70. Sanjay says:

    April 4, 2016 at 4:03 am

    How to calculate number of similar value count as 1 by using countifs formula.

    Reply

  71. Judy Fogt says:

    April 3, 2016 at 7:21 pm

    Can you tell what is wrong with COUNT formula? =COUNT(C5:C105,A4)

    Reply

  72. Anna Shaw says:

    April 1, 2016 at 5:38 pm

    I have a PROBLEM which i face to maintain my stock.
    I have some data in shhet1:
    A B
    S/L PRODUCT
    1 CLR 0 R MER 5 R ZU 3 R
    2 FYD 2 R DSR 3 R CLR 0 R
    4 PML 3 R FGH 4 R LKN 0 R
    5 DSR 4 R LKN 2 R ZU 1 R
    NOW IN Sheet2
    A B C
    PRODUCT CODE
    CLIARWAY CLR
    BAG DSR
    SPOON PML
    JUG LKN PROBLEM IS I WANT TO COUNT AND ADD SHHEET 1 PRODUCT QUANTITY IN SHEET2 C CLOUMN E.G.

    A B C
    BAG DSR 7……IS IT POSSIBLE? PLEASE HELP ME THANK YOU.

    Reply

  73. Caitlin says:

    March 31, 2016 at 8:18 pm

    Good Afternoon — I am attempting to count how many non-errors (#N/A) are in a VLookup column. For example, I might have a column of 500 errors, and 3 returned items. I need to know how to count those that are not returned as errors but as values. I can’t seem to find a way to make this return back to me. Any help would be appreciated.

    Reply

  74. praveen says:

    March 18, 2016 at 11:29 am

    Hi madam,
    iam struck with one error problem in excel.
    There is list of students name in columnA : A1:A10
    and also more students name in ColumnE : E1:E10
    Now i want to count, how many times each name is repeated in both columns A and E using countif function.
    Between A and E we have B, C,D columns contains different data columns.

    COUNTIF(range, criteria)
    i am not able to add both range under single criteria in countif function.

    Please help me with the solution.
    How to add two non adjacent column under single criteria.

    =COUNTIF( both range?, «ravi»)

    A B C D E
    1 ravi 435 Teja
    2 sneha 250 sunil
    3 anil 136 ravi
    4 teja 786 sandy
    5 sunil 250 praveen
    6 reena 587 teena
    7 naveen 121 praveen
    8 sunil 456 anitha
    9 teena 454 reena
    10 sunil 895 anil

    Reply

    • Maria Azbel (Ablebits Team) says:

      March 18, 2016 at 12:08 pm

      Hello, Praveen,

      Here you are:
      =COUNTIF(A1:A10, «ravi») + COUNTIF(E1:E10, «ravi»)

      Reply

      • praveen says:

        March 18, 2016 at 4:50 pm

        can it possible to put both ranges A1:A10 and E1:E10 in single array like { A1:A10 E1:E10 } to reduce the formula length.

        Reply

  75. Ngan Trinh says:

    March 16, 2016 at 12:28 am

    Hi bro(s),

    I have a question about using COUNTIFS to count number of rows that have status different from «completed» with the example below:

    Status——-Value
    completed 1
    started 2
    canceled 3
    delayed 5

    Result expectation: 3

    How can I count with the exactly string excluded? Please help me answer, I need your help!

    Many thanks,
    Ngan Trinh

    Reply

    • Maria Azbel (Ablebits Team) says:

      March 18, 2016 at 12:07 pm

      Hello, Ngan,

      Please try the formula below:
      =COUNTIF(A2:A5,»<>»&»completed»)

      here the Status column is in A1:A5

      Reply

  76. Peggie says:

    March 7, 2016 at 5:48 pm

    I want to SUM up a row but the total has to be either a sum up or blank if there is an empty value (a blank cell).
    i.e.
    A B C D(A1+B1+C1)
    1 12 28 30 70
    2 50 20 17 87
    3 10 34 06 50
    4 «Blank»
    5 20 20

    I’ve tried
    =COUNTIF(G17,»>0″)+COUNTIF(H17,»>0″)+COUNTIF(I17,»>0″)

    also

    =SUM(IF(ISBLANK(G17),IF(ISBLANK(H17),IF(ISBLANK(I17),G17+H17+I17,»»))))

    as well as

    =SUM(IF(G17:I17″»,G17:I17,»»))

    The answer of total still wrong.

    How should I set the formula at D?

    Thanks.

    Reply

    • Maria Azbel (Ablebits Team) says:

      March 18, 2016 at 12:06 pm

      Hello, Peggie,

      Please try this one:
      =IF(OR(ISBLANK(A1), ISBLANK(B1), ISBLANK(C1)), «Blank», SUM(A1:C1))

      Reply

  77. Prabin Koirala says:

    March 7, 2016 at 9:30 am

    I want to eliminate duplicate values and I have a problem with count if function, it gives error message even though i entered correct formula.
    The formula i entered in data validation
    =COUNTIF($E$2:$E$100,E2)=1

    can you suggest possible solutions for getting error while using this formula.

    Thanks

    Reply

  78. Duke says:

    March 3, 2016 at 7:19 pm

    I am able to count using countif to get response to a particular column inmy worksheet, e.g, i could write countif(d12..d80,»Pass»). I want to add to this same expression to be able to look at another column, e.g., F and only count Pass where the corresponding number in a new cellF is equal to 10 or any number. How do I add this to the count if expression?

    Thanks

    Reply

  79. Christina says:

    March 2, 2016 at 5:35 pm

    I have a column of UPS, FedEx, and DHL tracking numbers. I am trying to sum up the total # of tracking numbers in that column. How can I do this when the tracking number has both text and number context in it?

    e.g.:
    36006962160000026558847083172014
    1Z9V14091300013079
    7614784914

    Reply

    • Tony says:

      March 2, 2016 at 9:21 pm

      Have you tried using the following code?:
      =COUNTA(A1:A3)

      Reply

  80. Roy says:

    February 27, 2016 at 9:09 am

    Hi Svetlana

    Following on from post 213, I have modified the formula slightly and used it as part of conditional formatting via the «Formula is» new rule and it works perfectly. Is there any way that the identified duplicate rows that meet the formula can be copied to a new sheet next available row? The formula is = AND(ISNUMBER(A1), ISNUMBER(B1), C1=»», D1=»»,COUNTIF(E:E, E1)>1) any help or direction would be much appreciated.

    Reply

  81. Iva says:

    February 26, 2016 at 6:45 pm

    I’m trying to calculate only the number of cells in which the employees start date is less than 90 from there last day worked. These dates are captured on two separate columns for multiple employees. I can’t seem to figure this one out.

    Your help is greatly appreciated.

    Reply

  82. Tony says:

    February 26, 2016 at 5:08 pm

    I have the following data:
    Case Rate
    A 0
    A 2.58
    B 0
    B 0
    C 13.45
    C 0
    C 0
    D 0
    D 0
    D 0

    I need to determine how many of the case groups have a total of Zero. In the above example, it should read 2 case (Case B & D) arethe only one that has a zero total

    Reply

    • Tony says:

      February 26, 2016 at 5:10 pm

      Note — the case letters are only for this example, usually it will be different names

      Reply

      • Tony says:

        February 26, 2016 at 5:35 pm

        I have tried the following formula but it doesn’t produce the results that I am looking for: =COUNTIFS(A2:A16,A2:A16,B2:B16,0)

        Reply

  83. Chris says:

    February 24, 2016 at 8:38 am

    Thanks a million, answered all the questions that Excel-help couldn’t give me (particularly on how to count dates separately from text).

    Keep it up!

    Reply

  84. DJ says:

    February 21, 2016 at 1:18 am

    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:

    Good Day!

    May I know what is the function of «B2» in this example >> =COUNTIF(B2:B10,B2)>1 ?

    Thanks a zillion!

    Reply

  85. Di says:

    February 17, 2016 at 8:02 am

    Hi, I want to count all cells that have numbers only. I have some cells that have NA and I want to exclude those from the calculation.
    thanks,
    Di

    Reply

    • Maria Azbel (Ablebits Team) says:

      February 17, 2016 at 11:37 am

      Hello, Di,

      Please use the count() function.

      Reply

  86. Siri says:

    February 16, 2016 at 5:03 pm

    Help needed… I am trying to read number of cells which match «check» in another excel document and count if formula is not working correctly.I have a document «X1» at «C:UsersXY123DocumentsWork» which I named as sheet1_XLSX(C:UsersXY123DocumentsWorkX1.xlsx). I am using this formula to open and do countif function like this : =Countif(‘[sheet1_xlsx]sheet1_xlsx.xlsx’!$E:$E,»check»). But the formula is returning as #value!.

    Reply

  87. thawfeeque says:

    February 15, 2016 at 1:36 pm

    hi Svetlana, i have created an any year calendar and i want to mention holidays, here in Sri Lanka, the holiday will differ every year, so how i can display holiday by manual for every year?
    Thawfeeque.

    Reply

  88. Roy says:

    February 13, 2016 at 4:27 pm

    Hi Svetlana, I’m trying to identify duplicates in a column based on values in adjacent cells. For example:
    A B C D E
    375 500 Cheddar (D)
    Soft Brie
    125 Hard Cheddar
    125 375 Cheddar (D)
    375 Soft Brie

    A & B are number format; C, D and E are Text format.
    For a duplicate to be correct A & B must have numbers present, C & D must be blank — I have indicated the duplicates here with a (D) but not needed in the formula. If I had hair I would have lost it today trying to figure this out — please help.

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      February 15, 2016 at 10:00 am

      Hi Roy,

      If my understanding of the task is correct, the following formula should work a treat:

      =IF(AND(ISNUMBER(A1), ISNUMBER(B1), C1=»», D1=»»), IF(COUNTIF(E:E, E1)>1, «dupe», «»), «»)

      Reply

      • Roy says:

        February 15, 2016 at 5:03 pm

        REF: 213
        Hi Svetlana many thanks for the quick reply. I was just venturing in to the ISNUMBER function when your solution arrived. Yes it works thank you, however, it doesn’t wait for a comparison before stating «dupe» — my fault for not being very clear. Unless I’m mistaken ISNUMBER only caters for a single cell and not a range — is there a way around this please?

        Reply

        • Svetlana Cheusheva (Ablebits Team) says:

          February 16, 2016 at 11:03 am

          Hi Roy,

          Yes, ISNUMBER accepts only an individual cell in the argument. Sorry, I do not quite understand what you mean when saying «it doesn’t wait for a comparison before stating «dupe». Please specify what cells should be compared.

          The formula I suggested works with the following logic:

          If A1 & B1 have any numbers in them, and C1 & D1 are blank, check column E for duplicate values (i.e. check if the value in E1 occurs in any other cell in column E). If one or more duplicates are found, the formula returns «dupe», an empty string otherwise.

          Reply

          • Roy says:

            February 16, 2016 at 4:48 pm

            Hi Svetlana
            Essentially, when I re-read what I have asked of you, you have responded by producing exactly what I requested — my apologies for the lack of clarity. To keep it its simplest terms, I have a range of cells A1:E20 where a duplicate condition is met when a row has A1 & B1 with numbers in them and both C1 & D1 are blank, E1 would then be checked for duplicate values. However, on the first occasion that this occurs it cannot be considered a duplicate it is a unique value until a second occurrence appears etc. I have been trying COUNTA in place of ISNUMBER, still not quite there but I think it’s the last bit that might be the key.
            Once again apologies for the confusion, I really appreciate what you and the team at Ablebits do in supporting us lesser mortals.

            Reply

            • Svetlana Cheusheva (Ablebits Team) says:

              February 18, 2016 at 9:15 am

              Hi Roy,

              No need to apologize. From my own experience, it’s very difficult to exactly explain/understand the task without seeing the same source data :)

              Please try the following formula. It identifies duplicates without 1st occurrences:

              =IF(AND(ISNUMBER(A1), ISNUMBER(B1), C1=»», D1=»»), IF(COUNTIF($E$1:$E1, $E1)>1, «dupe», «»), «»)

              Is this what you are looking for?

              Reply

              • Roy says:

                February 19, 2016 at 2:23 pm

                Yes Svetlana — works a treat — great job — have a good weekend!

  89. Joe says:

    February 12, 2016 at 3:15 pm

    I have a worksheet that contains all my sales of various products to various customers over several weeks.

    Assuming column B lists the customers, column c lists the products, and columns f to z lists the sales volume sold each week, how can I determine the number of unique customers (col b) that purchased at least 1 of any product in any given week (col f to z)… given that customers could purchase multiple products in any week and be listed multiple times in col b?

    Thanks

    Reply

  90. Lionel Arriola says:

    February 11, 2016 at 8:39 am

    Hi Please im begging for your help on this please.

    i have a problem with countif. how will i count Arriola with more than 2 days? i dont want to count arriola i want to count only arriola with more than 2 days.. please

    A B MORE THAN 2 days
    Lionel 2 Lionel = 0 << LIKE THIS RESULT
    Lionel 2 Arriola = 1
    Arriola 3
    Arriola 1
    Lionel 2
    Arriola 2

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      February 11, 2016 at 10:59 am

      Hi!

      To count cells with 2 or more criteria, you need to use the COUNTIFS function.

      Supposing that «Arriola» is in column and the number of days in column B, you can use the following formula:
      =COUNTIFS(A:A, «Arriola», B:B, «>2»)

      Reply

  91. Sunil says:

    February 5, 2016 at 4:49 am

    A B
    1 Grn:1 11-01-2016
    2 Grn:2 11-01-2016
    3 Grn:2 11-01-2016
    4 Grn:3 11-01-2016

    in this table i want to count in 11-Jan-16 how many GRN I received it should not count double like GRN:2 i received 2 time in same date so i want to count only one time.

    Reply

    • Fedor Shihantsov (Ablebits Team) says:

      February 8, 2016 at 11:31 am

      Hello Sunil,

      I recommend adding a column that will check if the values have duplicates. Then you can use the COUNTIFS function to calculate the result by two criteria.
      https://www.ablebits.com/office-addins-blog/2014/07/10/excel-countifs-multiple-criteria/

      Please see a sample file with the functions that I described:
      https://support.ablebits.com/blog_samples/excel-countif-examples_210.xlsx

      Our Excel add-in that allows to remove duplicate rows can also be helpful for you:
      https://www.ablebits.com/excel-remove-duplicates/index.php

      Reply

  92. Sunil says:

    February 5, 2016 at 4:46 am

    I am having one doubt regarding counting value like

    A B
    1 Grn:1 11-01-2016 in this table i want to count in 11-Jan-16 how
    2 Grn:2 11-01-2016 many GRN I received it should not count double
    3 Grn:2 11-01-2016 like GRN:2 i received 2 time in same date so i
    4 Grn:3 11-01-2016 want to count only one time.

    Please help

    Reply

    • Fedor Shihantsov (Ablebits Team) says:

      February 8, 2016 at 11:35 am

      Hello Sunil,
      Please see a sample file and my next answer:
      https://support.ablebits.com/blog_samples/excel-countif-examples_210.xlsx

      Reply

  93. Noah S says:

    February 5, 2016 at 1:36 am

    Hi Svetlana,

    I am trying to calculate the number of countries with a life expectancy between 50-55,55-60,60-65…etc.
    columnA: country name
    ColumnB: Average life exp.

    would i be able to use the =countif function to find he amount of countries with the given criteria?

    Reply

    • Svetlana Cheusheva (Ablebits Team) says:

      February 5, 2016 at 9:41 am

      Hi Noah,

      To count with multiple criteria, you need to use the COUNTIFS fucntion. For example:

      =COUNTIFS(B:B, «>=50», B:B, «<=55»)

      Reply

      • Chichi says:

        May 31, 2020 at 5:45 am

        So how do you drag it down to reflect the count of the changing range without manipulating the individual cells manually.

        For eg. 50-65
        And next cell will be 70-75, etc

        Reply

  94. Peter says:

    February 2, 2016 at 1:08 pm

    Hello Svetlana

    I have a spreadsheet where i have to count the amount of unique rows in column C that had the value «UDL» in column N.
    Column C can have duplicates so somehow i need to find out how many unique ones there are

    Reply

    • Alexander Frolov (Ablebits Team) says:

      February 2, 2016 at 2:37 pm

      Hello Peter,

      You need the following array formula (remember to press Ctrl + Shift + Enter to complete it):
      =SUM(IF( (—($N1:$N31=»UDL»))*(—(COUNTIF($C$1:$C$31,$C1:$C31)=1)),1,0))

      With row 1 being the first, and row 31 being the last.

      Uniques imply that there is only one occurrence of the value in column C.

      If you need unique values plus the first occurrences of the duplicates, then you need to use a Helper column, e.g. column O, and enter the following formula into its first cell:
      =IF(COUNTIF($C$1:$C1,$C1)=1,»Unique»,»Duplicate»)

      Paste the formula to all cells below.

      Then use the following formula to count:
      =COUNTIFS(N1:N31,»UDL»,O1:O31,»Unique»)

      You can also use the Helper column to count only uniques, then the initial formula should look the following way:
      =IF(COUNTIF($C$1:$C$31,$C1)=1,»Unique»,»Duplicate»)

      Reply

  95. Kodi says:

    February 1, 2016 at 10:28 pm

    Sorry for question.
    found answer as COUNTIFS(A1:A1001,1,B2:B1002,2).
    Thank you anyway.

    Reply

  96. zeeshan says:

    February 1, 2016 at 7:20 am

    i have columns of headings standard MHRs and Actual MHRs I want to count the values in columns heading std mhrs.

    Reply

  97. Kodi says:

    January 31, 2016 at 9:27 pm

    Hi,
    I wonder can you help,please
    When I use COUNTIFS(A:A,A7,B:B,B2) this reads as doubles on same line no matter what the starting numbers.I use this in Lotto results and would like it to read from two different results,in stepwise format A:A,A1,B:B,B2,or is there a better way to do this,thank you in advance.

    Reply

  98. Harshad Nizam says:

    January 27, 2016 at 5:09 pm

    A B

    1 Product Loan Range

    2 Salary Loan <250
    3 Salary Loan <250
    4 Home Mortgage 250 < 350

    Now i want to count how many salary loan under «<250»

    =COUNTIFS(A2:A4,»Salary Loan»,B2:B4,»<250″)
    Here am getting answer is zero. Since it is counting less than 250. But the Salary Loan under loan range «<250» counts 2 times.
    I solved this issue by converting Range B to value 250,250-350,..

    Is there any way to count without changing the format in Range B.

    Reply

  99. Jess says:

    January 26, 2016 at 8:16 pm

    Hello

    I have a question regarding a spreadsheet I am putting together and I am unsure if using counts would be the best way.

    ITEM # | TRANS CODE | DOC DATE
    AA R 10/1/15
    AA R 10/1/15
    AA R 10/2/15
    AB R 10/1/15
    AB R 10/1/15
    AC R 10/2/15

    In the above example I have three part numbers, AA, AB, and AC. Each one is a receipt on the day in the last column.
    I am trying to count the number of receipt days in a week for each part, not just the number of receipts per day.
    So for the AA I would have two receipt days (10/1 and 10/2), for the AB and the AC I would have one receipt day.
    If I were counting the number of receipts would results in AA:3,AB:2,AC:1
    My problem is I can not figure out how to do the code so that way when I type in the part number it returns and then sums the number of receipt days and not the number of receipts.

    Reply

    • Fedor Shihantsov (Ablebits Team) says:

      February 8, 2016 at 12:03 pm

      Hello Jess,

      I recommend adding a column that will check if the values have duplicates
      =IF(COUNTIF(B6:$B$11,B6)=1,»no duplicate»,»has duplicate below»).

      Then you can use a Pivot Table to count filtered values.

      Please see a sample file with the functions that I described:
      https://support.ablebits.com/blog_samples/excel-countif-examples_202.xlsx

      Our Excel add-in that allows to remove duplicate rows can also be helpful for you:
      https://www.ablebits.com/excel-remove-duplicates/index.php

      Reply

  100. Lukas says:

    January 20, 2016 at 9:39 am

    Hello,
    Example: =COUNTIF(‘C:UsersDesktop[test.xlsx]List1’!$B$1:$B$10;B11)
    Why when I close test.xlsx file this function returns #Value!# error?
    (for other functions a link is not problem)
    thank you for your answer, really :)

    Reply

    • Fedor Shihantsov (Ablebits Team) says:

      February 8, 2016 at 12:45 pm

      Hello Lukas,

      Unfortunately I haven’t found a way to get the formula re-calculated correctly without an open book.

      Reply

Older Comments

Newer Comments

Click here to cancel reply.

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we’ll do our best :)

We enter a list of numbers or products and there are some duplicates in the list, if we want to just do count for the unique values and exclude the duplicates, how can we do? Now you can follow the below steps to solve this question by formula quickly.

Prepare a list of products and there are some duplicates among the list. See example below:

Count Only Unique Values Excluding Duplicates 1

And we want to count the total product type in one year, how can we do count?

Count Only Unique Values Excluding Duplicates 2

If we just use sum formula to do count, then duplicates will be included, so we need another formula to do count excludes the duplicates. See steps below.

Table of Contents

  • 1. Count Unique Values Excluding Duplicates by Formula in Excel
  • 2. Count Unique Values Excluding All Duplicates by Formula in Excel
  • 3. Video: Count Only Unique Values Excluding Duplicates
  • 4. Related Functions

Step 1: In E2 which is saved the total product type number, enter the formula:

=SUMPRODUCT(1/COUNTIF(B1:B11,B1:B11))

Where B1:B11 is the range you want to count the unique values.

Count Only Unique Values Excluding Duplicates 3

Step 2: Click Enter and get the result in E2. We can check the result is 6, and the duplicates are not included.

Count Only Unique Values Excluding Duplicates 4

In above sample, we do count for unique values and get the result 6, because we have six products ABCDEF, and if we want to only count the unique values exclude all duplicates like product ABC (they appeared more than one season) how can we do count? See below steps.

2. Count Unique Values Excluding All Duplicates by Formula in Excel

Step 1: In E2 which is saved the total product type number, enter the formula:

=SUM(IF(FREQUENCY(MATCH(B1:B11,B1:B11,0),ROW(B1:B11)-ROW(B1)+1)=1,1))

Where B1:B11 is the range you want to count the unique values.

Count Only Unique Values Excluding Duplicates 5

Step2: Click Enter and get the result in E2. We can check the result is 3 (Product DEF are unique values and only appeared in one season).

Count Only Unique Values Excluding Duplicates 6

3. Video: Count Only Unique Values Excluding Duplicates

If you want to learn how to count only unique values excluding duplicates in Excel, this video will show you a simple and effective formula that you can use in any situation.

  • Excel SUMPRODUCT function
    The Excel SUMPRODUCT function multiplies corresponding components in the given one or more arrays or ranges, and returns the sum of those products.The syntax of the SUMPRODUCT function is as below:= SUMPRODUCT (array1,[array2],…)…
  • Excel COUNTIF function
    The Excel COUNTIF function will count the number of cells in a range that meet a given criteria. This function can be used to count the different kinds of cells with number, date, text values, blank, non-blanks, or containing specific characters.etc.= COUNTIF (range, criteria)…
  • Excel ROW function
    The Excel ROW function returns the row number of a cell reference.The ROW function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the ROW function is as below:= ROW ([reference])….
  • Excel MATCH function
    The Excel MATCH function search a value in an array and returns the position of that item.The syntax of the MATCH function is as below:= MATCH  (lookup_value, lookup_array, [match_type])…
  • Excel IF function
    The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Excel SUM function
    The Excel SUM function will adds all numbers in a range of cells and returns the sum of these values. You can add individual values, cell references or ranges in excel.The syntax of the SUM function is as below:= SUM(number1,[number2],…)…

A lot of the solutions here on SO involve using CountIf to find duplicates. When I have a list of 100,000+ values however, it will often take minutes for CountIf to search for duplicates.

Is there a quicker way to search for duplicates within an Excel column WITHOUT using CountIf?

Thanks!

EDIT #1:
After reading the comments and replies I realize I need to go into greater detail. Let’s pretend I’m a birdwatcher, and after I return from a birdwatching trip I input anywhere from 1 to 25 or 50 new birds that I saw on my trip into my «Master List of Birds Seen». This is really a dynamically growing list, and with each addition I want to make sure I’m not duplicating something that already exists in my list.

So, in column A of my file are the names of the birds. Column B-M might contain other attributes of the birds. I want to know if a bird that I just added in column A after my latest birdwatching trip ALREADY exists somewhere ELSE in my list. And, if it does, I would manually merge the data of the 2 entries and throw away some and keep some after careful review. I clearly don’t want to have duplicate entries of the same bird in my database.

So, ultimately I want some indication that there is or isn’t a duplicate somewhere else, and if there is duplicate please tell me what row to look in (or highlight or color both of the duplicates).

ChrisF's user avatar

ChrisF

134k31 gold badges255 silver badges325 bronze badges

asked Mar 9, 2012 at 17:16

MrPatterns's user avatar

1

The fastest way that I know of (in case you are using Excel 2007/2010/2011) is to use Data (In Ribbon) | Remove Duplicates to find the total number of duplicates OR to remove duplicates. You might want to move data to a temp sheet before you test this.

The 2nd fastest way is to use Countif. Now Countif can be used in many ways to find duplicates. Here are two main ways.

1) Inserting a New Column next to the data and putting the formula and simply copying it down.

2) Using Countif in Conditional formatting to highlight cells which are duplicates. For more details, please see this link.

suggestions for a macro to find duplicates in a SINGLE column

EDIT:

My Apologies :)

Countif is the 3rd fastest way!

The 2nd fastest way is to use Pivot Tables ;)

What exactly is your main purpose of finding duplicates? Do you want to delete them? Or Do you want to highlight them? Or something else?

FOLLOWUP

Seems like I made a typo in the formula. Yes for large number of rows, CountIf does take minutes as you suggested.

Let me see if I can come up with a VBA code to suit your exact needs.

Sid

Community's user avatar

answered Mar 9, 2012 at 17:36

Siddharth Rout's user avatar

Siddharth RoutSiddharth Rout

146k17 gold badges206 silver badges250 bronze badges

9

You can use VBA — the following function returns a list of unique entries within a list of 100,000 in less than a second. Usage: select a range, type the formula (=getUniqueListFromRange(YourRange)) and validate with CTRL+SHIFT+ENTER.

Public Function getUniqueListFromRange(parRange As Range) As Variant
' Returns a (1 to n,1 to 1) array with all the values without duplicates

  Dim i As Long
  Dim j As Long
  Dim locKey As Variant
  Dim locData As Variant
  Dim locUniqueDict As Variant
  Dim locUniqueList As Variant

  On Error GoTo error_handler
  locData = Intersect(parRange.Parent.UsedRange, parRange)

  Set locUniqueDict = CreateObject("Scripting.Dictionary")

  On Error Resume Next
  For i = 1 To UBound(locData, 1)
    For j = 1 To UBound(locData, 2)
      locKey = UCase(locData(i, j))
      If locKey <> "" Then locUniqueDict.Add locKey, locData(i, j)
    Next j
  Next i

  If locUniqueDict.Count > 0 Then
    ReDim locUniqueList(1 To locUniqueDict.Count, 1 To 1) As Variant
    i = 1
    For Each locKey In locUniqueDict
      locUniqueList(i, 1) = locUniqueDict(locKey)
      i = i + 1
    Next
    getUniqueListFromRange = locUniqueList
  End If

error_handler:         'Empty range

End Function

answered Mar 9, 2012 at 17:37

assylias's user avatar

assyliasassylias

319k78 gold badges658 silver badges776 bronze badges

1

If using Excel 2007 or later (which is likely from the 100,000+ values) you can choose:

Home Tab | Conditional Formatting > Highlight Cell Rules > Duplicate Values…

Right-click a highlighted cell and filter by selected cell color to show just the duplicates (be aware however this can be slow with conditional formatting).

Alternatively run this code and filter for colored cells which takes only a second on 100,000 cells:

Sub HighlightDupes()

Dim i As Long, dic As Variant, v As Variant

Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")

i = 1
For Each v In Selection.Value2
    If dic.exists(v) Then dic(v) = "" Else dic.Add v, i
    i = i + 1
Next v

Selection.Font.Color = 255
For Each v In dic
    If dic(v) <> "" Then Selection(dic(v)).Font.Color = 0
Next v

End Sub

Addendum:

To select only duplicate values without code or formulas, i have found this method useful:

Data Tab | Advanced Filter… Filter in Place, Unique Records Only, OK.

Now select the range of unique values and press Alt+; (Goto Special… Visible cells only). With this selection clear the filter and you will see that all unselected cells are duplicates, you can then press Ctrl+9 (Hide Rows) to show just the duplicates. These rows can be copied to another sheet if needed or marked with an «X».

answered Mar 9, 2012 at 22:09

lori_m's user avatar

lori_mlori_m

5,4071 gold badge18 silver badges28 bronze badges

2

You do not mention what you want to do when you find them. If you merely want to see where they are…

Sub HighLightCells()
   ActiveSheet.UsedRange.Cells.FormatConditions.Delete
   ActiveSheet.UsedRange.Cells.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,  Formula1:=ActiveCell
   ActiveSheet.UsedRange.Cells.FormatConditions(1).Interior.ColorIndex = 4
End Sub

answered Mar 9, 2012 at 19:55

datatoo's user avatar

datatoodatatoo

2,0192 gold badges21 silver badges28 bronze badges

1

Preventing Duplicates with Data Validation
You can use Data Validation to prevent you entering duplicate bird names. See Debra Dalgelish’s site here

Handling existing duplicates
My free Duplicate Master addin will let you

  • Select
  • Colour
  • List
  • Delete

duplicates.

But more importantly it will let you run more complex matching than exact strings, ie

  • Case Insensitive / Case Sensitive searches (sample below)
  • Trim/Clean data
  • Remove all blank spaces (including CHAR(160)) see the » mapgie» and «magpie» example below
  • Run regular expression matches (for example the sample below replaces s$ with "" to remove plurals)
  • Match on any combination of columns (ie Column A, all columns, Column A&B etc)

enter image description here

answered Mar 10, 2012 at 0:48

brettdj's user avatar

brettdjbrettdj

54.6k16 gold badges113 silver badges176 bronze badges

I’m surprised that no one has mentioned the RemoveDuplicates method.

ActiveSheet.Range("A:A").RemoveDuplicates Columns:=1

This will simply remove any duplicate entries on the active worksheet in column A. It takes milliseconds to run (tested with 200k rows). Mind you, this will strictly delete all the duplicate entries. Although that isn’t how the original question was worded, I do believe that this still serves your purpose.

answered Jul 11, 2013 at 14:29

user2573063's user avatar

1

One simple way of finding unique values is to use the advance filter and filter for unique values only and copy and paste them into other sheet as when the pivot is removed you will get the whole data with the duplicate in them.

answered Mar 11, 2012 at 5:47

Baala's user avatar

BaalaBaala

11 bronze badge

Sort the range
and in next column put `=if(a2=a1;1;if(a2=a3;1;0))

«1» will be displayed for duplicates.

answered Dec 6, 2014 at 9:52

polaco's user avatar

Skip to content

Excel Logo

Find Duplicates in Excel

Find Duplicates in Excel

It is very easy to find duplicates in Excel. We can use built in tools (Conditional Formats, Filters) or formula (COUNTIF or VLOOKUP)  to find duplicates in Excel Columns or Rows. Let us see the best and easy methods to find duplicate values in Excel.

Find duplicates Using Conditional Formatting

We can easily identify the duplicates using Conditional Formatting Tools in Excel. We can select the range and highlight the duplicate values with color.  Following are the different methods to find duplicate entries in excel and strikethrough the duplicates using Conditional Formatting.

Highlighting duplicate values in Excel

We can highlight the duplicate values in the Excel with specific color. We can change the fill color and font color for the duplicate values. Please follow the below steps to identify the duplicates.

  • Select the required range of cell to find duplicates
  • Go to ‘Home’ Tab in the Ribbon Menu
  • Click on the ‘Conditional Formatting’ command
  • Go to ‘Highlight Cells Rules’ and Click on ‘Duplicate Values…’
  • And Choose the formatting Options from the drop down list and Click on ‘OK’

Now you can see that all the duplicate values are highlighted as shown in the screen-shot.

Highlight Duplicates in Excel

Strike through duplicate values in Excel

We can strike through the duplicate values in the Excel. It is very helpful to strike out all duplicate entries in a range of cells. We can use the conditional formatting command in Excel to strike through the duplicate Cells.

Strike through Duplicates in Excel
  • Select the required range of cell to strike through the duplicates
  • Go to ‘Home’ Tab in the Ribbon
  • Click on the ‘Conditional Formatting’ command
  • Go to ‘Highlight Cells Rules’ and Click on ‘Duplicate Values…’
  • And Choose the Custom Format from formatting Options from the drop down list
  • Select the Strikethrough option from Font effects and Click on ‘OK’

Now you can see that all the duplicate values are stroked out as shown in the screen-shot.

Formula for checking duplicates

We can create formula using COUNTIF or VLOOKUP Functions to check the duplicates in Excel. Following is the step by explanation for finding duplicate values using Excel Formula.

Finding Duplicates using COUNTIF Formula

We can use COUNTIF Formula in Excel Cells to identify duplicates in Excel. COUNTIF formula helps to find duplicates in One Column, returns the number of occurrences of a given value. We can identify the duplicates if the Count is greater than 1. We can create new column to mark the duplicates using Excel COUNTIF Formula.

You can see that we have enter the COUNTIF formula in Range B2 to check the total occurrences of A1 value in the entire Column A:A.This will return the frequency of each Cell value of Column A in Column B.

We can identify the duplicate Cells based on the value in the Column B. If the values is greater than 1, we confirm that the values contains duplicate entries in the specified range or column.

Formula for checking duplicates COUNIF

Mark Duplicates and Unique Entries using Formula

We can enhance the above formula to mark all duplicates in a Column. The following formula will return ‘Duplicate’ if the cell value contains duplicate values, otherwise returns ‘Unique’.

=IF(COUNTIF(A:A,A2)>1,"Duplicate","Unique")

Formula will return ‘Duplicate’ in the Column B if the value repeats (count >1).

It will return ‘Unique’ in the Column B if the count is 1.

Formula for checking duplicates - Mark

Find duplicate values in excel using VLookup

We can use VLOOKUP formula to compare two columns (or lists) and find the duplicate values. Vlookup helps to find duplicates in Two Column and duplicate rows based on Multiple Columns. Following are steps to find duplicates using VLOOKUP function.

We have two lists in the Excel List 1 in Column A and List 2 in Column B. Let us find the duplicate values in the List 2 which are part of List 1.

=VLOOKUP(B2,$A$2:$A$15,1,FALSE)

VLOOKUP Formula will check for the Cell B2 value in the specified Range (A2:A5) and Returns the value if found, it will return #NA if it is not found in List 1. We can confirm if the the value is duplicated in List 1 and 2 if it returns the Value, it will be unique if it returns #NA.

Formula for checking duplicates Vlookup

How to find duplicate values in Excel using VlookUp?

You can use Excel formula to find the duplicate values in Excel by using vlookup formula as described below. You can use the Excel VlookUp to identify the duplicates in Excel.

=IF(ISNA(VLOOKUP(B2,$A$2:$A$15,1,FALSE)),"Unique","Duplicate")
Formula for checking duplicates Vlookup

We can enhance this formula to identify the duplicates and unique values in the Column 2. We can use the Excel IF and ISNA Formulas along with VLOOKUP to return the required Labels.

You can use this method to compare with other worksheets and find duplicate values in Different Excel Sheets.

How to find duplicate values in two columns in excel using VlookUp?

Follow the below steps to find the duplicate values in two columns in excel using VlookUp. We generally need this to compare two columns and check if a value is existing in two columns.

=IF(IF(ISNA(VLOOKUP(C2,$A$2:$A$15,1,FALSE)),0,1)
+IF(ISNA(VLOOKUP(C2,$B$2:$B$15,1,FALSE)),0,1)=2,"Duplicated","Unique")

Here, we have Two Target Columns A and B , we check if the items in Column C are duplicated or not.

If you wants to compare two columns and check for values are repeated in both the columns or not, you can use this formula.

Formula for checking duplicates Vlookup

Share This Story, Choose Your Platform!

2 Comments

  1. Guru
    August 12, 2019 at 7:45 pm — Reply

    Thanks for very useful instructions to check duplicates in Excel.

  2. Tom
    August 12, 2019 at 7:48 pm — Reply

    This is very clear and simple! Thanks a lot for providing clear help to identify the duplicates in Excel.

© Copyright 2012 – 2020 | Excelx.com | All Rights Reserved

Page load link

Block Duplicate Entries in Excel Table

Data validation is a great feature in Excel, and I often use it to create a drop down list in a cell. That helps prevent data entry errors, and limits what people can input. You can use data validation rules in other ways too. For example, you can block duplicate entries in Excel table columns, or in a range of cells.

In this example, employee data is being entered in a formatted table, and each employee must have a unique ID number. The COUNTIF function can check the cells for identical entries, and warn you, or stop you, if an ID number is already in use.

preventduplicatestable02

Use COUNTIF to Check a Range of Cells

To create this data validation rule, I named the data cells in the EmpID column as EmpIDs. This step is necessary, because data validation can’t use the table column name directly.

The good news is that named range is based on a formatted Excel table, so it is dynamic — it will automatically grow or shrink if the number of rows changes. In older versions of Excel, you can use a formula to create a dynamic range.

Then, I used that range name, EmpIDs, in a COUNTIF formula.

=COUNTIF(EmpIDs,A2)<=1

To prevent duplicates, the count must be 1 or zero, and if not, a warning will appear when you enter a duplicate number.

preventduplicatestable01

Add an Error Message

If you enter a duplicate number, the data validation rule will show a default message, telling you to try again, or cancel your entry. You can personalize that message, to help people figure out what they’ve done wrong.

In the screen shot below, the message explains that the entered number is already in use, so you can cancel that, and try a different number.

preventduplicatestable02

You can read the detailed instructions on my Contextures website – Prevent Duplicates in an Excel Table – and see the steps in the video below.

Video: Prevent Duplicate Entries

This video shows the steps for creating a formatted table, naming one of the columns, and setting up the data validation.

Your browser can’t show this frame. Here is a link to the page

______________

Counting duplicate values is a subject that begs definition. What constitutes a duplicate? Within Excel, you can have duplicate values within the same column or you can have duplicate records — a row where every value in the record is repeated.

In this article, we’ll focus on duplicate values within the same column. Once you start counting duplicates, you’ll often discover that you need more. For instance, you might need the opposite — how many unique values are in the column.

There are several ways to count duplicate values and unique values. You can work with most any dataset or download the .xlsx or .xls demonstration file (although specific instructions for the .xls format aren’t included in this article). To read about finding (as opposed to counting) duplicates in Excel, check out my previous article, “How to find duplicates in Excel.”

LEARN MORE: Office 365 Consumer pricing and features

Use COUNTIF()

Figure A shows a COUNTIF() function that gets the job done:

COUNTIF(B:B,B2)

Figure A

COUNTIF() counts duplicate species.

We’re not counting the number of actual duplicates but rather the number of times the value occurs within the given range. If we were counting strictly duplicates, we wouldn’t include the first occurrence of the value.

As you can see, the function returns the correct count, and it’s a quick fix. The main problem with this structure is the B:B reference. It’s great if you add and delete records, but it’ll also evaluate non-contiguous values. If you enter one of the values below to the dataset, the function will add it to the count, as shown in Figure B, even if it’s not in the actual data range.

Figure B

The reference evaluates non-contiguous values.

Removing the duplicates from view

The COUNTIF() is adequate, but you might want a list of unique values rather than the full dataset. In this case, you can use a PivotTable, as shown in Figure C. To create this view, do the following:

  1. Click a Species value (any cell in B2:B5).
  2. Click the Insert tab and then click PivotTable in the Tables group.
  3. Accept all the default values in the resulting dialog — simply click OK.
  4. In the PivotTable Fields list (to the right), drag the Species field to the Row Labels and the Values sections.

Figure C

Dragging the same to both sections forces a unique count.

Using Subtotal

One of the first two solutions will probably satisfy most situations, but you could also use Excel’s Subtotal feature, which evaluates data by groups. However, it’s not as convenient, because you’ll have to sort the data first. If that’s not a problem, or it’s what you’re doing anyway, you might want to consider using the Subtotal feature:

  1. First, sort the data by clicking inside the column you want to sort. Then, click Sort & Filter in the Editing group (on the Home tab), and choose Sort A To Z from the drop-down list.
  2. With the data sorted, click the Data tab.
  3. In the Outline group, click Subtotal.
  4. In the resulting dialog, set the parameters for your data. In this case, select the Species field and specify the Count function (Figure D).
    Figure D
  5. Click OK.

This feature will insert a subtotaling row below each group. In this case, it also displays an optional grand total for the column ( Figure E).

Figure E

There’s now a subtotaling row below each group.

Counting unique values

The flip side of counting duplicates might be to count the number of unique values. The traditional method is to use the SUMPRODUCT() function. This solution has been around for a long time, and I can’t take credit for it. To the best of my knowledge, Excel still doesn’t have a built-in function for counting unique values. When counting unique values, use the following expression:

=SUMPRODUCT((range<>””)/COUNTIF(range,range&””))

Figure F shows this function at work in our example data… sort of.

Figure F

Return the number of unique values in a column.

As you can see, the function

=SUMPRODUCT((B:B<>””)/COUNTIF(B:B,B:B&””))

returns 4 and there are 3 unique values. The problem is the column reference. There’s nothing wrong, but there are actually 4 unique values in column B, because the function evaluates the entire column — including the string Species in B1. If you can delete the header text, this expression works. If you can’t, subtract 1 from the final count, as shown in Figure G.

Figure G

Refining the expression.

Duplicates and more

Within the context of duplicates, definitions aren’t the same. In this case, we used a function and two built-in features to count the number of times a value is repeated in the same range. Then, we used an expression to return the number of unique values in the same range.

Send me your question about Office

I answer readers’ questions when I can, but there’s no guarantee. When contacting me, be as specific as possible: For instance, “Please troubleshoot my workbook and fix what’s wrong” probably won’t get a response, but “Can you tell me why this formula isn’t returning the expected results?” might. I’m not reimbursed by TechRepublic for my time or expertise, nor do I ask for a fee from readers. You can contact me at susansalesharkins@gmail.com.

Affiliate disclosure: TechRepublic may earn a commission from the products and services featured on this page.

Like this post? Please share to your friends:
  • Excel english version download
  • Excel do not calculate on save
  • Excel do not calculate on open
  • Excel do loop exit
  • Excel do loop continue