search
HomeTopicsexcelExcel function learning: Let's talk about how to use countif() (detailed case explanation)

In the previous article "Excel function learning: How to quickly count working days, take a look at these two functions! 》, we learned two working day functions. Today we are going to learn countif() and share 5 cases of countif function checking for duplicates. Come and take a look!

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

There are some very classic function combinations in Excel. The more familiar ones are the INDEX-MATCH combination and the INDEX-SMALL-IF-ROW combination (also called Tiger Balm). combination), of course there are many other combinations. The combination shared today is also very useful. Below, we will use four common questions to let everyone witness the wonderful moments brought by this combination. Of course, we still need to get to know the two people today. Two protagonists: COUNTIF and IF, two functions that everyone is very familiar with.

How to use the COUNTIF function: COUNTIF (range, condition), the function can get the number of times that data that meets the conditions appears in the range. Simply put, this function is used for conditional counting;

Usage of the IF function: IF (condition, result that satisfies the condition, result that does not satisfy the condition), in one sentence, if you give IF a condition (the first parameter), when the condition is established, it will return a result (the second parameter) parameter), when the condition is not met, another result is returned (the third parameter).

Regarding the basic usage of these two functions, I have talked about it many times in previous tutorials, so I won’t go into details here. Let’s take a look at the first problem that occurred after the two of them met: When checking orders The question on

Assume that column A is all the order numbers, and column D is the order number that has been shipped. Now you need to mark the shipped orders in column B (in order to prevent everyone from being dazzled, The arrows only point out two corresponding order numbers):

Excel function learning: Lets talk about how to use countif() (detailed case explanation)

I think you must be familiar with this question. This question is in the reconciliation I use it often, and maybe some friends can’t wait to shout VLOOKUP. In fact, the formula in column B is like this:

=IF(COUNTIF(D:D,A2)> 0,"shipped","")

Excel function learning: Lets talk about how to use countif() (detailed case explanation)

First use COUNTIF to make statistics and see that the order number in cell A2 is in D The column appears several times. If it does not appear, it means it has not been shipped. Otherwise, it means it has been shipped.

Therefore, use COUNTIF(D:D,A2)>0 as the condition of IF. If the order appears in column D (the number of occurrences is greater than 0), then "shipped" is returned (note that Chinese characters must be added quotes), otherwise it returns blank (two quotes represent blank).

Now that you understand the first question, let’s look at the second question: COUNTIF to check duplicate cases: How to find duplicate orders

Column A comes from multiple After summarizing the order statistics table registered by the clerk, it is found that some are duplicates (for the convenience of viewing, you can sort the order numbers first). Now you need to mark the duplicate orders in column B:

Excel function learning: Lets talk about how to use countif() (detailed case explanation)

This is also a problem with a very high ranking rate, and the solution is also very simple. The formula in column B is:

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

Excel function learning: Lets talk about how to use countif() (detailed case explanation)

##Similar to the previous question, this time it is calculated directly The number of times each order appears in column A, but the condition needs to be changed. It is not greater than 0 but greater than 1. This is also easy to understand. Only orders that appear more than 1 are duplicate orders, so use COUNTIF(A:A ,A2)>1 as the condition, and then let IF return the result we need.

When duplicate orders are found, the third question arises. You need to specify whether to keep the information after the order number. If there are duplicates, keep one:

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

This problem seems quite troublesome at first glance. In fact, it can be achieved by slightly modifying the formula of question 2: =IF(COUNTIF($ A$2:A2,A2)=1,"Keep","")

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

Note the COUNTIF here, the range is no longer The entire column is $A$2:A2. This way of writing will change the statistical range as the formula is pulled down. The result is as follows:

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

It is not difficult to see that the order number with a result of 1 is the first time it appears, which is also the information we need to retain, so when it is used as a condition, equal to 1 is used.

The first three questions are all related to the order number, and the last question is related to Supplier Assessment, which is the key issue that determines whether the contract can be renewed.

According to company regulations, there are six assessment indicators for each supplier. A is the best and E is the worst. If there are two or more E's in the six indicators, the contract will not be renewed. :

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

The rules are relatively simple. Let’s see if the formula is equally simple:

=IF(COUNTIF (B2:G2,"E")>1,"No","")

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

This time the range of COUNTIF changes OK, count the number of occurrences of "E" in the range B2:G2. Also pay attention to adding quotation marks. When the statistical result is greater than 1, it means that the supplier has more than two negative reviews (if you insist Use greater than or equal to 2, I have no objection), and then use IF to get the final result.

The last question I want to talk about must be familiar to partners in financial positions. Sometimes we will encounter this situation: There is a positive and a negative situation in a column of data. At this time, it is necessary to change the future The offset data is marked (extracted) , such as the example in the picture:

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

This problem may have caused headaches for many people. In fact, using Today's combination of these two functions is easy to solve. The formula is:

=IF(COUNTIF(A:A,-A2)=0,A2,"")

Excel function learning: Let's talk about how to use countif() (detailed case explanation)

Pay attention to the condition -A2 in COUNTIF here, that is, find the number that can cancel each other out with A2. If not, get A2 through IF, and vice versa. Null value, using a negative sign cleverly solves a troublesome problem.

Through the above five cases, you may have a feeling that the combination of these two functions is relatively easier to understand than some other function combinations. As long as you find the right idea, this combination can be used for many problems. to handle. This is also true. If you are good at using COUNTIF to count various conditions, and then use the IF function to get more diverse results, ifcountif is often used to filter duplicate data. Solving problems does not necessarily require difficult functions. It is also very pleasant to use simple functions well.

Related learning recommendations: excel tutorial

The above is the detailed content of Excel function learning: Let's talk about how to use countif() (detailed case explanation). 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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

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.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

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.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.