---
title: FILTER – ฟังก์ชันกรองข้อมูลแบบไดนามิก
url: https://www.thepexcel.com/functions/excel/lookup-and-reference/filter/
type: function-explainer
program: Excel
syntax: "=FILTER(array, include, [if_empty])"
date: 2025-12-14
updated: 2025-12-17
scores:
  popularity: 8
  difficulty: 5
  usefulness: 9
---

# FILTER – ฟังก์ชันกรองข้อมูลแบบไดนามิก

> กรองข้อมูลตามเงื่อนไข return เป็น Spill Range

## คำอธิบาย

FILTER กรองข้อมูลจาก Array ตามเงื่อนไขที่กำหนด แล้ว return เป็น Spill Range ที่ขยายอัตโนมัติ เป็น Dynamic Array Function ที่เปลี่ยนวิธีการทำงานกับข้อมูลใน Excel รองรับเงื่อนไขหลายตัว (AND/OR) และสามารถใช้ร่วมกับ SORT UNIQUE XLOOKUP เพื่อสร้างรายงานที่อัปเดตอัตโนมัติ

## Syntax

```excel
=FILTER(array, include, [if_empty])
```

**excel**

```excel
=FILTER(Table1, Table1[Amount]>1000)
```

กรองเงื่อนไขเดียว - ยอดมากกว่า 1000

**excel**

```excel
=FILTER(Table1, (Table1[Region]="North")*(Table1[Amount]>1000))
```

หลายเงื่อนไขแบบ AND (คูณ *)

**excel**

```excel
=FILTER(Table1, (Table1[Status]="Open")+(Table1[Status]="Pending"))
```

หลายเงื่อนไขแบบ OR (บวก +)

**excel**

```excel
=SORT(FILTER(Table1, Table1[Amount]>1000), 3, -1)
```

FILTER + SORT เรียงผลลัพธ์จากมากไปน้อย

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| array | Yes | Range/Array |  | ช่วงข้อมูลที่ต้องการกรอง (ทั้งตารางหรือบางคอลัมน์) |
| include | Yes | Boolean Array |  | เงื่อนไข TRUE/FALSE ที่มีจำนวนแถวเท่ากับ array (TRUE = เอา, FALSE = ไม่เอา) |
| if_empty | No | Any | #CALC! | ค่าที่ return เมื่อไม่มีข้อมูลตรงเงื่อนไข (แนะนำใส่เสมอเพื่อป้องกัน error) |

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

### สร้าง Dynamic Dashboard

กรองข้อมูลตาม dropdown ที่ผู้ใช้เลือก (Region, Product, Date) โดยไม่ต้องใช้ PivotTable

_เหมาะกับ:_ dashboard

### Live Search Box

ใช้ FILTER กับ SEARCH เพื่อสร้างช่องค้นหาที่กรองข้อมูลขณะพิมพ์แบบ real-time

_เหมาะกับ:_ search

### รายการ Tasks ที่ยังไม่เสร็จ

กรอง Status = Open และ Due Date

_เหมาะกับ:_ task-management

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: กรองเงื่อนไขเดียว

```excel
=FILTER(Sales, Sales[Amount]>1000)
```

**ผลลัพธ์:** `Spill Range 5 แถว`

กรองรายการที่ยอดขาย > 1000 ได้ 5 แถว ผลลัพธ์ Spill ลงด้านล่างอัตโนมัติ

### 2. ตัวอย่างที่ 2: หลายเงื่อนไขแบบ AND

```excel
=FILTER(Sales, (Sales[Region]="North")*(Sales[Amount]>1000))
```

**ผลลัพธ์:** `Spill Range 3 แถว`

ใช้ * (คูณ) เป็น AND: Region=North AND Amount>1000 ได้ 3 แถว

### 3. ตัวอย่างที่ 3: หลายเงื่อนไขแบบ OR

```excel
=FILTER(Sales, (Sales[Status]="Open")+(Sales[Status]="Pending"))
```

**ผลลัพธ์:** `Spill Range 8 แถว`

ใช้ + (บวก) เป็น OR: Status=Open OR Status=Pending ได้ 8 แถว

### 4. ตัวอย่างที่ 4: จัดการ Empty Result

```excel
=FILTER(Sales, Sales[Amount]>999999, "No data found")
```

**ผลลัพธ์:** `No data found`

ไม่มียอดขาย > 999999 ใส่ if_empty เพื่อแสดงข้อความแทน #CALC! error

### 5. ตัวอย่างที่ 5: FILTER + SORT

```excel
=SORT(FILTER(Sales, Sales[Region]="North"), 3, -1)
```

**ผลลัพธ์:** `กรองแล้วเรียงจากมากไปน้อย`

กรอง Region=North แล้ว SORT คอลัมน์ที่ 3 (Amount) จากมากไปน้อย (-1)

### 6. ตัวอย่างที่ 6: Dynamic Search

```excel
=FILTER(Products, ISNUMBER(SEARCH(G1, Products[Name])), "No match")
```

**ผลลัพธ์:** `รายการที่มีคำค้นหา G1`

G1 = คำค้นหา SEARCH หาคำใน Name column กรองเฉพาะที่พบ (ISNUMBER = TRUE)

## หมายเหตุเพิ่มเติม

**เปรียบเทียบ FILTER vs AutoFilter vs PivotTable:**\n\n| | FILTER | AutoFilter | PivotTable |\n|---|--------|------------|------------|\n| ผลลัพธ์ | Array ใหม่ | ซ่อนแถวเดิม | สรุปข้อมูล |\n| Dynamic | อัตโนมัติ | Manual | อัตโนมัติ |\n| ใช้ในสูตร | ได้ | ไม่ได้ | ไม่ได้ |\n| หลาย criteria | AND/OR | AND เท่านั้น | AND/OR |\n\n**เทคนิค AND/OR:**\n```\nAND: (condition1)*(condition2)*(condition3)\nOR:  (condition1)+(condition2)+(condition3)\nMixed: ((A)*(B))+((C)*(D))  = (A AND B) OR (C AND D)\n```\n\n**รวมกับฟังก์ชันอื่น:**\n```\n=SORT(FILTER(...))  → กรองแล้วเรียง\n=UNIQUE(FILTER(...))  → กรองแล้วหา unique\n=INDEX(FILTER(...), 1)  → ดึงแถวแรกของผลกรอง\n=ROWS(FILTER(...))  → นับจำนวนผลลัพธ์\n```

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

**Q: #CALC! error เกิดจากอะไร?**

เกิดเมื่อไม่มีข้อมูลตรงเงื่อนไขและไม่ได้ใส่ if_empty แก้โดยใส่ argument ที่ 3 เช่น =FILTER(data, condition, "No data")

**Q: #SPILL! error เกิดจากอะไร?**

เกิดเมื่อเซลล์ด้านล่าง/ขวาไม่ว่างทำให้ผลลัพธ์ Spill ไม่ได้ ลบข้อมูลที่ขวางหรือย้ายสูตรไปที่ว่าง

**Q: ใช้ AND/OR หลายเงื่อนไขอย่างไร?**

AND ใช้ * (คูณ) เช่น (A>10)*(B="Yes") ส่วน OR ใช้ + (บวก) เช่น (A="X")+(A="Y") ครอบด้วยวงเล็บแต่ละเงื่อนไข

**Q: FILTER กับ AutoFilter ต่างกันอย่างไร?**

FILTER เป็นสูตรที่ return ผลลัพธ์ใหม่แบบไดนามิก ไม่ซ่อนแถว ใช้กับสูตรอื่นได้ ส่วน AutoFilter ซ่อนแถวใน Table เดิม ต้องกดเลือกด้วยมือ

**Q: FILTER รองรับ Excel เวอร์ชันไหน?**

Microsoft 365, Excel 2021, Excel 2024, และ Excel for Web เท่านั้น ไม่รองรับ Excel 2019 หรือเก่ากว่า เป็น Dynamic Array Function

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

- [SORT – ฟังก์ชันเรียงลำดับแบบสไปล์](https://www.thepexcel.com/functions/excel/lookup-and-reference/sort/)
- [SORTBY – เรียงลำดับข้อมูลตามคอลัมน์อื่น](https://www.thepexcel.com/functions/excel/lookup-and-reference/sortby/)
- [UNIQUE – ฟังก์ชันดึงค่าที่ไม่ซ้ำ](https://www.thepexcel.com/functions/excel/lookup-and-reference/unique/)
- [XLOOKUP – ฟังก์ชันค้นหาข้อมูลแนวตั้งและแนวนอน](https://www.thepexcel.com/functions/excel/lookup-and-reference/xlookup/)
- [INDEX – ดึงค่าจากตำแหน่งที่ระบุใน Range หรือ Array](https://www.thepexcel.com/functions/excel/lookup-and-reference/index/)
- [TAKE – ดึงข้อมูลบางส่วนจากหัวหรือท้ายตาราง](https://www.thepexcel.com/functions/excel/lookup-and-reference/take/)
- [DROP – ตัดข้อมูลบางส่วนทิ้ง (หัวหรือท้าย)](https://www.thepexcel.com/functions/excel/lookup-and-reference/drop/)
- [CHOOSECOLS – เลือกและจัดเรียงคอลัมน์จากตาราง](https://www.thepexcel.com/functions/excel/lookup-and-reference/choosecols/)
- [CHOOSEROWS – เลือกเฉพาะแถวที่กำหนดจากตาราง](https://www.thepexcel.com/functions/excel/lookup-and-reference/chooserows/)

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

- [Microsoft Support: FILTER function](https://support.microsoft.com/en-us/office/filter-function-f4f7cb66-82eb-4767-8f7c-4877ad80c759) _(official)_
- [ExcelJet: How to use FILTER](https://exceljet.net/functions/filter-function) _(guide)_

---

_Source: [https://www.thepexcel.com/functions/excel/lookup-and-reference/filter/](https://www.thepexcel.com/functions/excel/lookup-and-reference/filter/)_
