# Creating a formula in the grades formula editor

Use the Formula Editor to define a formula that calculates a grade itemâ€™s value based on other grade items. When you create a formula, you specify which grade items you want included in the formula and the relationships between them. An example of a simple formula is one that calculates the sum of a number of grade items. A more complicated formula is one that drops the minimum or maximum value from a set of grade items.

Note: If the Formula Editor is turned off at your organisation, contact your site administration about getting access to this functionality.

The Formula Editor is available on the New Item page and Edit Item page for Formula items, and the Edit Calculated Final Grade page and Edit Adjusted Final Grade page for the Formula grading system.

## Access the Formula Editor

- On the Manage Grades page, click the name of a formula grade item you wish to edit.
- Click Edit Using the Formula Editor.

Formula Editor

Error | Description | Examples |
---|---|---|

Unexpected [token_type] e.g., Unexpected operator |
The formula contains a function component in an unexpected location |
= 5=/1 = (5+1)2 |

Unbalanced parentheses |
The formula contains an opening or closing bracket without a corresponding bracket |
= 5+1) |

Missing end of function |
The formula contains an unclosed function |
= SUM{[Item1.Points], [Item2.Points] |

Unexpected function end |
The formula contains a closing bracket for a function that does not relate to a function |
= [Item1.Points]/2} |

Invalid number of operator parameters |
The formula contains an invalid number of operator parameters |
= [Item1.Points] + |

Invalid number of function parameters |
The formula contains an invalid number of function parameters |
= SUM{} = IF{[Item1.Points]<2,5} |

Numeric value expected |
A Boolean statement or operator was entered in place of a numeric value |
= IF{5<2,1 OR 1,4} = SUM{1 = 2,3,4} |

Boolean value expected |
A Boolean statement was not entered for a condition |
= IF {MIN{4,5},100,0} = NOT{4} |

Invalid terminal |
The formula contains an incorrectly used terminal |
= [Item1.Points] + 3.2.5 |

### Scenario 1

Give users who achieved over 75% on all grade items in a category 100% for the category.

= IF {MIN{[Week1.Percent],[Week2.Percent],[Week3.Percent]} < 75, 0, 100}

### Scenario 2

Drop the lowest two grades in a set of three grades

= SUM{[G1.PointsReceived],[G2.Points Received], [G3Points Received]} - MIN{[G1.PointsReceived],[G2.Points Received]} - IF{MIN{[G2.Points Received], [G3Points Received]} = MIN{[G1.PointsReceived],[G2.Points Received]}, MIN{[G1.PointsReceived],[G3.Points Received]}, MIN {[G2.PointsReceived],[G3.Points Received]}}

### Scenario 3

Fail users who receive less than 60% on either their midterm or final exam.

= IF {MIN{[Midterm.Percent],[Final.Percent]} < 60, 0, SUM {[A1.Percent],[A2.Percent],[G1.Percent],[G2.Percent],[Midterm.Percent],[Final.Percent]}}