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.