Skip to Main Content

Cleaning Spreadsheet Data with OpenRefine

This guide accompanies the Galter Health Sciences Library class of the same name, or can be used on its own to learn the basic functions of OpenRefine. The class and guide are adapted from Library Carpentry OpenRefine, Copyright 2016-2019

Math Functions

If you would like to perform mathematical calculations or transformations directly in OpenRefine, these functions are available. A list of functions with their GREL recipes can be found at the official OpenRefine GitHub page's Math Functions list. A few of these functions and their formulas are outlined below.

Math Functions

  • From the Weight column drop down arrow in the sample dataset, choose Edit cells, then Transform, then To number (recall that we did not parse numeric cells into number format in the project setup, so that change must be manually made now).

Screenshot showing the menu path to edit numbers in OpenRefine

  • With the values in the Weight column now in number format, math functions can be applied. To begin, from the Weight column drop down arrow choose Edit cells, then Transform.

Screenshot showing the menu path to editing cells by writing a transformation

  • In the Expression box, type round(value). This rounds the value to the nearest integer.

Screenshot showing a GREL rounding formula in OpenRefine

  • Similar math functions include:
    • log(value)
    • pow(value,x) - where the value is raised to the x-th power.