mathopenrefinegrel

GREL round up number and be divisible by 5


In OpenRefine I have a data set and I would like to round the number to the closest value and can be divided by 5 (divisible by 5).

For example:

1.35 would be 1.50
1.70 would be 2.00

I have looked into the documentation but couldn't figure out how to achieve that.


Solution

  • If your numbers are all integers, you could do:

    floor((value+4)/5)*5
    

    If it's possible that you'll get floating point numbers too, you could modify it along the lines of:

    floor((value+4.999)/5)*5