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

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

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

## คำอธิบาย

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

## Syntax

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

## Arguments

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

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

### ค้นหาความผิดปกติ (Anomaly Detection)

ตรวจสอบว่าในรายการข้อมูลมีค่าที่ผิดปกติ หรือ Error ปะปนอยู่หรือไม่

### ตรวจสอบเงื่อนไขแบบ 'มีบ้างไหม'

เช่น ตรวจสอบว่ารายการสั่งซื้อนี้มีสินค้าประเภท 'อันตราย' ปนอยู่ด้วยหรือไม่

## ตัวอย่าง

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

```excel
List.MatchesAny({9, 10, 11}, each _ > 10)
```

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

มีสมาชิกหนึ่งตัวคือ 11 ที่มากกว่า 10 จึงคืนค่า true

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

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

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

ไม่มีสมาชิกตัวใดเลยใน List ที่มากกว่า 10 จึงคืนค่า false

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

```excel
List.MatchesAny({"Fox", "Dog", "Cat"}, each Text.Contains(_, "cat", Comparer.OrdinalIgnoreCase))
```

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

ตรวจสอบว่ามีคำใดที่มีคำว่า "cat" ผสมอยู่หรือไม่ (ไม่สนตัวพิมพ์เล็ก-ใหญ่) พบ "Cat" จึงคืนค่า true

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

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

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

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

- [List.MatchesAll – ตรวจสอบว่าสมาชิกทุกตัวตรงตามเงื่อนไขหรือไม่](https://www.thepexcel.com/functions/power-query/list-functions/list-matchesall/)
- [List.AnyTrue – ตรวจสอบว่ามีสมาชิกบางตัวเป็น True](https://www.thepexcel.com/functions/power-query/list-functions/list-anytrue/)
- [List.ContainsAny – ตรวจสอบว่า List มีสมาชิกบางตัวจากอีก List หรือไม่](https://www.thepexcel.com/functions/power-query/list-functions/list-containsany/)

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

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

---

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