Loading
Feature degradation | Gmail Email delivery failureRead More

CEILING and FLOOR formula functions behave differently for negative numbers

Publish Date: Oct 13, 2022
Description
When using the CEILING() and FLOOR() formula functions, numbers are rounded up (to the nearest integer) and down (to the nearest integer) respectively.  However, when the number is negative, the behavior is reversed.  

For example, the results of a positive and negative number:

CEILING (2.5) = 3.0
FLOOR (2.5) = 2.0

CEILING (-2.5) = -3.0
FLOOR(-2.5) = -2.0
Resolution
When a negative number is used in a CEILING() function, the application uses the FLOOR() function instead.  And when the FLOOR() function is used for a negative number, the CEILING() function will be used.  

In other words the function applies on the number as an absolute value. Example for Ceiling of -2.5, the system applies the Ceiling to 2.5 and hence the result is 3. Then the negative is added.
Knowledge Article Number

000386432

 
Loading
Salesforce Help | Article