---
title: Comparer.OrdinalIgnoreCase – เปรียบเทียบข้อความแบบไม่สนใจตัวพิมพ์
url: https://www.thepexcel.com/functions/power-query/comparer-functions/comparer-ordinalignorecase/
type: function-explainer
program: Power Query
syntax: "Comparer.OrdinalIgnoreCase(x as any, y as any) as number"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# Comparer.OrdinalIgnoreCase – เปรียบเทียบข้อความแบบไม่สนใจตัวพิมพ์

> ฟังก์ชันเปรียบเทียบแบบไม่สนใจตัวพิมพ์เล็ก/ใหญ่

## คำอธิบาย

Comparer.OrdinalIgnoreCase เป็นฟังก์ชันที่คืนค่าเป็น 'Function' ซึ่งใช้ในการเปรียบเทียบค่า 2 ค่า โดยจะถือว่า "A" และ "a" เท่ากัน (return 0) ใช้เป็น Argument สุดท้ายในหลายๆ ฟังก์ชัน เช่น List.Contains, Text.Contains, Table.Distinct

## Syntax

```excel
Comparer.OrdinalIgnoreCase(x as any, y as any) as number
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| x | Yes | any |  | ค่าแรกที่ต้องการเปรียบเทียบ |
| y | Yes | any |  | ค่าที่สองที่ต้องการเปรียบเทียบ |

## เคสการใช้งาน

### ค้นหาข้อความแบบ Case Insensitive

ใช้กับ List.Contains หรือ Text.Contains เพื่อให้หาเจอไม่ว่าจะพิมพ์เล็กหรือใหญ่

### ลบค่าซ้ำแบบ Case Insensitive

ใช้กับ Table.Distinct หรือ List.Distinct เพื่อมองว่า "Apple" กับ "apple" คือค่าซ้ำกัน

### Join ตาราง

ใช้ในการ Merge Queries เพื่อให้ Key ที่เป็นตัวพิมพ์ต่างกันสามารถจับคู่กันได้

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ใช้กับ List.Contains ค้นหาสถานะ

```excel
List.Contains({"Active", "Inactive", "Pending"}, "active", Comparer.OrdinalIgnoreCase)
```

**ผลลัพธ์:** `true`

ค้นหา "active" ในรายการสถานะ โดยไม่สนใจตัวพิมพ์ใหญ่เล็ก ตรวจสอบเจอ "Active" สำเร็จ

### 2. ตัวอย่างที่ 2: ลบค่าซ้ำแบบ Case Insensitive

```excel
List.Distinct({"Apple", "apple", "APPLE", "Banana"}, Comparer.OrdinalIgnoreCase)
```

**ผลลัพธ์:** `{"Apple", "Banana"}`

ลบค่าซ้ำจากรายการ โดยถือว่า "Apple", "apple", "APPLE" เป็นค่าเดียวกัน เหลือค่าเดียวตามลำดับแรก

### 3. ตัวอย่างที่ 3: เปรียบเทียบโดยตรง

```excel
Comparer.OrdinalIgnoreCase("APPLE", "apple")
```

**ผลลัพธ์:** `0`

คืนค่า 0 (เท่ากัน) เพราะ Comparer.OrdinalIgnoreCase ไม่สนใจตัวพิมพ์ใหญ่เล็ก

## คำถามที่พบบ่อย

**Q: Comparer.OrdinalIgnoreCase ต่างจาก Comparer.Ordinal อย่างไร?**

Comparer.Ordinal สนใจตัวพิมพ์เล็ก/ใหญ่ (Case Sensitive) ดังนั้น "A" ไม่เท่ากับ "a" ส่วน Comparer.OrdinalIgnoreCase ไม่สนใจ (Case Insensitive)

## ฟังก์ชันที่เกี่ยวข้อง

- [Comparer.Ordinal – เปรียบเทียบแบบไบนารี](https://www.thepexcel.com/functions/power-query/comparer-functions/comparer-ordinal/)
- [Comparer.FromCulture – สร้าง Comparer จากวัฒนธรรม](https://www.thepexcel.com/functions/power-query/comparer-functions/comparer-fromculture/)
- [List.Contains – ตรวจสอบว่า List มีสมาชิกที่กำหนดหรือไม่](https://www.thepexcel.com/functions/power-query/list-functions/list-contains/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Comparer.OrdinalIgnoreCase](https://learn.microsoft.com/en-us/powerquery-m/comparer-ordinalignorecase) _(Official Documentation)_
- [PowerQuery.how](https://powerquery.how/comparer-ordinalignorecase/) _(guide)_

---

_Source: [https://www.thepexcel.com/functions/power-query/comparer-functions/comparer-ordinalignorecase/](https://www.thepexcel.com/functions/power-query/comparer-functions/comparer-ordinalignorecase/)_
