How to Create a Custom Grade Calculation Formula in eClass

Step-by-Step Guide

A grade calculation is a formula used to determine grades, based on other grade items.


Note that this is not the same as Calculated question types.

Grade calculations follow the pattern of formulas/functions in popular spreadsheet programs. They start with an equal (=) sign, and use common mathematical operators and functions to produce a single numerical output. This output is then used as the computed value for the grade item you are editing.

Conditional (IF) operators can be used in grade calculations of the gradebook, and logical operators (AND,OR) can be also used.

Setting a grade calculation


You need to be enrolled in the course as an Instructor or other user with permission to edit grades

To set a grade calculation:

  1. Login to your eClass Dashboard at and go to your your course
  2. Click on Grades in the course administration block on the left side of the page, as you can see on the screenshot below:
  3. Click View and Grader Report, as you can see below:
  4. Click Turn Editing On, then the 'Controls' bar should appear above the grades, as you can see below:
  5. Click the Calculator icon under the Course Total, as you can see below:
  6. Start with an equal sign (=)
  7. Type an expression using numbers, arithmetic operators, mathematical functions and ID numbers (i.e. average())
  8. Plug in your ID numbers enclosed in double square brackets, as you can see below. (i.e. =[[item1]]+[[item2]])
  9. Separate each function argument with a comma. (i.e. =average([[item1]], [[item2]])+[[item3]]))
  10. Click Save Changes

Assigning ID numbers

You can include the values of other grade items by using their ID number as references in your formulas. The ID number must be surrounded by double square brackets, for example if you have a grade item with Quiz 3 as ID number, you can refer this item using [[Quiz.3]] in your calculation.

Below the calculation field there is a list of your course grade categories and grade items. Next to each item or category's total there is the ID number you can use in your calculation (already surrounded with the required double square brackets).

However, since ID numbers are optional, some items may not yet have one. Each item without ID number have a form field that you can use to enter its ID number directly. As soon as you have assigned the ID numbers you need, you must click the "Add ID numbers" button; the page will reload and show you the same list including the ID numbers you have just assigned. Now you can use them in your grade calculation.


eClass does not allow calculations involving no ID numbers.

Calculation functions

Every grade calculation must start with an equal sign (=) followed by an expression using operators and functions supported by the system. All common arithmetic operators are supported

  • Addition, using the plus (+) sign
  • Subtraction, using the minus (-) sign
  • Multiplication, using the asterisk (*) character
  • Division, using the slash (/) character
  • Exponentiation, using the caret (^) character

They are used with their usual evaluation precedence rules: exponentiations are evaluated first, then multiplications and divisions are performed, finally additions and subtraction are carried out; so, the expression =1+2-3*4/5^6 gives almost 3 (2,999232). Different precedencies can be forced using round parentheses, as in the expression =((((1+2)-3)*4)/5)^6 which yields 0.

Functions can also appear in expressions, using a separator between their arguments listed within round brackets.


For the English language pack (which we are working with) this separator is a comma (,).

  • average([[item1]], [[item2]]...): Returns the average of the values in a list of arguments
  • ceil(number): Maps a real number to the smallest following integer
  • floor(number): Maps a real number to the largest previous integer
  • if([[item1]], [[item2]], [[item3]]): Evaluates the first argument (condition) and returns the second argument if the condition is not zero (true condition) and returns the third argument if the condition is zero (false condition).
  • max([[item1]], [[item2]]...): Returns the maximum value in a list of arguments
  • min([[item1]], [[item2]]...): Returns the minimum value in a list of arguments
  • mod(dividend, divisor): Calculates the remainder of a division
  • pi(): Returns the value of the number Pi (3.14159265...)
  • power(base, exponent): Raises a number to the exponent power (this is the same as base^exponent)
  • round(number, count): Rounds number to count decimal digits
  • sum([[item1]], [[item2]]...): Returns the sum of all arguments (this is the same as [[item1]]+[[item2]]+...

Many other mathematical functions are also supported

  • sin()
  • sinh()
  • arcsin()
  • asin()
  • arcsinh()
  • asinh()
  • cos()
  • cosh()
  • arccos()
  • acos()
  • arccosh()
  • acosh()
  • tan()
  • tanh()
  • arctan()
  • atan()
  • arctanh()
  • atanh()
  • sqrt()
  • abs()
  • ln()
  • log()
  • exp()

Please see example calculations below for demonstration

  • =max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]) - Returns the maximum value of the grades referred by Quiz.1, Quiz.4 and Assignment.1
  • =average(max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]), min([[Quiz.1]], [[Quiz.4]], [[Assignment.1]])) - Returns the average of the maximum and the minimum values among Quiz.1, Quiz.4 and Assignment.1 (functions can be nested)
  • =sum([[item1]]*0.3, [[item2]]*0.6, [[item3]]*2) - Returns a weighted grade sum where item1 is weighted 30%, item2 is weighted at 60% and item3 is weighted at 200%
  • =if([[midtermexam]]>=5, [[midtermexam]]+[[lab]], 0) - Returns the sum of midtermexam and lab items if the midtermexam grade is 5 of more, and 0 otherwise. This is a very handy way of dealing with conditional evaluation in a course.
  • =if(AND([[item1]]>=5, [[item2]]>=5), ([[item1]]+[[item2]])/2, 0) - Returns the average of item1 and item2 if both have 5 of more, and 0 otherwise. This is a very handy way of dealing with sine qua non activities.

Calculations when user language is not English


To avoid conclusion, please note that we use the English Pack for eClass at York University.

Hence, the following is only educational purposes.

Calculations and formulas use decimal and list separators as defined in the langconfig.php file of each language pack.

The decimal separator (the symbol used to mark the boundary between the integral and the fractional parts of a decimal number) is a point (.) in English. In other languages it may be a comma (,).

Analogously, the list separator (the symbol used to separate the items within a list, such as the arguments of a function) is a comma (,) in English. In other languages it may be a semicolon (;).

Was this article helpful?

Can't find what you are looking for?

Get in touch