Thep Excel

Number.ToText – แปลงตัวเลขเป็นข้อความ

แปลงตัวเลขเป็นข้อความพร้อมจัดรูปแบบ

Number.ToText จะแปลงค่าตัวเลขให้เป็น Text String โดยสามารถระบุ format เพื่อจัดรูปแบบการแสดงผลได้ (เช่น “N2” สำหรับทศนิยม 2 ตำแหน่ง หรือ “C” สำหรับสกุลเงิน) และระบุ culture ได้

=Number.ToText(number as nullable number, optional format as nullable text, optional culture as nullable text) as nullable text

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=Number.ToText(number as nullable number, optional format as nullable text, optional culture as nullable text) as nullable text

Argument Type Required Default Description
number number Yes ตัวเลขที่ต้องการแปลง
format text Optional null รูปแบบ (Format String) เช่น “N2”, “C”, “P”
culture text Optional null รหัสวัฒนธรรม (Culture Code) เช่น “en-US”

How it works

แสดงผลทศนิยม 2 ตำแหน่ง

แปลง 123.4567 ให้เป็น "123.46" เพื่อแสดงในรายงาน

จัดรูปแบบสกุลเงิน

แปลง 1000 ให้เป็น "$1,000.00" หรือ "฿1,000.00"

Examples

ตัวอย่างที่ 1: แปลงเป็นข้อความธรรมดา

แปลงตัวเลขเป็นข้อความโดยไม่มีการจัดรูปแบบพิเศษ
Power Query Formula:

=Number.ToText(123)

Result:

"123"

ตัวอย่างที่ 2: ทศนิยม 2 ตำแหน่ง

ใช้ Format "N2" เพื่อปัดเศษและแสดงทศนิยม 2 ตำแหน่ง
Power Query Formula:

=Number.ToText(123.456, "N2")

Result:

"123.46"

ตัวอย่างที่ 3: รูปแบบสกุลเงิน (ไทย)

ใช้ Format "C" และ Culture "th-TH" เพื่อแสดงเป็นสกุลเงินบาท
Power Query Formula:

=Number.ToText(1000, "C", "th-TH")

Result:

"฿1,000.00"

FAQs

Format String มีอะไรบ้าง?

N (Number), C (Currency), P (Percentage), E (Scientific), D (Decimal), X (Hexadecimal) และสามารถระบุจำนวนหลักต่อท้ายได้ เช่น N2, P1

Resources & Related

Additional Notes

ฟังก์ชัน Number.ToText ใน Power Query ใช้สำหรับแปลงตัวเลข (Number) ให้เป็นข้อความ (Text) โดยสามารถกำหนดรูปแบบ (Format) ได้ เช่น ทศนิยม, สกุลเงิน หรือเปอร์เซ็นต์

Leave a Reply

Your email address will not be published. Required fields are marked *