---
title: Text.PadEnd – เติมอักขระด้านหลัง
url: https://www.thepexcel.com/functions/power-query/text-functions/text-padend/
type: function-explainer
program: Power Query
syntax: "Text.PadEnd(text as nullable text, count as number, optional character as nullable text) as nullable text"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 3
  usefulness: 4
---

# Text.PadEnd – เติมอักขระด้านหลัง

> เติมอักขระด้านหลังข้อความให้ครบตามจำนวนหลัก

## คำอธิบาย

Text.PadEnd จะเพิ่มอักขระที่ระบุ (เช่น '0' หรือ '-') เข้าไปด้านหลังของข้อความ จนกว่าความยาวของข้อความนั้นจะถึงจำนวนหลักที่ต้องการ ใช้ในการจัดรูปแบบข้อมูลให้สม่ำเสมอ หรือสร้าง Field ที่มี Character ครบตาม Spec

## Syntax

```excel
Text.PadEnd(text as nullable text, count as number, optional character as nullable text) as nullable text
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| text | Yes | text |  | ข้อความที่ต้องการเติมอักขระ |
| count | Yes | number |  | จำนวนหลักของข้อความที่ต้องการให้เป็น |
| character | No | text | Space | อักขระที่ต้องการเติม (ถ้าไม่ระบุ จะเติม Space) |

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

### เติมเลข 0 ต่อท้ายรหัส

แปลงรหัสสินค้า "123" ให้เป็น "123000" เพื่อให้มีความยาว 6 หลักเท่ากัน

### สร้างรายงานแบบ Fixed-width

เติม Space ด้านท้ายของแต่ละ Field ให้มีความยาวเท่ากันตามข้อกำหนดของระบบ

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: เติมเครื่องหมายขีดกลาง

```excel
Text.PadEnd("apple", 8, "-")
```

**ผลลัพธ์:** `apple---`

เติมเครื่องหมาย '-' ด้านหลังคำว่า "apple" จนมีความยาวรวม 8 ตัวอักษร

### 2. ตัวอย่างที่ 2: เติมเลขศูนย์ต่อท้าย

```excel
Text.PadEnd("123", 5, "0")
```

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

เติม '0' ด้านหลังเลข '123' ให้มีความยาว 5 หลัก

### 3. ตัวอย่างที่ 3: ไม่ระบุอักขระ

```excel
Text.PadEnd("apple", 8)
```

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

ถ้าไม่ระบุอักขระที่จะเติม จะเติมด้วยช่องว่าง (Space) โดยอัตโนมัติ

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

**Q: ถ้าข้อความยาวกว่า 'count' จะเป็นอย่างไร?**

ฟังก์ชันจะไม่ทำอะไรกับข้อความครับ จะคืนค่าข้อความเดิมกลับมา

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

- [Text.PadStart – เติมอักขระด้านหน้า](https://www.thepexcel.com/functions/power-query/text-functions/text-padstart/)
- [Text.Trim – ตัดอักขระนำหน้าและลงท้าย](https://www.thepexcel.com/functions/power-query/text-functions/text-trim/)

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

- [Microsoft Learn: Text.PadEnd](https://learn.microsoft.com/en-us/powerquery-m/text-padend) _(Official Documentation)_
- [PowerQuery.how](https://powerquery.how/text-padend/) _(guide)_

---

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