Thep Excel

ceil – ปัดเศษขึ้นให้เป็นจำนวนเต็ม

ceil ปัดเศษขึ้นให้เป็นจำนวนเต็มที่มากกว่าหรือเท่ากับค่าเดิม ใช้เมื่อต้องการปัดทศนิยมขึ้นทุกกรณี ตรงข้ามกับ floor ที่ปัดลง

=number.ceil()

By ThepExcel AI Agent
16 December 2025

Function Metrics


Popularity
7/10

Difficulty
2/10

Usefulness
7/10

Syntax & Arguments

=number.ceil()

Argument Type Required Default Description
number Number Yes ค่าตัวเลขที่ต้องการปัดเศษขึ้น (decimal หรือ integer ได้)

How it works

Scenario 1

General usage

Examples

ปัดเศษทศนิยมขึ้นเป็นเต็ม
{{ (3.1).ceil() }}
ปัดเศษ 3.1 ขึ้นเป็น 4 เพราะ 4 เป็นจำนวนเต็มที่เล็กที่สุดที่มากกว่า 3.1
n8n Formula:

={{ (3.1).ceil() }}

Result:

4

ใช้กับจำนวนลบ
{{ (-2.5).ceil() }}
ปัดเศษ -2.5 ขึ้นเป็น -2 เพราะ -2 มากกว่า -2.5 (บน number line) ครับ
n8n Formula:

={{ (-2.5).ceil() }}

Result:

-2

ปัดเศษจำนวนเต็มอยู่แล้ว
{{ (5.0).ceil() }}
ถ้าเป็นจำนวนเต็มแล้ว ceil() จะคืนค่าเดิม ไม่เปลี่ยน
n8n Formula:

={{ (5.0).ceil() }}

Result:

5

คำนวณจำนวนหน้าจากข้อมูล
{{ ($json.totalItems / $json.itemsPerPage).ceil() }}
ถ้า totalItems = 7 และ itemsPerPage = 3 จะ ceil(7/3) = ceil(2.33) = 3 หน้า สมมติ $json.totalItems = 7 และ $json.itemsPerPage = 3
n8n Formula:

={{ ($json.totalItems / $json.itemsPerPage).ceil() }}

Result:

3

FAQs

ceil() แตกต่างจาก round() อย่างไร?

ceil() ปัดขึ้นเสมอ แต่ round() ปัดไปหลักที่เหมาะสม เช่น ceil(3.2) = 4 แต่ round(3.2) = 3 ครับ

ใช้ ceil() ในไหนของ n8n workflow?

ใช้ได้ใน Code node, Set node (expression mode), หรือ IF node สำหรับเงื่อนไข การคำนวณจำนวนหน้า quota allocation เป็นต้น

ceil() และ Math.ceil() ต่างกันไหม?

ใน n8n ใช้ number.ceil() เป็น method บนค่า ส่วน Math.ceil() เป็นฟังก์ชัน static ในจาวาสคริปต์ น8n suppport ทั้งสอง

Resources & Related

Additional Notes

ceil คือ method ในการปัดเศษขึ้น มันจะคืนค่าจำนวนเต็มที่เล็กที่สุดที่ยังมากกว่าหรือเท่ากับค่าที่ใส่เข้ามา ใช้ได้ทั้งตัวเลขบวกและลบครับ

ตัวอย่างเช่น ceil(3.1) = 4, ceil(3.0) = 3, ceil(-2.5) = -2 (ปัดขึ้นไปทาง positive infinity นะ)

ส่วนตัวผมใช้ ceil() ในการคำนวณจำนวนหน้าจากข้อมูลหรือจำนวนแพทช์ทีม เช่นถ้าจำนวน item = 7 และแต่ละหน้าแสดง 3 item ต้องการ ceil(7/3) = 3 หน้า ครับ 😎

Leave a Reply

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