---
title: List.MatchesAll – ตรวจสอบว่าสมาชิกทุกตัวตรงตามเงื่อนไขหรือไม่
url: https://www.thepexcel.com/functions/power-query/list-functions/list-matchesall/
type: function-explainer
program: Power Query
syntax: "List.MatchesAll(list as list, condition as function) as logical"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 4
  usefulness: 4
---

# List.MatchesAll – ตรวจสอบว่าสมาชิกทุกตัวตรงตามเงื่อนไขหรือไม่

> ตรวจสอบเงื่อนไขของสมาชิกทุกตัวใน List

## คำอธิบาย

List.MatchesAll คืนค่า true หากสมาชิกทุกตัวใน List ผ่านเงื่อนไขที่กำหนด

## Syntax

```excel
List.MatchesAll(list as list, condition as function) as logical
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| list | Yes | list |  | List ที่ต้องการตรวจสอบ |
| condition | Yes | function |  | ฟังก์ชันเงื่อนไขที่ใช้ตรวจสอบสมาชิกแต่ละตัว (มักใช้ 'each ...') |

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

### ตรวจสอบคุณภาพข้อมูล (Data Validation)

ตรวจสอบว่าข้อมูลทั้งคอลัมน์เป็นไปตามกฎที่กำหนดหรือไม่ เช่น ตัวเลขทุกตัวต้องมากกว่า 0

### กรองข้อมูลขั้นสูง

ใช้ตรวจสอบกลุ่มข้อมูล (เช่น Grouped Table) ว่ารายการย่อยในกลุ่มนั้นผ่านเกณฑ์ทั้งหมดหรือไม่

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ตรวจสอบตัวเลข

```excel
List.MatchesAll({11, 12, 13}, each _ > 10)
```

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

สมาชิกทุกตัว (11, 12, 13) มีค่ามากกว่า 10 จึงคืนค่า true

### 2. ตัวอย่างที่ 2: เงื่อนไขไม่ผ่าน

```excel
List.MatchesAll({1, 2, 3}, each _ > 10)
```

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

สมาชิกทุกตัว (1, 2, 3) ไม่ได้มากกว่า 10 (แค่ตัวเดียวไม่ผ่านก็เป็นเท็จทันที) จึงคืนค่า false

### 3. ตัวอย่างที่ 3: ตรวจสอบข้อความ (Case Insensitive)

```excel
List.MatchesAll({"Savannah", "Annabelle", "MANNA"}, each Text.Contains(_, "anna", Comparer.OrdinalIgnoreCase))
```

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

ตรวจสอบว่าทุกคำมีคำว่า "anna" ผสมอยู่หรือไม่ โดยไม่สนใจตัวพิมพ์เล็ก-ใหญ่ (Savannah, Annabelle, MANNA มีทั้งหมด) จึงคืนค่า true

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

**Q: List.MatchesAll ต่างจาก List.AllTrue อย่างไร?**

List.AllTrue รับ List ของค่าตรรกะ (true/false) โดยตรง ส่วน List.MatchesAll รับ List ของข้อมูลทั่วไปแล้วใช้ฟังก์ชันเงื่อนไข (each ...) เพื่อประเมินค่าตรรกะอีกที

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

- [List.MatchesAny – ตรวจสอบว่ามีสมาชิกบางตัวตรงตามเงื่อนไขหรือไม่](https://www.thepexcel.com/functions/power-query/list-functions/list-matchesany/)
- [List.AllTrue – ตรวจสอบว่าสมาชิกทุกตัวเป็น True](https://www.thepexcel.com/functions/power-query/list-functions/list-alltrue/)
- [List.Select – เลือกสมาชิกจาก List ตามเงื่อนไข](https://www.thepexcel.com/functions/power-query/list-functions/list-select/)

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

- [Microsoft Learn: List.MatchesAll](https://learn.microsoft.com/en-us/powerquery-m/list-matchesall) _(Official Documentation)_

---

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