Saturday, May 20, 2023

How to compare two lists of values in Microsoft Excel? Example

To compare two lists of values in Microsoft Excel, you can use the VLOOKUP or COUNTIF functions. Here's an example of how to do it:


Let's assume you have two lists of values in columns A and B, and you want to compare whether each value in column A exists in column B.

In an empty column (e.g., column C), enter the following formula in cell C1:


excel

=IF(ISNUMBER(VLOOKUP(A1, $B$1:$B$10, 1, FALSE)), "Exists", "Does Not Exist")

This formula uses the VLOOKUP function to search for the value in cell A1 in the range B1:B10. If a match is found, it returns a number, indicating that the value exists in column B. The ISNUMBER function is used to check if the result is a number, and the IF function displays "Exists" if it is true, or "Does Not Exist" if it is false.


Note: Adjust the range B1:B10 to match the actual range of your second list of values in column B.


Drag the formula from C1 down to the last row of your data in column A to apply the formula to the entire column.

Column C will now display "Exists" for the values in column A that are found in column B, and "Does Not Exist" for the values that are not found.


This method allows you to compare two lists of values and identify which values from the first list exist in the second list.

No comments:

Post a Comment