CEILING() Function in Salesforce | Syntax, Examples, & Use Cases

As a Salesforce Admin, I created a Formula Field for a decimal value (for example, 7.3). I used the CEILING() function to ensure the result always rounds up to the next whole number (in this case, 8).

In this article, we will learn about the CEILING() function in Salesforce and how to use it to calculate the rounded-up value of a number. Additionally, we will focus on its syntax and provide some practical examples.

Here, I found the CEILING() function useful for calculating the rounded price of the original product.

What is the CEILING() Function in Salesforce?

In Salesforce formulas, CEILING() is a math function that rounds a number up to the nearest integer. It never rounds down.

  • If the number is positive, it rounds up to the next whole number.
  • If the number is already an integer, it stays as it is.
  • If the number is negative, it rounds “away from zero” (so it becomes more negative).

Syntax and Usage of Salesforce CEILING() Function

Below is the syntax for the CEILING() function in Salesforce:

CEILING(number)

The value of the number parameter is the number we are trying to round up. The value of the parameter can be a field, a constant number, or a complex formula.

Where number can be:

  • A numeric field
  • A numeric formula
  • A constant value (like 1.25, 0.1, -2.5)

Quick examples:

  • CEILING(2.1) → 3
  • CEILING(2.9) → 3
  • CEILING(3) → 3
  • CEILING(-2.1) → -3
  • CEILING(-2.9) → -3

When should we use CEILING() in Salesforce?

We reach for CEILING() whenever I need the “round up” behavior in real‑world scenarios like:

  • Calculating how many units are needed to fulfil an order
  • Rounding up service hours to billable hours
  • Rounding up license counts or seats
  • Handling percentages or ratios that need to be whole numbers

A few typical use cases you’ll likely run into:

26–50 users → 2 managers, and so on.

1. Rounding up product quantities

    Say you sell items in packs of 5, but users type the total quantity. You want to know how many packs to ship:

    CEILING(Quantity / 5) 

    Examples:

    • Quantity = 1 → CEILING(1/5) → CEILING(0.2) → 1 pack
    • Quantity = 7 → CEILING(7/5) → CEILING(1.4) → 2 packs

    2. Rounding up billable hours

    You bill in 15‑minute increments, but consultants log time in minutes:

    CEILING( Total_Minutes__c / 15 ) 

    This gives you the number of 15‑minute blocks to bill.
    If Total_Minutes__c = 31, then 31 / 15 = 2.066…, CEILING gives 3 blocks.

    3. Rounding up subscription seats

    Maybe you allocate one account manager for every 25 active users:

    CEILING( Active_Users__c / 25 )
    • 1–25 users → 1 manager
    • 26–50 users → 2 managers, and so on.

      With this, we have learned the CEILING() function syntax, logic, and demonstration. Now, let’s move ahead and learn to determine the nearest rounded value using the Salesforce Lightning Component.

      Use the CEILING() Function in Salesforce

      Here are the steps to calculate the nearest integer by using the CEILING() function in Salesforce:

      1. Go to the Gear Icon. -> Click on the Setup. -> Select the Object Manager tab. Select the Object on which you want to create the Formula Field.
      CEILING Function in Salesforce Lightning Example
      1. In this step, we will use a formula to round a negative number up to the nearest integer and display it on the order object. To do this, select the Formula option from the data type and click Next.
      How to use CEILING function in Salesforce
      1. Next, provide the Field Label and API Name for the formula field. Then, in the Formula Return Type, select Number and click Next.
      How to use CEILING function in Salesforce Example
      1. In the formula editor, enter the formula below and click the Next button.
      • I want to calculate the number of rounds for a given “Order Production” using the CEILING() function. The formula is as follows:
      CEILING(Demand_Order__c / Unit_Size__c)
      • The “Order Production” is determined by a formula using the “Demand Order” and the “Unit Size”.
      • First, we divide the “Demand Order” field by the “Unit Size” field value and then calculate the nearest integer value by passing the resultant value to the CEILING() function.
      • To verify the formula and ensure there are no errors, click the “Check Syntax” option.
      • Alternatively, we may define the “Description,” “Help text,” and “Handle the empty field” as well.
      • To continue, click on the “Next” button.
      CEILING() Function in Salesforce
      1. Select the Field Level Security for the formula field, then select the profiles to make the field visible to them. The field will be visible for the profiles selected from the Visible column.
      How to use CEILING function in Salesforce Lightning Example
      1. In this step, we must select the field’s visibility on the object’s page layouts. In this case, we have created a formula field for the reports, allowing us to choose not to display it on the page layouts.
        • Uncheck the page layout checkboxes to prevent the field from displaying on those layouts. After this, click on the Save button.
      How to use CEILING function using Salesforce Lightning
      1. Once we’ve set up the formula field, we may use it. Let’s examine an illustration:
        • Create a new order with the fields “Demand Order” and “Unit Size” by opening the Orders Tab.
        • Click on the Details section after that, and the “Order Production” field will display the CEILING() function result.
      How to use CEILING function using Salesforce Lightning Example

      As a result, we now know how to calculate the nearest integer value in Salesforce.

      Conclusion

      The Salesforce function CEILING() is a valuable tool for working with numerical data. In addition, we have learned practical examples, such as calculating Order Quantity, Campaign Budget, and the Nearest rounded integer, among others.

      I hope you understand the concept of the CEILING function in Salesforce, including its syntax and procedure for calculating the nearest integer value.

      You may also like the following Salesforce tutorials:

      Agentforce in Salesforce

      DOWNLOAD FREE AGENTFORCE EBOOK

      Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

      Salesforce flows complete guide

      FREE SALESFORCE FLOW EBOOK

      Learn how to work with flows in Salesforce with 5 different real time examples.