• Resolved wpdia

    (@wpdia)


    How can I round Round to be .5 or Integer ?
    Small digits Demo as below:
    1.) 5.15 to 5.5
    2.) 5.4 to 5.5
    3.) 4.45 to 4.5
    4.) 9.6 to 10.0
    5.) 7.7 to 8.0

    if the digits are over 15 demo as below:
    1.) 15.1 to 16
    2.) 18.7 to 19
    3.) 18.4 to 19
    4.) 19.4 to 20

    How can i do it? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @wpdia,

    You simply should use the CEIL operation, passing to it the rounding factor as the second parameter:

    
    CEIL(fieldname1,0.5)
    

    for example:

    
    CEIL(5.15, 0.5) = 5.5
    

    But you want to use 0.5 as the rounding factor if the number is lesser than 15 and 1 if it is greater than 15, so, the equation should be modified as follows:

    
    CEIL(fieldname1, IF(fieldname1<15, 0.5, 1))
    

    and that’s all.

    Note that I’m using fieldname1 only to describe the process, you should use the name of field, variable, number or operation you want.

    Best regards.

    Thread Starter wpdia

    (@wpdia)

    Thank you so much ! Resolved .

    Plugin Author codepeople

    (@codepeople)

    Hello @wpdia,

    It has been a pleasure.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Round .5 or Integer’ is closed to new replies.