This guide covers everything you need to know about the Google Sheets COUNTUNIQUE function, including its definition, syntax, use cases, and how to use it.

## What is the COUNTUNIQUE Function? How Does It Work?

The COUNTUNIQUE function in Google Sheets returns the number of unique values within a specified range or list of values. Essentially, it’s a method of identifying and counting the distinct values present in your data.

This function is particularly useful when working with large sets of data as it allows for the quick identification and counting of unique entries, enabling more precise data analysis.

For instance, if you have a long list of customer transactions, the COUNTUNIQUE function could provide an answer to questions like, “How many unique customers have made purchases?” or “How many different products have been sold?”

The way it works is quite straightforward. When you input a range (for example, A1:C100) or a list of values (like 1,1,2,3,5,8,13) into the function, it will scan through all the numbers, text, or dates present. It will then count each distinct or different entry only once, disregarding any repeated occurrences of the same value.

While the COUNTUNIQUE function is officially specified as taking a maximum of 30 arguments, Google Sheets actually supports an indefinite number of arguments for this function. This means you can potentially input as many ranges or lists of values as you wish, making the function versatile for various analytical tasks.

## COUNTUNIQUE Syntax

The syntax and arguments for the function are as follows:

**COUNTUNIQUE(value1, [value2, …])**

**‘value1’**is the first value or range that you want Google Sheets to consider for uniqueness. This is a required argument.**‘value2, …’**represents additional values or ranges that you want Google Sheets to consider for uniqueness. These are optional arguments.

Here are some important notes about the syntax and arguments of the COUNTUNIQUE function:

- The arguments can be a single number, a single cell reference, or a range of cells.
- If the same value is present in different ranges or cells, it will be counted as one unique value.
- The COUNTUNIQUE function is case-sensitive, meaning it treats lowercase and uppercase versions of the same character as different values.
- The function ignores blank cells in the range while counting unique values.
- If no unique values are found in the specified range or ranges, the function will return 0.
- If the function is used without any arguments, it will return an error.

## Examples of How to Use the COUNTUNIQUE Function

Here are some practical examples of how to use the COUNTUNIQUE function in Google Sheets:

### Example #1: Counting Unique Names in a List

Let’s say you have a list of names in column A, from A2 to A10. Some of the names might be repeated. If you want to count how many unique names are in the list, you can use the COUNTUNIQUE function.

In cell B2, you would type the formula =COUNTUNIQUE(A2:A10). Google Sheets will then return the number of unique names in the list.

### Example #2: Counting Unique Sales Transactions

Suppose you have a list of sales transactions in column B, from B2 to B100, and you want to know how many unique sales transactions were made.

In cell C2, you would enter the formula =COUNTUNIQUE(B2:B100). Google Sheets will then return the number of unique sales transactions.

## COUNTUNIQUE: Common Mistakes & Problems

When using the COUNTUNIQUE function in Google Sheets, it is important to be aware of common mistakes and problems that can lead to incorrect results or error messages. Here are some of the most frequently encountered issues:

**Ignoring Blank Cells**: If your range includes blank cells, COUNTUNIQUE will count these as unique values. To avoid counting blank cells, use a combination of the IF and COUNTUNIQUE functions, such as =COUNTUNIQUE(IF(A1:A10<>””,A1:A10)).**Overlooking Text Case**: COUNTUNIQUE is case-sensitive, which means it treats lowercase and uppercase versions of the same letter as different characters. If you want to count unique values without considering text case, you should use a combination of UPPER (or LOWER) and COUNTUNIQUE functions.**Misunderstanding the Function**: COUNTUNIQUE counts only unique values, not the total number of entries. If you need to count the total number of entries, use the COUNT function instead.**Incorrect Data Types**: The COUNTUNIQUE function can handle numeric, text, and date data types. However, if you mix different data types in the same range, it might lead to unexpected results. Ensure that your data is consistent across the range you are analyzing.**Not Considering Date Formats**: When counting unique dates, keep in mind that Google Sheets considers different date formats as unique values. For example, 1/1/2021, 01/01/2021, and 2021-01-01 are treated as different dates. To avoid this, ensure that all dates in your range are in the same format.

## Why Is COUNTUNIQUE Not Working? Troubleshooting Common Errors

If you’re using the COUNTUNIQUE function in Google Sheets and encountering some issues, you’re not alone. This section will detail common errors that users often encounter, their probable causes, and how to troubleshoot them.

### #VALUE! Error

**Cause**: This error typically occurs when the COUNTUNIQUE function tries to process data that doesn’t match its expected input. For example, if you’ve incorrectly referenced a cell range or used the wrong data type.

**Solution**: Check your formula to ensure you’re referencing the correct cell range. Additionally, make sure that the data you’re trying to count is in the correct format. The COUNTUNIQUE function can handle text, numbers, and dates. If the data types are mixed within the range, consider separating them or changing the data type.

### #REF! Error

**Cause**: This error is often encountered when a cell reference is invalid. This could happen if the reference is to a cell that doesn’t exist, such as a cell in a column that’s been deleted.

**Solution**: Review your formula to ensure that all cell references are valid. If you’ve recently deleted any columns or rows, ensure your formula is updated to reflect these changes.

### #N/A Error

**Cause**: This error generally occurs when the COUNTUNIQUE function can’t find any unique values in the specified range. This can also happen if the function is used in an array formula and the arrays are of different sizes.

**Solution**: Double-check the range you’ve specified in your function. If there are no unique values, consider whether this is expected or if your data needs to be reviewed. If you’re using the function in an array formula, ensure all arrays are of the same size.

### #NULL! Error

**Cause**: This error is usually seen when using a range intersection operator (space) between two ranges that don’t intersect.

**Solution**: Review your formula to ensure that you’re not trying to intersect non-intersecting ranges. If you need to use data from two different ranges, consider using separate COUNTUNIQUE functions for each range or combine the ranges if possible.

### Circular Dependency Error

**Cause**: This error happens when a formula refers back to its own cell, either directly or indirectly, creating a loop that can’t be resolved.

**Solution**: Check your formula to see if it’s referencing its own cell or a range that includes its own cell. If so, revise the formula to eliminate the circular reference.

## Using COUNTUNIQUE With Other Google Sheets Functions

Combining COUNTUNIQUE with other Google Sheets functions can help you perform more complex data analysis. Here are a few examples of how you can use COUNTUNIQUE alongside other functions to solve different problems.

### With SUM

**Usage**: When you want to add all the unique values within a range, you can use the SUM function in combination with the COUNTUNIQUE function.

**Example**: Suppose you have a list of numbers in column A, and you want to add only the unique numbers. You can use the following formula: `=SUM(UNIQUE(A2:A10))`. This formula will first identify the unique values in the range A2:A10 and then add them up.

### With AVERAGE

**Usage**: You may want to find the average of unique values in a range. In this case, you can use the AVERAGE function with the COUNTUNIQUE function.

**Example**: If you have a list of scores in column B and want to find the average of the unique scores, you can use the following formula: `=AVERAGE(UNIQUE(B2:B10))`. This formula will identify the unique scores in the range B2:B10 and then calculate their average.

### With IF

**Usage**: You can use the IF function with the COUNTUNIQUE function to perform a certain action if the count of unique values meets a certain condition.

**Example**: Suppose you have a list of customer IDs in column C and want to find out if there are any duplicate IDs. You can use the following formula: `=IF(COUNTUNIQUE(C2:C10)=COUNTA(C2:C10), “No Duplicates”, “Duplicates Found”)`. This formula will compare the count of unique values with the total count of values. If they are equal, it means there are no duplicates. Otherwise, duplicates are present.

### With CONCATENATE

**Usage**: You can use the CONCATENATE function with the COUNTUNIQUE function to join text and the count of unique values.

**Example**: If you want to create a sentence that includes the count of unique values from column D, you can use the following formula: `=CONCATENATE(“There are “, COUNTUNIQUE(D2:D10), ” unique values.”)`. This formula will count the unique values in the range D2:D10 and then join this count with the rest of the text to form a sentence.

For more details on the COUNTUNIQUE function, check out the official documentation at the Google Docs Editors Help Center.