search
HomeTopicsexcelEasily check data under any conditions in Excel

This article brings you relevant knowledge about excel, which mainly organizes the related issues of querying data under any conditions. How to implement data query? The left side is the employee information table, and the right side is the query. Area, I hope that by entering any name or any department in G4, all records that meet the conditions can be extracted on the right side. Let’s take a look at it. I hope it will be helpful to everyone.

Easily check data under any conditions in Excel

Related learning recommendations: excel tutorial

To share a content related to data query, first look at the data source:

Easily check data under any conditions in Excel

The left side is the employee information table, and the right side is the query area. If you want to enter any name or any department in G4, you can extract all records that meet the conditions on the right side.

Easily check data under any conditions in Excel

#To achieve such a data extraction effect, it is actually very simple. Next, let’s take a look at the specific steps.

Step 1

Enter the content to be queried in cell G4, such as Sales Department.

Step 2

On the left side of the first row of data, in this case cell A4, enter the following formula and drag down:

=(C4=G $4) (B4=G$4) A3

Easily check data under any conditions in Excel

What does the formula mean?

If the department in cell C4 is equal to the department to be queried by G4, or the name in cell B4 is equal to the name to be queried in cell G4, add 1 to the previous cell. Otherwise, it remains the content of the previous cell.

Observe the effect of the drop-down formula. You can see that as long as the department name in column C is equal to the department in cell G4, the result is exactly a series of increasing serial numbers 1...2...3...

What are these serial numbers used for? Don't worry, look down.

Step 3

Enter the formula in cell I4, copy it to the right and down, and you can get the query results:

=IFERROR(VLOOKUP(ROW(A1), $A:$E,COLUMN(B1),0),"")

Easily check data under any conditions in Excel

What does this formula mean?

The protagonist here is the VLOOKUP function. The content to be queried is ROW(A1). The function of ROW is to return the row number where the parameter is located. The result obtained here is the row number of A1 - 1. When the formula When copied downward, it will become ROW(A2), ROW(A3)..., and the result is the increasing sequence number 1, 2, 3... starting from 1.

In other words, the search content of the VLOOKUP function is different in different rows. In the fourth row, the search content is 1, and when the formula reaches the fifth row, the query content is 2.

Let’s take a look at the area queried by the VLOOKUP function? $A:$E, this writing method represents the entire column area of ​​columns A~E, and uses absolute references.

Speaking of which, some friends already know what the serial numbers we obtained using the formula are used for. Yes, they are used to assist VLOOKUP queries.

The characteristic of the previous sequence number is that every time it encounters a record that meets the conditions, the sequence number is added by 1, and the content to be queried by VLOOKUP is the sequence number 1, 2, 3...

Let’s look at COLUMN What is (B1) used for? Its function is similar to the ROW function. It returns the column number of the parameter, COLUMN(B1), and the result is the column number 2 of B1. When the formula is copied to the right, it will turn into COLUMN (C1), COLUMN (D1)..., and the result is the incremental serial number starting from 2, 2, 3, 4...

The obtained serial number is then given to the VLOOKUP function When Xiaosan, no, it is used as the third parameter, used to specify which column in the query area is returned.

When the formula is in column I, the content of the second column of the query area is returned. If the formula is copied to the right to column J, the content of the third column of the query area is returned, and so on.

My friends may say that there are so many repeated serial numbers in column A. It doesn't matter, because the VLOOKUP function has a characteristic that if there are multiple records that meet the conditions, only the first one will be returned. So when you query 1 in cell I4, you get the name Orchid corresponding to serial number 1, and when you query 2 in cell I5, you get the name Zaohua corresponding to serial number 2...

The outermost IFERROR is Qian What is it used for? She is used to shield VLOOKUP from error values.

Because the query sequence number in each row of VLOOKUP is different, when the formula keeps pulling down, the sequence number will continue to increase. When the query sequence number does not appear in column A, it means that there are not so many records on the left If the content meets the conditions, the formula will return an error value. Therefore, we use the IFERROR function to turn the error value into empty text.

Related learning recommendations: excel tutorial

The above is the detailed content of Easily check data under any conditions in Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel Home. 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 Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

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.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool