---
title: Decimal.From – แปลงค่าเป็น decimal
url: https://www.thepexcel.com/functions/power-query/number-functions/decimal-from/
type: function-explainer
program: Power Query
syntax: "Decimal.From(value as any, optional culture as nullable text) as nullable number"
date: 2025-12-12
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

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

> แปลงค่าต่างๆ เป็น decimal

## คำอธิบาย

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

## Syntax

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

## Arguments

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

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

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

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

_เหมาะกับ:_ financial-conversion

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

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

_เหมาะกับ:_ precision-calculation

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

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

_เหมาะกับ:_ accounting-data

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: แปลงตัวเลข 123.456 เป็น decimal

```excel
Decimal.From(123.456)
```

**ผลลัพธ์:** `123.456`

สูตรนี้แปลงค่า 123.456 เป็นประเภท decimal โดยรักษาความเที่ยงตรงของทศนิยมทั้งหมด

### 2. ตัวอย่างที่ 2: แปลงข้อความ "9999.99" เป็น decimal

```excel
Decimal.From("9999.99")
```

**ผลลัพธ์:** `9999.99`

สูตรนี้แปลงข้อความตัวเลข "9999.99" เป็นค่า decimal ที่มีความแม่นยำสูง

### 3. ตัวอย่างที่ 3: แปลงค่า boolean true เป็น decimal

```excel
Decimal.From(true)
```

**ผลลัพธ์:** `1`

สูตรนี้แปลงค่า true เป็น decimal 1 (false จะแปลงเป็น 0) ใช้ในการคำนวณทั่วไป

## หมายเหตุเพิ่มเติม

⚠️ ฟังก์ชัน Decimal.From เหมาะสำหรับการคำนวณที่ต้องความแม่นยำสูง เช่น การเงิน การบัญชี ถ้าข้อมูลแหล่งที่มาเป็นตัวเลขด้วยทศนิยมหลายตำแหน่ง ให้ใช้ฟังก์ชันนี้เพื่อรักษาความเที่ยงตรง

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

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

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

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

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

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

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

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

- [Number.From – แปลงค่าเป็นตัวเลข](https://www.thepexcel.com/functions/power-query/number-functions/number-from/)
- [Double.From – แปลงค่าเป็น double](https://www.thepexcel.com/functions/power-query/number-functions/double-from/)
- [Int32.From – แปลงค่าเป็น 32-bit integer](https://www.thepexcel.com/functions/power-query/number-functions/int32-from/)
- [Currency.From – แปลงเป็นสกุลเงิน](https://www.thepexcel.com/functions/power-query/number-functions/currency-from/)

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

- [Microsoft Learn: Decimal.From](https://learn.microsoft.com/en-us/powerquery-m/decimal-from) _(documentation)_
- [Power Query M Function Reference](https://learn.microsoft.com/en-us/powerquery-m/power-query-m-function-reference) _(documentation)_

---

_Source: [https://www.thepexcel.com/functions/power-query/number-functions/decimal-from/](https://www.thepexcel.com/functions/power-query/number-functions/decimal-from/)_
