<!-- https://learnsql.cpetoday.com/functions/m/comparer-ordinalignorecase -->
# Comparer.OrdinalIgnoreCase

Language: Power Query M
Category: Splitters and combiners
Syntax: Comparer.OrdinalIgnoreCase
Summary: A comparer that treats text as equal when the letters match, ignoring capital and lower case.
Returns: A comparison function. You pass it to a step that matches values, such as List.Distinct, List.Contains or List.Difference.
Level: Beginner
Related: List.Distinct, List.Contains, List.Intersect, List.Union, List.Difference

## What it does
Many M functions that compare values accept a comparer. Comparer.OrdinalIgnoreCase tells them to ignore capital and lower case when they check whether two text values are the same. Use it for names, codes and free text typed by people, where "ACME", "Acme" and "acme" are the same vendor. Without it, the comparison is exact, and those three would be treated as different.

## Syntax and arguments
- This is a value, not a function you call. Pass it as the optional comparer argument, such as `List.Distinct(list, Comparer.OrdinalIgnoreCase)`.
- The matching is for text. Other types compare as they do by default.

## Example
A vendor list was typed by hand in several offices. The AP team wants a unique list of vendor names to check against the master file.

```powerquery
let
    Typed = {"Acme Supply", "ACME SUPPLY", "acme supply", "Bolt Hardware"},
    Unique = List.Distinct(Typed, Comparer.OrdinalIgnoreCase),
    Count = List.Count(Unique)
in
    Unique
```

`Unique` is {"Acme Supply", "Bolt Hardware"}: the three spellings of Acme are one vendor, and the first form is kept. Without the comparer, all four values would stay.

## Example: a second, different use
Checking whether a code exists regardless of case: `List.Contains(ApprovedCodes, "v-1001", Comparer.OrdinalIgnoreCase)`.

## Things to watch
- It ignores capital letters only. "Acme Supply" and "Acme Supply Inc" are still different.
- Spaces matter. Trim the text first with Text.Trim.
- Use the exact comparer (the default) when case is part of the code, such as an account code where case carries meaning.
- The result keeps the first spelling that appears, so sort or standardize the name if you need one agreed form.

## In business terms
Matching vendor, customer and employee names across systems, and checking codes typed by hand, is much more reliable with case ignored. Record the choice in the query, because it changes which items count as duplicates.
