Support » Plugin: Calculated fields for ACF » Total To Be Rounded

  • Resolved papacoupon

    (@papacoupon)


    Hello,
    fantastic plugin and really very useful .. but i have some small issue.

    FieldA = 14 (As Variable Value)
    /
    FieldB = 65 (As Fixed Value)

    My Equation is :
    sum(FieldA/ceil(FieldB))

    Result is 0.21538461538462%

    i need the result to be rounded to the next higher integer as default

    notice : Maybe next time FieldA will be different value so i need the result every time to next higher integer as default.

    can you help me to make it with right Equation ?

    Many thanks.

    The page I need help with: [log in to see the link]

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

    (@wundermatics)

    To round up to the nearest higher integer, you would use “ceil”. In your case:

    ceil(sum(FieldA/FieldB))

    Other examples of valid expressions using rounding functions:

    round(10.2) (returns 10)
    round(10.9) (returns 11)
    round(10.888888 * 10) / 10 (returns 10.9)
    ceil(10.2) (returns 11)
    floor(10.2) (returns 10)

    Edit: I read your question again, I’m a bit uncertain if I understood you correctly. In y answer above, the formula would return 1. ceil(14/65) = ceil(0.21538) = 1. Is that what you wanted?

    • This reply was modified 3 months, 1 week ago by wundermatics.

    thanks for you kindly replay and your action

    Edit: I read your question again, I’m a bit uncertain if I understood you correctly. In y answer above, the formula would return 1. ceil(14/65) = ceil(0.21538) = 1. Is that what you wanted?

    actually it return to 0.21538461538462% & when we convert it to round up to the nearest higher integer it must to be 22%

    i tried to use this formula

    ceil(sum(FieldA/FieldB))

    but give me 1% when the right answer must be 22%

    so how we convert this number 0.21538461538462% to the nearest higher integer 22%.

    many thanks again for your help

    Plugin Author wundermatics

    (@wundermatics)

    OK, misunderstood your question a bit then. From a pure math point of view, 0.2153 is actually the same as 21.53%

    To get what you want, you need to use this formula

    ceil(sum(FieldA/FieldB) * 100)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.