Cellwise Start free

Excel reference

Excel operators, wildcards and order of operations

Quick answerExcel has four kinds of operators: arithmetic (+ - * / ^ %), the & operator that joins text, comparisons (= <> > < >= <=) that return TRUE or FALSE, and reference operators (: , and space) that build ranges. Wildcards (* ? ~) are not operators but patterns that COUNTIF, SUMIFS, XLOOKUP and MATCH understand. Excel calculates negation first, then %, then ^, then * and /, then + and -, then &, then comparisons, so =-2^2 is 4.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCD
1ProductRegionUnitsPrice
2Desk lampNorth439
3Lamp shadeSouth108.5
4Floor lampNorth364
5Bulb pack 4*60WEast126
6Desk fanEast729

Download this sheet as an Excel practice file (.xlsx)

Arithmetic operators: + - * / ^ %

These work like a calculator. The one that surprises people is %: it divides the number before it by 100, so 10% is 0.1 and =D2*(1-10%) takes 10% off a price.

OperatorMeaningExample
+Add=C2+C3
-Subtract, or make negative=D2-5 or =-D2
*Multiply=C2*D2
/Divide=C3/C2
^Raise to a power=2^10
%Percent (divide by 100)=D2*15%
=C2*D2

Result: 156

Units times price for the desk lamp: 156.

=D2*(1-10%)

Result: 35.1

The lamp price with 10% off: 35.1. The brackets matter here; without them it would be D2*1-10%.

=2^10

Result: 1024

2 to the power of 10 is 1,024. The caret is also how you take roots: =64^(1/3) is the cube root of 64.

The & operator: join text

& glues values together into one piece of text. Put spaces and punctuation in quotes. It does the same job as CONCAT, and is usually quicker to type for two or three pieces.

The catch: joining a number turns it into text and drops its format, so 1834.5 shown as $1,834.50 joins as 1834.5. Wrap the number in TEXT to keep the look.

=A2&" ("&B2&")"

Result: Desk lamp (North)

Desk lamp (North): the product, a space and bracket in quotes, the region, and the closing bracket.

="Total: "&TEXT(C2*D2,"$#,##0.00")

Result: Total: $156.00

Total: $156.00. TEXT keeps the currency format inside the sentence.

=C2&D2

Result: 439

439, but as text, not a number: & always returns text. Use + to add.

Comparison operators: = <> > < >= <=

A comparison returns TRUE or FALSE. You will mostly use them inside IF, AND, OR, FILTER and conditional formatting rules. Three rules catch people out:

Text comparisons ignore case, so "north" equals "North"; use EXACT when case matters. A number and the same digits typed as text are not equal. And when Excel compares different types, text always counts as greater than any number, and TRUE and FALSE as greater than text.

OperatorMeaningExample
=Equal to=B2="North"
<>Not equal to=B2<>"North"
>Greater than=C2>5
<Less than=D2<10
>=Greater than or equal to=C2>=4
<=Less than or equal to=D2<=39
=C2>=4

Result: TRUE

TRUE: the desk lamp sold exactly 4 units, and >= includes the boundary.

=B2="north"

Result: TRUE

TRUE, even though the cell says North. = ignores case.

="10"=10

Result: FALSE

FALSE: the text "10" and the number 10 are different values. This is why numbers stored as text break lookups.

Operators inside criteria: COUNTIF, SUMIF and friends

In COUNTIF, COUNTIFS, SUMIF, SUMIFS, AVERAGEIF(S), MAXIFS and MINIFS the condition is a piece of text, so the operator goes inside quotes: ">=5", "<>North". To compare with a cell or a calculation, join the operator to it with &: ">"&F1. "<>" on its own means "not empty" and "=" on its own means "empty".

=COUNTIF(C2:C6,">=5")

Result: 3

3 products sold 5 units or more.

=SUMIF(B2:B6,"<>North",C2:C6)

Result: 29

29 units sold outside the North region. <> in quotes means "not equal to".

=COUNTIF(C2:C6,">"&AVERAGE(C2:C6))

Result: 2

2 products sold more than the average. The operator in quotes is joined to the calculated average with &.

=COUNTIF(C2:C6,">=C2")

Result: 0

The common slip: with the cell inside the quotes, Excel compares with the text "C2", finds nothing and returns 0. Write ">="&C2 instead.

Wildcards: * ? and ~

A wildcard stands in for characters you do not know. * matches any number of characters, including none. ? matches exactly one. ~ in front of * or ? means the real character. Like everything in criteria, wildcards ignore case.

They work in COUNTIF(S), SUMIF(S), AVERAGEIF(S), MAXIFS, MINIFS, VLOOKUP and HLOOKUP with an exact match, MATCH with 0, SEARCH, and XLOOKUP and XMATCH when match_mode is 2. They do not work with the = operator, in FIND, or inside FILTER conditions: there, use ISNUMBER(SEARCH("lamp",A2:A6)) instead.

PatternMatchesDoes not match
"*lamp*"Desk lamp, Lamp shade, Floor lampDesk fan
"lamp*"Lamp shadeDesk lamp
"*lamp"Desk lamp, Floor lampLamp shade
"Desk ???"Desk fanDesk lamp (4 letters)
"*~**"Bulb pack 4*60Wanything without a *
"<>*lamp*"Bulb pack 4*60W, Desk fanany lamp
=COUNTIF(A2:A6,"*lamp*")

Result: 3

3 products contain "lamp" anywhere, in any case.

=COUNTIF(A2:A6,"Desk ???")

Result: 1

1: each ? is exactly one character, so Desk fan matches and Desk lamp, with four letters, does not.

=COUNTIF(A2:A6,"*~**")

Result: 1

1 product name has a real asterisk in it. ~* means the character *, and the * on each side means anything around it.

=SUMIFS(C2:C6,A2:A6,"*lamp*",B2:B6,"North")

Result: 7

7 lamp units sold in the North region: a wildcard and an exact condition together.

=XLOOKUP("floor*",A2:A6,D2:D6,"Not found",2)

Result: 64

64, the price of the Floor lamp. XLOOKUP only reads wildcards when the fifth argument, match_mode, is 2.

Reference operators: colon, comma and space

The colon makes a range: C2:C6 is every cell from C2 to C6, and A1:D6 a block of 24 cells.

The comma joins references. Inside SUM(C2:C6,D2:D6) it simply separates two arguments. Wrapped in its own brackets, =SUM((C2:C6,D2:D6)), it is the union operator that turns both ranges into one reference, which matters for the few functions that take a single reference argument.

A space is the intersection operator: =C2:C6 B4:D4 means only the cells the two ranges share, here C4. If the ranges do not overlap you get #NULL!, which is why a space typed by accident instead of a comma or colon causes that error.

=SUM(C2:C6)

Result: 36

The colon range covers all five products: 36 units.

=SUM(C2:C3,C5)

Result: 26

Commas separate arguments, so you can add a range and a single cell: 4 + 10 + 12 is 26.

The # and @ operators (Excel 365)

A # after a cell, such as F2#, means the whole spill range that starts there: every value a dynamic array formula in F2 returned, however many rows it grows to. =COUNTA(F2#) counts them and =SUM(F2#) adds them.

The @ is the implicit intersection operator. It asks for one value instead of a range. You rarely type it, but Excel 365 adds it to formulas written in older versions, such as =@A2:A10, so they keep returning one value as they did before spilling existed. Inside a Table, [@Units] means the Units value in the same row.

Order of operations: what Excel calculates first

Excel does not just work left to right. It follows this order, and brackets override it: whatever is in brackets is calculated first, innermost first. Operators on the same level, such as * and /, are worked left to right.

Two results look wrong until you know the order. Negation comes before ^, so =-2^2 squares -2 and gives 4, where most maths books give -4; write =-(2^2) for that. And ^ works left to right, so =2^3^2 is (2^3)^2, which is 64, not 2^9.

OrderOperatorWhat it does
1: (colon), space, , (comma)Reference operators
2-Negation, as in -2
3%Percent
4^Power
5* and /Multiply and divide
6+ and -Add and subtract
7&Join text
8= < > <= >= <>Compare
=10+5*2

Result: 20

20: multiplication first, then the addition. =(10+5)*2 would be 30.

=-2^2

Result: 4

4: Excel applies the minus sign to 2 before squaring it.

=0-2^2

Result: -4

-4: here the minus is subtraction, which comes after ^. Same digits, different result.

=2^3^2

Result: 64

64: ^ is worked left to right, so this is 8 squared. Write =2^(3^2) for 512.

="Units: "&C2+C3

Result: Units: 14

Units: 14. + comes before &, so the units are added first and the total is joined to the label.

Common mistakes

Leaving the cell inside the quotes

COUNTIF(C2:C6,">C2") compares with the text C2. Join the cell with &: ">"&C2.

Using * in FILTER or with =

Wildcards only work inside functions that support them. =A2="*lamp*" looks for an actual asterisk; use ISNUMBER(SEARCH("lamp",A2)) to test whether text contains a word.

Trusting -x^2

If a cell holds 3, =-A1^2 returns 9, not -9. Write =-(A1^2) when you want the negative of the square.

Joining when you meant to add

& returns text, so =C2&D2 gives 439 as text, and SUM will not count it. Use + for maths.

FAQ

What does <> mean in Excel?

Not equal to. =A2<>"Done" is TRUE for anything except Done, and COUNTIF(A2:A10,"<>Done") counts those cells. "<>" alone means not empty.

How do I use wildcards in Excel?

Put * for any characters or ? for one character inside the criteria, in quotes: =COUNTIF(A2:A100,"*lamp*"). They work in COUNTIF, SUMIF and their S versions, VLOOKUP and MATCH with an exact match, and XLOOKUP with match_mode 2.

Why does Excel calculate -2^2 as 4?

Excel applies negation before exponents, so -2^2 means (-2)^2. Write =-(2^2) or =0-2^2 to get -4.

What does & do in Excel?

It joins values into one piece of text: =A2&" "&B2 joins a first and last name with a space. The result is always text.

How do I count cells that contain an asterisk or question mark?

Put a tilde before it: =COUNTIF(A2:A100,"*~**") counts cells containing *, and "*~?*" counts cells containing ?.

What does the @ symbol mean in an Excel formula?

It is the implicit intersection operator: it makes a formula use one value instead of a range. Excel 365 adds it to some older formulas so they behave as they always did. In a Table, [@Column] means the value in the same row.

Functions on this page

Related guides

More Excel reference

Updated