---
title: วิธีสร้างเลข Combination กัน
url: https://www.thepexcel.com/number-combination/
type: post
date: 2020-03-31
author: Sira Ekabut
categories: [Power Query]
tags: [combination]
---

# วิธีสร้างเลข Combination กัน

มีคนถามมาว่า ถ้ามีเลข 0, 2, 3, 6, 9 สามารถผสมเป็นเลข 2 Digit ได้แบบไหนบ้าง? ผมว่าน่าสนใจดีเลยเอามาทำบทความให้ครับ วิธีทำที่ผมคิดว่าง่าย ก็คือใช้ Power Query ช่วยทำ ซึ่งมีวิธีทำดังนี้

 

## เริ่มต้นสร้างเลข Combination

 

ก่อนอื่นสร้าง Table ที่มี List ตัวเลขที่ต้องการก่อน

 ![1](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-001.png) 

แล้วก็เอาเข้า Power Query ซะ แล้วเปลี่ยน Data Type เป็น Text เพื่อความยืดหยุ่น (กดแบบ Replace Current)

 

จากนั้น Add Custom Column ขึ้นมาแล้วใส่สูตรว่า =1 เพื่อให้ออกมาเป็นเลข 1 ทั้งหมด

 ![2](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-002.png) 

จากนั้นทำการ Merge Query กับตัวเองซะ เลือกตัวเชื่อมเป้นคอลัมน์ที่มีเลข 1 ที่เราสร้างไว้

 ![3](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-003-1024x601.png) 

กด Expand ผลลัพธ์ออกมา

 ![4](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-004.png) 

จากนั้นเลือกคอลัมน์ Num กับ Num.1 แล้วสั่ง Merge กันซะ จะใส่ตัวคั่นรึเปล่าก็แล้วแต่

 ![5](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-005-1024x446.png) 

จากนั้นลบ Column Custom ออกไปก็จบละ กด Load เอาผลลัพธ์ออกมาได้เลย

 ![6](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-006.png) 

ลองเปลี่ยนข้อมูลดูได้ ใช้ตัวหนังสือก็ได้

 ![7](https://www.thepexcel.com/wp-content/uploads/2020/03/number-combination-007.png)

---

_Source: [https://www.thepexcel.com/number-combination/](https://www.thepexcel.com/number-combination/)_
