Compare cell contents

Microsoft Office Excel 2003

Use the EXACT function to do this task.

Worksheet example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow?

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic. Do not select the row or column headers.

    Selecting an example from Help

    Selecting an example from Help

  3. Press CTRL+C.
  4. In the worksheet, select cell A1, and press CTRL+V.
  5. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
3
4
A
Data
BD122
BD123
BD123
Formula Description (Result)
=EXACT(A2,A3) Compare contents of A2 and A3 (FALSE)
=EXACT(A3,A4) Compare contents of A3 and A4 (TRUE)

Note  EXACT is case-sensitive but ignores formatting differences.

Function details

EXACT

ShowCompare one value to a list of values

Use the EXACT and OR functions to do this task.

Worksheet example

The example may be easier to understand if you copy it to a blank worksheet.

ShowHow?

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic. Do not select the row or column headers.

    Selecting an example from Help

    Selecting an example from Help

  3. Press CTRL+C.
  4. In the worksheet, select cell A1, and press CTRL+V.
  5. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
3
4
A B
List Cell
Apple Grape
Orange
Banana
Formula Description (Result)
=OR(EXACT(B2, A2:A4)) Compares "Grape" to each value in the list (FALSE)

Note  The formula in the example must be entered as an array formula. After copying the example to a blank worksheet, select each formula cell individually. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the error #VALUE! is returned.

The formula above uses the following syntax:

=OR(EXACT(TestValue, CompareRange))

TestValue refers to a cell containing a user-entered value; CompareRange refers to a list of text values to be compared against.

Function details

OR

EXACT