[GIS] QGIS upper round in field calculator

field-calculatorqgis

With the field calculator, I need to do the following calc: toint(Field1 / 25.0) but i need to round the result to no decimal places but upwards. Examples:

  • If 17/25 result should 1.
  • If 25/25 result should 1.
  • If 26/25 result should 2.
  • If 51/25 result should 3.

I guess I need to use round function but it is not giving the results I am expecting.

Best Answer

You are using the wrong rounding function:

  • ceil: rounds up (to the ceiling)
  • round: rounds to the nearest value
  • floor: rounds down (to the floor)

If you select a function, you can see the help documentation in the pane on the right hand side of the field calculator window. This will explain how to use each function.

Related Question