Thep Excel

Text.Proper – แปลงเป็นตัวพิมพ์ใหญ่ต้นคำ

แปลงอักษรตัวแรกของทุกคำเป็นตัวพิมพ์ใหญ่ (Title Case) และส่วนที่เหลือเป็นตัวพิมพ์เล็ก

=Text.Proper(text as nullable text, optional culture as nullable text) as nullable text

By ThepExcel AI Agent
3 December 2025

Function Metrics


Popularity
7/10

Difficulty
2/10

Usefulness
7/10

Syntax & Arguments

=Text.Proper(text as nullable text, optional culture as nullable text) as nullable text

Argument Type Required Default Description
text text Yes ข้อความต้นฉบับ (nullable text) ที่ต้องการแปลงเป็น Title Case
culture text Optional null รหัสภาษา (culture code) เช่น “en-US” หรือ “th-TH” สำหรับใช้กฎการแปลงอักษรตามภาษาที่ระบุ ถ้าไม่ระบุจะใช้ culture เริ่มต้นของระบบ

Examples

แปลงชื่อบุคคลพื้นฐาน
Text.Proper("john doe")
ข้อความ "john doe" ทั้งตัวพิมพ์เล็กจะถูกแปลงเป็น "John Doe" โดยตัวแรกของแต่ละคำกลายเป็นตัวพิมพ์ใหญ่
Power Query Formula:

= Text.Proper("john doe")

Result:

"John Doe"

แปลงข้อความที่มีตัวพิมพ์ใหญ่ปนกัน
Text.Proper("tHE QUICK BrOWn fOx")
ไม่ว่าอินพุตจะมีตัวพิมพ์ใหญ่/เล็กปนกันแบบไหน ผลลัพธ์จะเป็น Title Case ที่สอดคล้องกันเสมอ
Power Query Formula:

= Text.Proper("tHE QUICK BrOWn fOx")

Result:

"The Quick Brown Fox"

จัดรูปแบบชื่อสินค้า
Text.Proper("laptop computer 15 inch hd display")
ใช้สำหรับจัดรูปแบบชื่อสินค้า โดยตัวแรกของแต่ละคำจะเป็นตัวพิมพ์ใหญ่ (ทั้ง "Hd" แม้จะเป็นตัวย่อ)
Power Query Formula:

= Text.Proper("laptop computer 15 inch hd display")

Result:

"Laptop Computer 15 Inch Hd Display"

ใช้ใน Table Transformation
Table.TransformColumns( Source, {{"CustomerName", each Text.Proper(_), type text}} )
ในสถานการณ์จริง เรามักใช้ Text.Proper กับ Table.TransformColumns เพื่อแปลงข้อมูลหลายแถวพร้อมกัน ตัวอักษร underscore (_) แทนแต่ละค่าในคอลัมน์
Power Query Formula:

= Table.TransformColumns(
    Source,
    {{"CustomerName", each Text.Proper(_), type text}}
  )

Result:

ทุกชื่อใน CustomerName column จะถูกแปลงเป็น Title Case (เช่น "john smith" -> "John Smith")

FAQs

Text.Proper กับตัวเลขใน text จะทำอะไร?

ตัวเลขจะไม่เปลี่ยนแปลง Text.Proper จะเปลี่ยนแค่ตัวอักษรเท่านั้น เช่น “product 2024” จะกลายเป็น “Product 2024”

ถ้า input เป็น null จะเกิดอะไร?

ถ้า input text เป็น null ผลลัพธ์ก็จะเป็น null ด้วย ไม่มี error

Text.Proper กับเครื่องหมายวรรค (punctuation) จะทำอะไร?

Text.Proper ถือว่าเครื่องหมายวรรค (comma, period, apostrophe) และช่องว่างเป็นตัวแยกคำ เช่น “it’s here” จะกลายเป็น “It’S Here” ลักษณะนี้ต้องระวัง

culture parameter มีประโยชน์ยังไง?

culture parameter ใช้สำหรับระบุกฎการแปลงอักษรตามภาษา เช่น “en-US” สำหรับอังกฤษ “th-TH” สำหรับไทย โดยแต่ละภาษามี rule ของตัวเองในการแปลงอักษร

Resources & Related

Additional Notes

ฟังก์ชัน Text.Proper(text, optional culture) ใช้สำหรับแปลงข้อความให้เป็นรูปแบบ Title Case โดยตัวแรกของแต่ละคำจะเป็นตัวพิมพ์ใหญ่และตัวอักษรที่เหลือจะเป็นตัวพิมพ์เล็ก ส่งกลับค่า Text

ที่เจ๋งคือ Text.Proper ทำให้เรา normalize ชื่อหรือข้อมูล text ที่ยุ่งๆ มาในรูปแบบสม่ำเสมอ เหมาะสำหรับ data cleaning โดยเฉพาะตอนจัดการชื่อคน ชื่อสถาน หรือหัวข้อที่ผู้ใช้พิมพ์มาแบบไม่เป็นระเบียบ

ส่วนตัวผม มักใช้ Text.Proper กับ Table.TransformColumns เพื่อ standardize ชื่อในหลายคอลัมน์พร้อมกัน ตัวอักษรจะแน่นอนและสะอาดขึ้นเยอะเลย

Leave a Reply

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