How to compare two columns in an EXCEL table

Source: Internet
Author: User
Tags first row

Explanation of IF and COUNTIF functions

IF (logical_test, [value_if_true], [value_if_false])
Can't read English? Okay! Explanation:
Logical_test: an expression that returns a boolean value,
That is, TRUE or FALSE (TRUE or FALSE ),
In layman's terms, this is right or wrong,
TRUE (TRUE) if the expression is correct, for example: 1 <2
If the expression is incorrect, it is FALSE, for example, 1> 2,
In addition, the value 0 is false in EXCEL, because the basic language of EXECL is VB, and 0 is false in VB.
The following is simple:
[Value_if_true]: the value that should be obtained when the expression is true.
[Value_if_false]: the value that should be obtained when the expression is FALSE.
COUNTIF (range, criteria)
Range: an area, that is, one or more cells.
Criteria: the content to be compared. It can contain characters, numbers, or cells.
The COUNTIF function returns the comparison content (criteria), the number of occurrences in the cell area (range), and 0 if not.
Example

Assume that table A is sheet1, Table B is sheet2, and the table header is in the same order, that is, the project description sequence of the first row of the two tables is the same, and the workpiece number is placed in column.

Enter the following formula in cell B2 of sheet2:

The code is as follows: Copy code

= IF (ISERROR (VLOOKUP ($ A2, Sheet1! $ A $2: $ Z $10000, COLUMN (), "", VLOOKUP ($ A2, Sheet1! $ A $2: $ Z $10000, COLUMN ()))

Drag and select to copy B2 cells until Z2 (if there are not so many columns, copy them to the last column)
Select B2 to Z2 and drag and drop to copy to 10000 rows (the same way, if there are not so many rows, just copy to the last row)

The "Z" and "10000" in the formula can be changed based on actual needs. It does not matter if it is not changed.

Compare two Excel columns to find the same data

Count by countif. If the count is 0, it does not exist. If the count is greater than 0, it exists. See the following figure.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.