---
title: List.Transform – แปลงค่าในลิสต์แต่ละตัว
url: https://www.thepexcel.com/functions/power-query/list-functions/list-transform/
type: function-explainer
program: Power Query
syntax: "= List.Transform(list as list, transform as function) as list"
date: 2025-12-03
updated: 2025-12-20
scores:
  popularity: 7
  difficulty: 5
  usefulness: 8
---

# List.Transform – แปลงค่าในลิสต์แต่ละตัว

> List.Transform ใช้สำหรับสร้างลิสต์ใหม่โดยนำฟังก์ชันไปประมวลผลแต่ละตัวในลิสต์เดิม

## คำอธิบาย

List.Transform ใช้สำหรับสร้างลิสต์ใหม่โดยนำฟังก์ชันไปประมวลผลแต่ละตัวในลิสต์เดิม

## Syntax

```excel
= List.Transform(list as list, transform as function) as list
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| list | Yes | List |  | ลิสต์ที่ต้องการแปลงค่า เช่น {1, 2, 3, 4, 5} |
| transform | Yes | Function |  | ฟังก์ชันที่ใช้แปลงแต่ละตัว เขียนแบบ each [operation] |

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

### คูณตัวเลขใน List

นำตัวเลขทุกตัวใน List มาคูณด้วยค่าคงที่ หรือคำนวณซับซ้อนขึ้น

### แปลง Text เป็นตัวพิมพ์ใหญ่

เปลี่ยนข้อความทุกตัวใน List ให้เป็นตัวพิมพ์ใหญ่ (Text.Upper(each _))

### สร้างคอลัมน์ใหม่จาก List

ใช้ร่วมกับ Table.AddColumn เพื่อสร้างคอลัมน์ใหม่จาก List ที่มีการแปลงค่าแล้ว

## ตัวอย่าง

### 1. แปลงตัวเลขพื้นฐาน

```excel
= List.Transform({1, 2, 3}, each _ * 2)
```

**ผลลัพธ์:** `{2, 4, 6}`

คูณแต่ละตัวเลขในลิสต์ด้วย 2 ผ่าน each _ * 2 ซึ่ง _ แทนแต่ละตัวในลิสต์

### 2. แปลงข้อความทั้งหมดเป็นตัวพิมพ์ใหญ่

```excel
= List.Transform({"hello", "world"}, each Text.Upper(_))
```

**ผลลัพธ์:** `{"HELLO", "WORLD"}`

แปลงข้อความทั้งหมดเป็นตัวพิมพ์ใหญ่ โดยใช้ฟังก์ชัน Text.Upper บนแต่ละข้อความ

### 3. แปลงในโครงสร้างให้ใหญ่ขึ้น 10%

```excel
let
    Numbers = {100, 200, 300},
    Increased = List.Transform(Numbers, each _ * 1.1)
in
    Increased
```

**ผลลัพธ์:** `{110, 220, 330}`

ใช้ let...in เพื่อจัดการข้อมูล แล้วแปลงแต่ละตัวเลขให้เพิ่มขึ้น 10%

### 4. แปลงหลายรอบแบบซ้อนกัน

```excel
= List.Transform(
    List.Transform({1, 2, 3}, each _ * 2),
    each _ + 10
  )
```

**ผลลัพธ์:** `{12, 14, 16}`

ใช้ List.Transform ซ้อนกันสองชั้น ชั้นแรกคูณด้วย 2 ชั้นสองบวกด้วย 10

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

- ใช้ each เมื่อต้องการเขียนฟังก์ชันแบบสั้นและรวดเร็ว

- ผสมกับ List.Select, List.FirstN, List.Skip ได้

- ถ้าฟังก์ชันซับซ้อน เขียน let...in ก่อนแล้วค่อยใช้

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

**Q: แตกต่างจาก List.Select หรือไม่**

แตกต่างค่ะ List.Select กรองข้อมูลออก แต่ List.Transform แปลงค่า List.Select ส่งคืนลิสต์เดิมแบบบาง แต่ List.Transform ส่งคืนลิสต์ใหม่ที่มีค่าต่างไป

**Q: ใช้ได้กับ each เท่านั้นหรือ**

ไม่จำเป็น สามารถใช้ฟังก์ชันอื่นๆ ได้ เช่น = List.Transform(list, Date.AddDays(_, 1)) แล้วแต่ความต้องการ

**Q: จะได้อะไรถ้าลิสต์เป็นโครงสร้างที่ซับซ้อน**

ได้ค่า เช่น List.Transform(ListOfRecords, each [_ & {new_field = "value"}]) สามารถเพิ่มฟิลด์ให้รีคอร์ดในลิสต์

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

- [List.Select – เลือกสมาชิกจาก List ตามเงื่อนไข](https://www.thepexcel.com/functions/power-query/list-functions/list-select/)
- [List.Sum – รวมค่าตัวเลขในรายการ](https://www.thepexcel.com/functions/power-query/list-functions/list-sum/)
- [Text.Upper – แปลงข้อความเป็นตัวอักษรใหญ่](https://www.thepexcel.com/functions/power-query/text-functions/text-upper/)
- [List.Average – คำนวณค่าเฉลี่ยของรายการ](https://www.thepexcel.com/functions/power-query/list-functions/list-average/)

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

- [Microsoft Learn - List.Transform](https://learn.microsoft.com/en-us/powerquery-m/list-transform) _(official)_
- [Power Query M Function Reference](https://learn.microsoft.com/en-us/powerquery-m/) _(official)_

---

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