---
title: ERROR.TYPE – ดูรหัส Error
url: https://www.thepexcel.com/functions/excel/information/error-type/
type: function-explainer
program: Excel
syntax: =ERROR.TYPE(error_val)
date: 2025-12-02
updated: 2025-12-17
scores:
  popularity: 3
  difficulty: 2
  usefulness: 2
---

# ERROR.TYPE – ดูรหัส Error

> ดูรหัส Error

## คำอธิบาย

ส่งกลับตัวเลขระบุประเภทของข้อผิดพลาด

## Syntax

```excel
=ERROR.TYPE(error_val)
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| error_val | Yes | Any |  | ค่า Error |

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: ตรวจหา Error #DIV/0!

```excel
=ERROR.TYPE(1/0)
```

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

เมื่อนำ 1 มาหารด้วย 0 จะเกิด Error #DIV/0! ซึ่งมีรหัส Error Type เป็น 2

### 2. ตัวอย่างที่ 2: ตรวจหา Error #N/A

```excel
=ERROR.TYPE(NA())
```

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

ฟังก์ชัน NA() ถูกใช้เพื่อสร้าง Error #N/A ซึ่งมีรหัส Error Type เป็น 7

### 3. ตัวอย่างที่ 3: ใช้กับ IFERROR เพื่อจัดการ Error เฉพาะ

```excel
=IF(ERROR.TYPE(CellWithFormula)=7, "ข้อมูลไม่พบ", "มี Error อื่นๆ")
```

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

สมมติ CellWithFormula มีสูตรที่อาจคืนค่า Error
- ถ้าสูตรคืนค่า #N/A (รหัส 7) จะแสดงข้อความ "ข้อมูลไม่พบ" 
- ถ้าเป็น Error ชนิดอื่น จะแสดง "มี Error อื่นๆ" (หรือไม่จัดการ) 
- หากสูตรไม่มี Error จะแสดง #N/A (จาก ERROR.TYPE) หรือ error ชนิดนั้นๆ

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

- [IF – ฟังก์ชันตรรกะพื้นฐาน](https://www.thepexcel.com/functions/excel/logical/if/)
- [IFERROR – ดักจับ Error และเปลี่ยนเป็นค่าอื่น](https://www.thepexcel.com/functions/excel/logical/iferror/)
- [IFNA – แทนค่าเมื่อพบ #N/A Error](https://www.thepexcel.com/functions/excel/logical/ifna/)
- [ISERROR – ตรวจสอบว่ามี Error หรือไม่ (ทุกประเภท)](https://www.thepexcel.com/functions/excel/information/iserror/)
- [N – แปลงค่าให้เป็นตัวเลข](https://www.thepexcel.com/functions/excel/information/n/)
- [NA – ฟังก์ชันส่งคืนค่า #N/A](https://www.thepexcel.com/functions/excel/information/na/)
- [TYPE – ตรวจสอบชนิดข้อมูล](https://www.thepexcel.com/functions/excel/information/type/)

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

- [Official Documentation](https://support.microsoft.com/en-us/office/error-type-function-10958677-7c8d-44f7-ae77-b9a9ee6eefaa) _(official)_
- [ExcelJet](https://exceljet.net/excel-functions/excel-error-type-function) _(guide)_

---

_Source: [https://www.thepexcel.com/functions/excel/information/error-type/](https://www.thepexcel.com/functions/excel/information/error-type/)_
