• Resolved nuwebdesign

    (@nuwebdesign)


    Hi!

    I have a calculator that has a field where when they enter a number, it takes it and rounds to the nearest thousand. However, I need it to always round up to the nearest thousand rather than down and up.

    Example:
    They enter the amount “123,123” rather than making it round to the closest thousand down (123,000), is there a way to make it always round up to the closest (124,000)?

    Thanks!

    https://wordpress.org/plugins/calculated-fields-form/

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

    (@codepeople)

    Hi,

    In this case you should use some mathematic tricks:

    ceil(123123/1000)*1000

    The operation “ceil” rounds the value to the next integer number. So, I will develop the previous equation as demo:

    ceil(123123/1000)*1000
    = ceil(123.123)*1000
    = 124*1000
    = 124000

    Best regards.

    Thread Starter nuwebdesign

    (@nuwebdesign)

    That is something similar I have already in place but when I get 123.123 I have:
    ROUND(123.123) then it times that by 1000. Didn’t know the function ceil rounded to the next highest integer. Thank you so very much!

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

The topic ‘Round up to nearest thousand’ is closed to new replies.