---
title: Table.RemoveRows – ลบแถวตามจำนวนและตำแหน่งที่ระบุ
url: https://www.thepexcel.com/functions/power-query/table-functions/table-removerows/
type: function-explainer
program: Power Query
syntax: "Table.RemoveRows(table as table, offset as number, optional count as nullable number) as table"
date: 2025-12-15
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# Table.RemoveRows – ลบแถวตามจำนวนและตำแหน่งที่ระบุ

> ลบแถวจากตารางโดยระบุตำแหน่งเริ่มต้นและจำนวน

## คำอธิบาย

Table.RemoveRows ใช้สำหรับลบแถวออกจากตาราง โดยระบุตำแหน่งเริ่มต้นและจำนวนแถวที่ต้องการลบ

## Syntax

```excel
Table.RemoveRows(table as table, offset as number, optional count as nullable number) as table
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| table | Yes | table |  | ตารางที่ต้องการลบแถว |
| offset | Yes | number |  | ตำแหน่งแถวแรกที่จะลบ (เริ่มนับจาก 0) |
| count | No | number | 1 | จำนวนแถวที่ต้องการลบ (ค่าเริ่มต้นคือ 1) |

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

### ลบข้อมูลส่วนหัวหรือส่วนท้ายที่ไม่ต้องการแบบระบุตำแหน่งได้

ลบข้อมูลส่วนหัวหรือส่วนท้ายที่ไม่ต้องการแบบระบุตำแหน่งได้

### ลบข้อมูลช่วงกลางของตารางที่ทราบตำแหน่งแน่นอน

ลบข้อมูลช่วงกลางของตารางที่ทราบตำแหน่งแน่นอน

### จัดการตารางที่มีรูปแบบคงที่

จัดการตารางที่มีรูปแบบคงที่

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ลบแถวแรกสุดออก 1 แถว

```excel
let
    Source = Table.FromRecords({[A=1], [A=2], [A=3]}),
    Removed = Table.RemoveRows(Source, 0, 1)
in
    Removed
```

**ผลลัพธ์:** `Table with row 2 and 3`

ลบแถวที่ index 0 (แถวแรก) จำนวน 1 แถว ผลลัพธ์จะเหลือแถวที่ 2 และ 3

### 2. ตัวอย่างที่ 2: ลบแถวช่วงกลาง (ลบแถวที่ 2 และ 3)

```excel
let
    Source = Table.FromRecords({[A=1], [A=2], [A=3], [A=4]}),
    Removed = Table.RemoveRows(Source, 1, 2)
in
    Removed
```

**ผลลัพธ์:** `Table with row 1 and 4`

เริ่มลบที่ index 1 (คือแถวที่ 2) และลบไป 2 แถว ทำให้แถวที่ 2 และ 3 หายไป เหลือเพียงแถวที่ 1 และ 4

### 3. ตัวอย่างที่ 3: ลบข้อมูลส่วนท้ายโดยระบุตำแหน่ง

```excel
let
    Source = Table.FromRecords({[ID=1], [ID=2], [ID=3], [ID=4], [ID=5]}),
    // ลบ 3 แถว เริ่มจาก index 2 (คือแถวที่ 3, 4, 5)
    Removed = Table.RemoveRows(Source, 2, 3)
in
    Removed
```

**ผลลัพธ์:** `Table with ID 1 and 2`

เริ่มลบที่ index 2 (แถวที่ 3) จำนวน 3 แถว ทำให้แถว ID 3, 4, 5 ถูกลบออก

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

- [Table.Skip – จัดการตาราง](https://www.thepexcel.com/?post_type=function-explainer&p=38019)

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

- [Microsoft Learn: Table.RemoveRows](https://learn.microsoft.com/en-us/powerquery-m/table-removerows) _(documentation)_

---

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