---
title: Text.Range – ดึงช่วงของข้อความ
url: https://www.thepexcel.com/functions/power-query/text-functions/text-range/
type: function-explainer
program: Power Query
syntax: "Text.Range(text as nullable text, offset as number, optional count as nullable number) as nullable text"
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# Text.Range – ดึงช่วงของข้อความ

> ดึงข้อความจากตำแหน่งที่ระบุ

## คำอธิบาย

Text.Range ใช้สำหรับดึงข้อความตั้งแต่ตำแหน่งที่ระบุไปยังท้ายสตริง หรือจำนวนอักขระที่กำหนด ถ้าจำนวนอักขระไม่พอ ฟังก์ชันจะคืนค่าเท่าที่หาได้

## Syntax

```excel
Text.Range(text as nullable text, offset as number, optional count as nullable number) as nullable text
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| text | Yes | nullable text |  | ข้อความต้นฉบับ |
| offset | Yes | number |  | ตำแหน่ง zero-based ที่เริ่มต้น |
| count | No | nullable number | null | จำนวนอักขระที่ต้องการดึง (ไม่ระบุ = จนถึงท้าย) |

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

### ดึงนามสกุลไฟล์จากชื่อไฟล์เต็ม

ดึงนามสกุลไฟล์จากชื่อไฟล์เต็ม

### ดึงส่วนของรหัส ID

ดึงส่วนของรหัส ID

### แยกข้อมูลจากตำแหน่งคงที่

แยกข้อมูลจากตำแหน่งคงที่

## ตัวอย่าง

### 1. ดึงจากตำแหน่งถึงท้าย

```excel
Text.Range("Hello World", 6)
```

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

ดึงจากตำแหน่ง 6 ถึงท้าย

### 2. ดึง 5 อักขระ

```excel
Text.Range("Hello World", 0, 5)
```

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

ดึง 5 อักขระตั้งแต่ตำแหน่ง 0

### 3. ดึงนามสกุลไฟล์

```excel
Text.Range("document.pdf", 9)
```

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

ดึงจากตำแหน่ง 9 (หลังจากจุด) ถึงท้าย

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

- [Text.Start – ดึงอักขระจากตัวแรกของข้อความ](https://www.thepexcel.com/functions/power-query/text-functions/text-start/)
- [Text.End – ดึงอักขระจากท้ายข้อความ](https://www.thepexcel.com/functions/power-query/text-functions/text-end/)
- [Text.At – ดึงอักขระที่ตำแหน่งที่ระบุ](https://www.thepexcel.com/functions/power-query/text-functions/text-at/)
- [Text.Middle – ดึงข้อความจากตรงกลาง](https://www.thepexcel.com/functions/power-query/text-functions/text-middle/)

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

- [Microsoft Learn: Text.Range](https://learn.microsoft.com/en-us/powerquery-m/text-range) _(Official Documentation)_

---

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