Coding⏱️ 3 min read📅 2026-06-15

How to Fix: Formula error while counting unique entries in Excel

Excel formula error while counting unique entries in a table with merged cells.

Quick Answer: Use the COUNTIF function instead of SUM and IF, as it can handle multiple criteria without errors.

The error 'Formula error while counting unique entries in Excel' occurs when trying to count the number of unique entries in the second column of an Excel table. This issue affects users who have merged cells on the left side of their table and are using a formula to count unique entries in the second column.

This error can be frustrating because it prevents users from accurately counting unique entries, which is essential for data analysis and decision-making. In this troubleshooting guide, we will walk you through the steps to resolve this issue.

🛑 Root Causes of the Error

  • The primary reason for this error is that Excel cannot calculate the length of merged cells using the `LEN` function. When a cell contains multiple merged cells, the `LEN` function returns an incorrect value, causing the formula to fail.
  • An alternative reason for this error may be due to the use of a relative reference in the formula. If the range `C4:C4700` is not adjusted correctly, it can lead to incorrect calculations and errors.

🛠️ Step-by-Step Verified Fixes

Resolving the issue by using absolute references

  1. Step 1: To resolve this issue, you need to adjust the relative reference in your formula to an absolute reference. This will ensure that Excel calculates the correct length of each cell.
  2. Step 2: Select the entire range `C4:C4700` and press `Ctrl + Shift + `$` to convert it to an absolute reference. Then, update the formula to use the absolute reference instead of a relative one.
  3. Step 3: Alternatively, you can also use the `INDEX-MATCH` function combination to achieve the same result without using the `LEN` function.

Using the INDEX-MATCH function combination

  1. Step 1: To use the `INDEX-MATCH` function combination, you need to create a helper column that contains the unique values in the second column. This will allow Excel to correctly identify and count the unique entries.
  2. Step 2: Create a new column next to your data range and enter the following formula: `=MATCH(C4, UNIQUE(C:C), 0)`. This formula returns the relative position of each value in the unique array.

💡 Conclusion

By following these steps, you should be able to resolve the 'Formula error while counting unique entries in Excel' issue and accurately count the number of unique entries in your table.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions