Thep Excel

Decimal.From – แปลงค่าเป็น decimal

Decimal.From แปลงค่าต่างๆ เช่น ตัวเลข (number) ข้อความ (text) ค่า boolean เป็นประเภทข้อมูล decimal ประเภท decimal มีความเที่ยงตรงสูงกว่า number ใช้สำหรับการคำนวณทางการเงิน การเก็บข้อมูลที่ต้องการความถูกต้องของทศนิยม และการประมวลผลข้อมูลด้านการบัญชี

=Decimal.From(value as any, optional culture as nullable text) as nullable number

By ThepExcel AI Agent
12 December 2025

Function Metrics


Popularity
5/10

Difficulty
3/10

Usefulness
5/10

Syntax & Arguments

=Decimal.From(value as any, optional culture as nullable text) as nullable number

Argument Type Required Default Description
value any Yes ค่าที่ต้องการแปลง (number, text, boolean ฯลฯ)
culture text Optional null สำนัก (culture) สำหรับการแปลงข้อความ เช่น “en-US” หรือ “th-TH”

How it works

แปลงข้อมูลการเงิน

แปลงจำนวนเงินจากข้อความเป็น decimal เพื่อการคำนวณที่แม่นยำ

รักษาความเที่ยงตรงของทศนิยม

ใช้สำหรับค่าที่มีทศนิยมมากมายที่ต้องการความแม่นยำ

จัดการข้อมูลบัญชี

แปลงค่าสำหรับการบัญชีและการรายงานทางการเงิน

Examples

ตัวอย่างที่ 1: แปลงตัวเลข 123.456 เป็น decimal
Decimal.From(123.456)
สูตรนี้แปลงค่า 123.456 เป็นประเภท decimal โดยรักษาความเที่ยงตรงของทศนิยมทั้งหมด
Power Query Formula:

=Decimal.From(123.456)

Result:

123.456

ตัวอย่างที่ 2: แปลงข้อความ "9999.99" เป็น decimal
Decimal.From("9999.99")
สูตรนี้แปลงข้อความตัวเลข "9999.99" เป็นค่า decimal ที่มีความแม่นยำสูง
Power Query Formula:

=Decimal.From("9999.99")

Result:

9999.99

ตัวอย่างที่ 3: แปลงค่า boolean true เป็น decimal
Decimal.From(true)
สูตรนี้แปลงค่า true เป็น decimal 1 (false จะแปลงเป็น 0) ใช้ในการคำนวณทั่วไป
Power Query Formula:

=Decimal.From(true)

Result:

1

FAQs

ความแตกต่างระหว่าง Decimal.From กับ Number.From

Decimal.From มีความเที่ยงตรงสูงกว่า Number.From ใช้ Decimal.From สำหรับการคำนวณทางการเงิน ใช้ Number.From สำหรับการคำนวณทั่วไป

สามารถแปลงข้อความที่มีเครื่องหมายจุลภาค (,) ได้หรือไม่

ได้ ถ้าระบุ culture ที่เหมาะสม เช่น “de-DE” จะแปลง “1.234,56” เป็น 1234.56

ถ้าตัวเลขมีจำนวนทศนิยมมากมายจะเป็นยังไง

Decimal.From จะรักษาความเที่ยงตรงของทศนิยมทั้งหมด ต่างจาก Number.From ที่อาจสูญเสียความแม่นยำบางส่วน

Resources & Related

Additional Notes

ฟังก์ชัน Decimal.From ใช้เพื่อแปลงค่าต่างๆ เช่น ตัวเลข ข้อความ และค่า boolean เป็นประเภทข้อมูล decimal ที่มีความเที่ยงตรงสูง

Leave a Reply

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