search
HomeTopicsexcelPractical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

How to count the number of unique data? I guess many friends have read a lot of similar articles, but most of them give formulas and explain them a little. At the time, they understood it, but when they encountered problems, they were confused again. In the final analysis, they still didn’t understand the formula. principle. In fact, understanding the principle of this formula is not as difficult as everyone imagines. As long as you know these two magical skills, you can crack the secret of the formula.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

# Count the number of unique data. I believe many friends have encountered such a problem at work.

The usual approach is to extract the non-duplicate data first and then count the numbers. The method of extracting non-duplicate data has been shared before. There are basically three methods: advanced filtering, pivot table and deleting duplicates.

In fact, it is very convenient to use formulas to count the number of unique data. For example, in the situation below, you need to count the number of unique customers:

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Usually there are two formulas for counting the number of unique data. Today I will share with you the principle of the first formula.

Routine 1: Combination of SUMPRODUCT and COUNTIF

First let’s take a look at the formula input process:

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

The operation is not difficult, but the difficulty is that many people do not understand the principle of the formula =SUMPRODUCT(1/COUNTIF(B2:B23,B2:B23)).

I understand each function individually, but when combined together I feel confused. I believe this is the feeling shared by many beginners. In fact, it is not as difficult to understand the principle of this formula as everyone thinks. As long as you can use a tool called formula evaluation and a function key called F9, you can crack the secret of the formula. The specific process will be introduced below.

Select the cell where the formula is located and click the Evaluate Formula button.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

The usage of this function is very simple, as shown in the figure:

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

The underlined part indicates that it will be displayed soon. As for the location of the results, you can see from the picture that the first thing to calculate is the COUNTIF(B2:B23,B2:B23) part. Click "Evaluate" to see what results you can get.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

We got a set of numbers that represent the number of times each customer code appears. For example, the first 5 means that customer 42337 appears five times. This is also COUNTIF The most basic functionality.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Continue to click "Evaluate" and you can see the results of 1/COUNTIF, as shown in the figure:

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

## Each number obtained by dividing #1 by COUNTIF is a decimal. For example, if it appears five times, the result is 1/5, which is 0.2.

This step is purely numerical calculation and is not difficult to understand. Click evaluate again to get the final result.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Where did this 5 come from?

This is the most frequently asked question. In fact, to put it bluntly, it is still a mathematics problem.

For example, the customer 42337 appears 5 times in total. This is the result calculated by COUNTIF. Then use 1/ again to get 5 0.2, and then sum up to 1.

This calculation process is the core of the formula. The final summation result of each customer is 1, and the total number of customers is the number of non-duplicate customers.

The above are the steps for using formula evaluation to crack the formula principle. For some experienced drivers, they prefer to use the F9 function key to crack the formula.

It is necessary to note that for some keyboards, you must hold down the Fn key and then press F9.

Let’s talk about how to use F9.

To use F9, you must understand the order of calculations in the formula. In other words, which part you want to know, you must select the corresponding content in the edit bar and press the F9 key.

For example, to understand the COUNIF part, you can do this:

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

For the use of F9, it is very important to accurately select the calculation content. One more bracket will An error message is displayed. For example, if you accidentally select the last bracket, pressing F9 will prompt you that there is a problem with the formula.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

After using F9 to display the results, you can click ✖ on the left side of the editing bar, or press the Esc key to exit. If you accidentally press Enter, you can use Undo or the Ctrl Z key combination to return to the original formula.

Routine 2: Combination of COUNT and MATCH

This formula is a little more difficult, let’s take a look at the operation process.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

This formula is an array formula. Remember to press Ctrl Shift and Enter after completing the input. Braces will automatically appear on both sides of the formula.

Formula=COUNT(1/(MATCH(B2:B23,B2:B23,0)=ROW(1:22)))Three functions are used, COUNT, MATCH and ROW, regardless of operation or principle, this formula is more difficult than the first formula.

So why do we need to introduce this formula?

This is because some of the ideas and methods used in this formula will be encountered repeatedly in many powerful formulas. Therefore, understanding the second routine will help improve the ability to use the formula.

Getting back to the topic, let’s use formula evaluation to crack the principle of this formula.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Simply speaking, MATCH has three parameters, search value, search area and search method. What the formula obtains is the position where the search value first appears in the search area. Click to find value to see the result.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Let’s look at customer 42337, which appears five times in total. The results obtained by the MATCH function are all 1, indicating that the position where this customer first appeared is 1.

It should be emphasized that this 1 is the position in the search range, and our search range starts from the second line.

For this set of data obtained by MATCH, you must understand its meaning. Continue point evaluation to get the result of this part of ROW.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

ROW can get the row number corresponding to the parameter. For example, ROW(A1), the result is 1, and ROW(1:22), the result is the first 22 rows. Number, that is, the group of numbers 1 to 22.

Note that the range in the formula MATCH(B2:B23,B2:B23,0)=ROW(1:22) is different. MATCH is from 2 to 23 rows, which is actually 22 rows of data, while ROW The range is based on the actual number of rows of data.

Continue to evaluate. The formula will determine whether the set of data obtained by MATCH is consistent with the set of data obtained by ROW. The result is a set of logical values.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

It can be found from the results that the formula result is TRUE at the position where each customer first appears.

It is necessary to popularize the knowledge of logical values ​​here.

There are six comparison symbols in Excel, = (equal to), > (greater than), (less than), >= (greater than or equal to), (less than or equal to), (not equal to) , equal to is used in this example.

The result of the comparison is a logical value. There are two logical values, TRUE and FALSE. TRUE means the result is correct, and FALSE means the result is incorrect.

For example, 1>2, the result of this comparison is FALSE.

When logical values ​​are used for addition, subtraction, multiplication, and division with numbers, TRUE is equivalent to 1, and FALSE is equivalent to 0.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

In this step of calculation, the number 1 and this set of logical values ​​are used for calculation. When the denominator is TRUE, 1/1 gets 1; when the denominator is FALSE When 1/0 will get the wrong value, the denominator is zero.

Click evaluate to see the result.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

If you understand the above principles, the final result will be easy to understand.

Because COUNT only does one thing, counting several numbers. In this set of results, only five 1's are numbers, so the final result is 5.

Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!

Many times, 1/ is replaced by 0/. Maybe this is a habit of experts.

When you truly understand the principles of the formula, 1/ and 0/ will no longer be the cause of your troubles.

This concludes the analysis of the principle of the second formula. In this formula, many common skills used in advanced formulas are used, such as using ROW to obtain an array, and using various comparison operations to obtain a set of logical values. , and then obtain some error values ​​through calculation of logical values ​​(error values ​​are not useless at all). There is no difference in most cases except for some special cases whether to use 0/ or 1/.

Okay, the analysis of the two formulas for counting the number of non-duplicate data has come to an end. If you still encounter any formulas that cannot be cracked, you can leave a message and tell the editor, and we will figure it out together.

Related learning recommendations: excel tutorial

The above is the detailed content of Practical Excel skills sharing: Two magical skills will help you see the secret of counting unique numbers!. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:部落窝教育. If there is any infringement, please contact admin@php.cn delete
MEDIAN formula in Excel - practical examplesMEDIAN formula in Excel - practical examplesApr 11, 2025 pm 12:08 PM

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

Google Spreadsheet COUNTIF function with formula examplesGoogle Spreadsheet COUNTIF function with formula examplesApr 11, 2025 pm 12:03 PM

Master Google Sheets COUNTIF: A Comprehensive Guide This guide explores the versatile COUNTIF function in Google Sheets, demonstrating its applications beyond simple cell counting. We'll cover various scenarios, from exact and partial matches to han

Excel shared workbook: How to share Excel file for multiple usersExcel shared workbook: How to share Excel file for multiple usersApr 11, 2025 am 11:58 AM

This tutorial provides a comprehensive guide to sharing Excel workbooks, covering various methods, access control, and conflict resolution. Modern Excel versions (2010, 2013, 2016, and later) simplify collaborative editing, eliminating the need to m

How to convert Excel to JPG - save .xls or .xlsx as image fileHow to convert Excel to JPG - save .xls or .xlsx as image fileApr 11, 2025 am 11:31 AM

This tutorial explores various methods for converting .xls files to .jpg images, encompassing both built-in Windows tools and free online converters. Need to create a presentation, share spreadsheet data securely, or design a document? Converting yo

Excel names and named ranges: how to define and use in formulasExcel names and named ranges: how to define and use in formulasApr 11, 2025 am 11:13 AM

This tutorial clarifies the function of Excel names and demonstrates how to define names for cells, ranges, constants, or formulas. It also covers editing, filtering, and deleting defined names. Excel names, while incredibly useful, are often overlo

Standard deviation Excel: functions and formula examplesStandard deviation Excel: functions and formula examplesApr 11, 2025 am 11:01 AM

This tutorial clarifies the distinction between standard deviation and standard error of the mean, guiding you on the optimal Excel functions for standard deviation calculations. In descriptive statistics, the mean and standard deviation are intrinsi

Square root in Excel: SQRT function and other waysSquare root in Excel: SQRT function and other waysApr 11, 2025 am 10:34 AM

This Excel tutorial demonstrates how to calculate square roots and nth roots. Finding the square root is a common mathematical operation, and Excel offers several methods. Methods for Calculating Square Roots in Excel: Using the SQRT Function: The

Google Sheets basics: Learn how to work with Google SpreadsheetsGoogle Sheets basics: Learn how to work with Google SpreadsheetsApr 11, 2025 am 10:23 AM

Unlock the Power of Google Sheets: A Beginner's Guide This tutorial introduces the fundamentals of Google Sheets, a powerful and versatile alternative to MS Excel. Learn how to effortlessly manage spreadsheets, leverage key features, and collaborate

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.