top of page

MS Excel: EXACT function to compare two text strings

  • Writer: Fakhriddinbek
    Fakhriddinbek
  • 4 days ago
  • 2 min read

The EXACT function in Excel is used to compare two text strings and determine whether they are exactly the same—including case sensitivity. Unlike the regular equality operator (=), which ignores case, EXACT will only return TRUE if both text strings match exactly in content and case.


Excel spreadsheet with an open Function Arguments dialog for the EXACT function, displaying fields for Text1 and Text2. Toolbar above.

This makes EXACT particularly useful in scenarios like:

  • Validating user input

  • Comparing case-sensitive IDs or passwords

  • Matching sensitive product codes

  • Detecting inconsistencies in manually entered data


Syntax


=EXACT(text1, text2)


Parameters:


Argument

Description

text1

The first string or cell to compare

text2

The second string or cell to compare


Returns: TRUE if the texts are exactly the same (including case), otherwise FALSE.


Examples with Tables


Example 1: Identical Text, Same Case


=EXACT("Excel", "Excel")


Formula

Result

=EXACT("Excel", "Excel")

TRUE


Example 2: Identical Text, Different Case


=EXACT("Excel", "excel")


Formula

Result

=EXACT("Excel", "excel")

FALSE


Case matters! The lowercase "e" makes this comparison fail.


Example 3: Compare Cell Values


Assume:

  • A1 = Admin

  • B1 = admin


=EXACT(A1, B1)


A1

B1

Formula

Result

Admin

admin

=EXACT(A1, B1)

FALSE


Example 4: Use in Validation with IF


=IF(EXACT(A1, B1), "Match", "Mismatch")


A1

B1

Output

Report1

Report1

Match

Report1

report1

Mismatch


Why Use EXACT Instead of =


Method

Case-Sensitive

Use When...

=A1=B1

❌ No

You only care about value equality

EXACT

✅ Yes

Case accuracy is important


Summary


Feature

Description

Function Name

EXACT

Purpose

Compare two text strings, case-sensitive

Output Type

TRUE or FALSE (Boolean)

Case Sensitivity

✅ Yes

Common Uses

Data validation, QA, matching sensitive fields


Notes and Limitations

  • EXACT does not ignore trailing spaces. "Excel " ≠ "Excel"

  • Works only with text comparisons (non-text values are coerced to text).

  • Useful in data cleaning and validation pipelines.


Related Functions


Function

Purpose

=

Compares values (not case-sensitive)

IF

Uses EXACT for conditional output

TEXT

Formats numbers as text before comparing

LOWER, UPPER

Convert strings to standard case for broader matching


Final Thoughts


The EXACT function is an essential tool for accurate string comparisons, especially when case sensitivity matters. Whether you're cleaning up data, validating inputs, or comparing key codes—EXACT ensures precision that regular = checks may miss.

Comments


bottom of page