---
title: List.Repeat – ทำซ้ำ List หลายครั้ง
url: https://www.thepexcel.com/functions/power-query/list-functions/list-repeat/
type: function-explainer
program: Power Query
syntax: "List.Repeat(list as list, count as number) as list"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 4
  usefulness: 5
---

# List.Repeat – ทำซ้ำ List หลายครั้ง

> ทำซ้ำ List ที่กำหนดเป็นจำนวนครั้ง

## คำอธิบาย

List.Repeat จะคืน List ใหม่ที่ประกอบด้วยสมาชิกทั้งหมดของ List ต้นฉบับที่ถูกทำซ้ำกัน 'count' ครั้ง โดยเรียงต่อกันไปตามลำดับเดิม

## Syntax

```excel
List.Repeat(list as list, count as number) as list
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| list | Yes | list |  | List ที่ต้องการทำซ้ำ |
| count | Yes | number |  | จำนวนครั้งที่ต้องการทำซ้ำ List |

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

### สร้างข้อมูลจำลอง (Dummy Data)

ทำซ้ำชุดข้อมูลเล็กๆ ให้มีขนาดใหญ่ขึ้นเพื่อทดสอบประสิทธิภาพของ Query

### สร้าง List ของวันในสัปดาห์

ใช้ List.Repeat({"Mon","Tue", ...}, 5) เพื่อสร้าง List ของวันทำงาน 5 สัปดาห์

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ทำซ้ำ 3 ครั้ง

```excel
List.Repeat({"apple","banana"},3)
```

**ผลลัพธ์:** `{"apple","banana","apple","banana","apple","banana"}`

ทำซ้ำ List {"apple","banana"} จำนวน 3 ครั้ง

### 2. ตัวอย่างที่ 2: ทำซ้ำตัวเลข

```excel
List.Repeat({1, 2}, 2)
```

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

ทำซ้ำ List ของตัวเลข {1, 2} จำนวน 2 ครั้ง

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

**Q: ถ้า 'count' เป็น 0 จะเป็นอย่างไร?**

จะคืนค่าเป็น List ว่างเปล่า {} ครับ

**Q: ถ้า List ว่างเปล่าจะทำซ้ำได้ไหม?**

ได้ครับ List.Repeat({}, 5) จะยังคงคืน List ว่างเปล่า {}

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

- [List.Generate – สร้าง List แบบวนลูปตามเงื่อนไข (Generator Pattern)](https://www.thepexcel.com/functions/power-query/list-functions/list-generate/)
- [List.Transform – แปลงค่าในลิสต์แต่ละตัว](https://www.thepexcel.com/functions/power-query/list-functions/list-transform/)

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

- [Microsoft Learn: List.Repeat](https://learn.microsoft.com/en-us/powerquery-m/list-repeat) _(Official Documentation)_
- [PowerQuery.how](https://powerquery.how/list-repeat/) _(guide)_

---

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