---
title: List.ContainsAll – ตรวจสอบว่า List มีสมาชิกทั้งหมดจากอีก List หรือไม่
url: https://www.thepexcel.com/functions/power-query/list-functions/list-containsall/
type: function-explainer
program: Power Query
syntax: "List.ContainsAll(list as list, values as list, optional equationCriteria as any) as logical"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# List.ContainsAll – ตรวจสอบว่า List มีสมาชิกทั้งหมดจากอีก List หรือไม่

> ตรวจสอบการมีอยู่ของสมาชิกทั้งหมดใน List

## คำอธิบาย

List.ContainsAll คืนค่า true ถ้า List หลักมีสมาชิกครบทุกตัวที่ระบุใน List ที่สอง

## Syntax

```excel
List.ContainsAll(list as list, values as list, optional equationCriteria as any) as logical
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| list | Yes | list |  | List ที่ต้องการค้นหา |
| values | Yes | list |  | List ของค่าที่ต้องการตรวจสอบว่ามีอยู่ใน List แรกหรือไม่ |
| equationCriteria | No | any | null | ตัวเลือกเสริมสำหรับกำหนดเกณฑ์การเปรียบเทียบ (เช่น Comparer.OrdinalIgnoreCase) |

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

### ตรวจสอบความสมบูรณ์ของชุดข้อมูล

ใช้ตรวจสอบว่า List ของรหัสสินค้าที่สั่งซื้อ มีรหัสสินค้าหลักทั้งหมดที่จำเป็นสำหรับการประมวลผลหรือไม่

### ยืนยันสิทธิ์การเข้าถึง

ตรวจสอบว่าผู้ใช้มีสิทธิ์เข้าถึง (Permission) ที่จำเป็นครบทุกรายการหรือไม่

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: มีสมาชิกครบทุกตัว

```excel
List.ContainsAll({1, 2, 3, 4, 5}, {3, 4})
```

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

List `{1, 2, 3, 4, 5}` มีทั้ง 3 และ 4 ครบถ้วน ผลลัพธ์จึงเป็น true

### 2. ตัวอย่างที่ 2: มีสมาชิกบางตัวไม่ครบ

```excel
List.ContainsAll({1, 2, 3, 4, 5}, {5, 6})
```

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

List `{1, 2, 3, 4, 5}` ไม่มี 6 ผลลัพธ์จึงเป็น false

### 3. ตัวอย่างที่ 3: ตรวจสอบแบบไม่สนใจตัวพิมพ์เล็ก-ใหญ่

```excel
List.ContainsAll({"dog", "cat"}, {"DOG"}, Comparer.OrdinalIgnoreCase)
```

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

แม้ว่า "DOG" จะเป็นตัวพิมพ์ใหญ่ แต่ Comparer.OrdinalIgnoreCase ทำให้การเปรียบเทียบไม่สนใจ Case ผลลัพธ์จึงเป็น true

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

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

List.ContainsAll ตรวจสอบว่ามี 'ทุกตัว' ที่ระบุ ในขณะที่ List.Contains ตรวจสอบแค่ว่า 'มีอย่างน้อยหนึ่งตัว' ที่ตรงกับค่าเดียวที่ระบุ

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

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

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

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

---

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