How Excel Reads a Formula
Learn operator precedence, how Excel evaluates nested functions from the inside out, and how to inspect any formula step by step with F9.
Welcome back!
Step 1 of 10Learn
The $39,800 commission
Maya built a commission sheet for her sales team. Reps earn 10% of net sales, which is sales minus returns. Sales sit in column B, returns in column C, so she typed =B2-C2*10% and copied it down 40 rows. The numbers looked large, but sales were large too, and she sent the file to payroll.
Payroll called within the hour. A rep with $40,000 in sales and $2,000 in returns was down for a commission of $39,800. The right figure was $3,800.
The formula wasn't broken. Excel did exactly what it was told, following a fixed set of rules about which operations happen first: it took 10% of the returns and subtracted that from sales. The intended formula was =(B2-C2)*10%.
Almost every "Excel is wrong" moment comes down to one of three things: the order of operations, a reference that moved when the formula was copied, or a value that looks like a number but is stored as text. This lesson covers the first. Once you can read a formula the way Excel reads it, you can predict results before you press Enter and find mistakes in other people's workbooks in seconds.
Step 2 of 10Learn
Operator precedence
When a formula contains several operators, Excel applies them in this order, from first to last:
| Order | Operator | Meaning |
|---|---|---|
| 1 | - (in front of a value) | Negation |
| 2 | % | Percent |
| 3 | ^ | Exponent |
| 4 | * and / | Multiply and divide |
| 5 | + and - | Add and subtract |
| 6 | & | Join text |
| 7 | =, <>, <, >, <=, >= | Compare |
Operators on the same level run left to right, so =12/2*3 is (12/2)*3 = 18, not 12/6 = 2. Parentheses override everything: whatever is inside them is calculated first, innermost pair first.
Two results surprise even experienced users. First, =-3^2 returns 9, not −9, because negation (level 1) happens before the exponent (level 3): Excel squares −3. Write =-(3^2) if you mean −9. Second, ="Total: "&2+3 returns Total: 5, because addition (level 5) runs before joining (level 6).
The practical rule: when in doubt, add parentheses. They cost nothing, and they tell the next reader what you meant.
Step 3 of 10Practice · Work it out
What does Excel return for =2+3*4^2?
Step 4 of 10Practice · Choose one
Cell A1 contains 5. What does =-A1^2 return?
Step 5 of 10Learn
Inside out: how nested functions run
A function can be an argument of another function. In =ROUND(AVERAGE(B2:B10)*1.08,2), Excel first calculates AVERAGE(B2:B10), multiplies the result by 1.08, and only then rounds to two decimals. The rule is inside out: the innermost function is evaluated first, and its result becomes an argument of the function around it.
Reading a long formula is easier if you do the same. Start at the deepest pair of parentheses, work out what that piece returns, and replace it mentally with the result. Suppose B2:B10 averages 41.237. The formula becomes =ROUND(41.237*1.08,2), then =ROUND(44.53596,2), then 44.54.
Arguments are separated by commas (in some regional settings, semicolons). Optional arguments are shown in square brackets in Excel's tooltip, such as ROUND(number, num_digits) versus XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], ...). If you skip an optional argument, Excel uses its default, and knowing those defaults is half of mastering functions. You'll see several costly defaults in this course, starting with VLOOKUP, which defaults to approximate match.
Step 6 of 10Note
Step 7 of 10Learn
Comparisons, text and percent
Comparison operators return a logical value, TRUE or FALSE. If B2 holds 72, =B2>=70 displays TRUE. These logical values are the raw material of IF, FILTER, COUNTIFS and many other functions, and Excel also treats them as numbers in arithmetic: TRUE counts as 1 and FALSE as 0. So =(B2>=70)*100 returns 100 when the test passes and 0 when it fails. You'll use that trick later with SUMPRODUCT.
The & operator joins values into text: =A2&" "&B2 turns "Ana" and "Ruiz" into "Ana Ruiz". A number joined with text becomes text, which matters later: text that looks like a number is not counted by SUM.
The % operator simply divides by 100, so =200*15% is 30. Typing 15% into a cell stores 0.15 with percent formatting.
Comparing text is not case-sensitive: ="apple"="APPLE" returns TRUE. When you need a case-sensitive comparison, use EXACT("apple","APPLE"), which returns FALSE.
Step 8 of 10Practice · Fill in the blanks
Fill in the blanks
If cell B2 contains 64, the formula =B2>=70 returns , and =(B2>=70)*50 returns .
Step 9 of 10Practice · Spot the mistake
A teacher wants the average of three quiz scores in A2, B2 and C2. Click the token that makes this formula wrong.
Step 10 of 10Practice · Choose one
Commission is 10% of net sales: sales in B2 minus returns in C2. Which formula is correct?
Lesson complete!