---
title: Text.PositionOfAny – ค้นหาตำแหน่งของอักขระใดๆ
url: https://www.thepexcel.com/functions/power-query/text-functions/text-positionofany/
type: function-explainer
program: Power Query
syntax: "Text.PositionOfAny(text as text, characters as list, optional occurrence as nullable number) as any"
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# Text.PositionOfAny – ค้นหาตำแหน่งของอักขระใดๆ

> ค้นหาตำแหน่งของอักขระจากรายการ

## คำอธิบาย

Text.PositionOfAny ใช้สำหรับค้นหาตำแหน่งแรกของอักขระใดๆ ในรายการที่ระบุ เป็นประโยชน์สำหรับการค้นหาเครื่องหมายพิเศษ สระ หรืออักขระที่ระบุ

## Syntax

```excel
Text.PositionOfAny(text as text, characters as list, optional occurrence as nullable number) as any
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| text | Yes | text |  | ข้อความที่ต้องค้นหา |
| characters | Yes | list |  | รายการอักขระที่ต้องค้นหา (เช่น {"A", "E", "I", "O", "U"}) |
| occurrence | No | nullable number | null | ลำดับของการเกิด (optional) |

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

### ค้นหาตำแหน่งของสระ พยัญชนะ หรือตัวเลข

ค้นหาตำแหน่งของสระ พยัญชนะ หรือตัวเลข

### แยกส่วน Email ด้วยการค้นหา @ หรือ .

แยกส่วน Email ด้วยการค้นหา @ หรือ .

### ตรวจหาตัวอักษรพิเศษหรือตัวแยก

ตรวจหาตัวอักษรพิเศษหรือตัวแยก

## ตัวอย่าง

### 1. ค้นหาสระแรก

```excel
Text.PositionOfAny("Hello", {"A", "E", "I", "O", "U"})
```

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

สระแรกคือ 'E' ที่ตำแหน่ง 1

### 2. ค้นหาเครื่องหมายพิเศษ

```excel
Text.PositionOfAny("Email@Example.com", {"@", "."})
```

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

เครื่องหมาย @ ปรากฏที่ตำแหน่ง 5

### 3. ไม่พบอักขระ

```excel
Text.PositionOfAny("Hello", {"X", "Y", "Z"})
```

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

ไม่พบตัวอักษร X, Y, หรือ Z คืนค่า -1

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

- [Text.PositionOf – หาตำแหน่งข้อความ](https://www.thepexcel.com/functions/power-query/text-functions/text-positionof/)
- [Text.Contains – ตรวจสอบว่าข้อความมีส่วนประกอบที่ต้องการหรือไม่](https://www.thepexcel.com/functions/power-query/text-functions/text-contains/)

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

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

---

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