---
title: Record.FieldCount – นับจำนวน Field ใน Record
url: https://www.thepexcel.com/functions/power-query/record-functions/record-fieldcount/
type: function-explainer
program: Power Query
syntax: Record.FieldCount(record as record) as number
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 2
  usefulness: 4
---

# Record.FieldCount – นับจำนวน Field ใน Record

> นับจำนวน Field

## คำอธิบาย

นับจำนวน Field ทั้งหมดใน Record

## Syntax

```excel
Record.FieldCount(record as record) as number
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| record | Yes | record |  | Record ที่ต้องการนับจำนวน Field |

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

### ตรวจสอบว่า Record ว่างหรือไม่

ถ้า Record.FieldCount ได้ 0 แสดงว่าเป็น Empty Record

### ตรวจสอบความครบถ้วนของข้อมูล

ใช้ตรวจสอบว่า Record มีจำนวน Field ครบตามที่คาดหวังหรือไม่

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: นับจำนวน Field พื้นฐาน

```excel
Record.FieldCount([CustomerID = 1, Name = "Bob"])
```

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

มี 2 Field คือ CustomerID และ Name

### 2. ตัวอย่างที่ 2: นับจำนวน Field ใน Record ว่าง

```excel
Record.FieldCount([])
```

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

Record ว่างไม่มี Field ใดๆ

### 3. ตัวอย่างที่ 3: นับจำนวน Field ข้อมูลผสม

```excel
Record.FieldCount([A=1, B="Text", C=true])
```

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

มี 3 Field คือ A, B และ C ซึ่งเป็นข้อมูลต่างชนิดกัน

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

- [Record.FieldNames – ดึงชื่อ Field ทั้งหมดจาก Record](https://www.thepexcel.com/functions/power-query/record-functions/record-fieldnames/)
- [Record.HasFields – ตรวจสอบว่ามี Field ที่ระบุหรือไม่](https://www.thepexcel.com/functions/power-query/record-functions/record-hasfields/)
- [Record.Field – ดึงค่า Field จาก Record](https://www.thepexcel.com/functions/power-query/record-functions/record-field/)
- [Table.ColumnCount](https://www.thepexcel.com/functions/power-query/table-functions/table-columncount/)

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

- [Microsoft Learn: Record.FieldCount](https://learn.microsoft.com/en-us/powerquery-m/record-fieldcount) _(Official Documentation)_

---

_Source: [https://www.thepexcel.com/functions/power-query/record-functions/record-fieldcount/](https://www.thepexcel.com/functions/power-query/record-functions/record-fieldcount/)_
