Calculation operators and precedence

Operators specify the type of calculation that you want to perform on the elements of a formula. There is a default order in which calculations occur, but you can change this order by using parentheses.

In this article


Types of operators

There are four different types of calculation operators: arithmetic, comparison, text concatenation (combining text), and reference.

Arithmetic operators

To perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; and produce numeric results, use the following arithmetic operators in a formula:

Arithmetic operator Meaning Example Result
+ (plus sign) Addition =3+3 6
– (minus sign) Subtraction
Negation
=3–1
=–1

2

-1

* (asterisk) Multiplication =3*3 9
/ (forward slash) Division =15/3 5
% (percent sign) Percent =20%*20 4
^ (caret) Exponentiation =3^2 9

Comparison operators

You can compare two values with the following operators. When two values are compared by using these operators, the result is a logical value either TRUE or FALSE.

Comparison operator Meaning Example
= (equal sign) Equal to A1=B1
> (greater than sign) Greater than A1>B1
< (less than sign) Less than A1<B1
>= (greater than or equal to sign) Greater than or equal to A1>=B1
<= (less than or equal to sign) Less than or equal to A1<=B1
<> (not equal to sign) Not equal to A1<>B1

Text concatenation operator

Use the ampersand (&) to concatenate (combine) one or more text strings to produce a single piece of text.

Text operator Meaning Example Result
& (ampersand) Connects, or concatenates, two values to produce one continuous text value ="North"&"wind" Northwind

="Hello" & " " & "world"

This example inserts a space character between the two words. The space character is specified by enclosing a space in opening and closing quotation marks (" ").

Hello world

Reference operators

Combine ranges of cells for calculations with the following operators.

Reference operator Meaning Example
: (colon) Range operator, which produces one reference to all the cells between two references, including the two references B5:B15
, (comma) Union operator, which combines multiple references into one reference SUM(B5:B15,D5:D15)
(space) Intersection operator, which returns a reference to the cells common to the ranges in the formula. In this example, cell C7 is found in both ranges, so it is the intersection. B7:D7 C6:C8

Top of Page Top of Page

The order in which Excel performs operations in formulas

In some cases, the order in which calculation is performed can affect the return value of the formula, so it's important to understand how the order is determined and how you can change the order to obtain desired results.

Calculation order

Formulas calculate values in a specific order. A formula in Excel always begins with an equal sign (=). The equal sign tells Excel that the characters that follow constitute a formula. Following the equal sign are the elements to be calculated (the operands, such as numbers or cell references), which are separated by calculation operators (such as +, -, *, or /). Excel calculates the formula from left to right, according to a specific order for each operator in the formula.

Operator precedence

If you combine several operators in a single formula, Excel performs the operations in the order shown in the following table. If a formula contains operators with the same precedence — for example, if a formula contains both a multiplication and division operator — Excel evaluates the operators from left to right.

Operator Description

: (colon)

(single space)

, (comma)

Reference operators
Negation (as in –1)
% Percent
^ Exponentiation (raising to a power)
* and / Multiplication and division
+ and – Addition and subtraction
& Connects two strings of text (concatenation)
=
< >
<=
>=
<>
Comparison

Use of parentheses

To change the order of evaluation, enclose in parentheses the part of the formula to be calculated first. For example, the following formula produces 11 because Excel calculates multiplication before addition. The formula multiplies 2 by 3 and then adds 5 to the result.

=5+2*3

In contrast, if you use parentheses to change the syntax, Excel adds 5 and 2 together and then multiplies the result by 3 to produce 21.

=(5+2)*3

In the following example, the parentheses around the first part of the formula force Excel to calculate B4+25 first and then divide the result by the sum of the values in cells D5, E5, and F5.

=(B4+25)/SUM(D5:F5)

Top of Page Top of Page

 
 
Applies to:
Excel 2010