`=`, operators, parentheses — and the same rule in R
◈ 8 cardsA formula starts with `=`, uses `+ - * / ^`, and evaluates `^` before `* /` before `+ -`. A missing parenthesis produces a plausible wrong number, in Sheets and in R alike.
What a formula is
A cell that starts with = is a formula; everything after the = is an expression the tool evaluates and whose result it displays. The expression can hold numbers, cell references, functions, and the five arithmetic operators: +, -, *, / and ^ (power). Without the leading =, C3-C2 is text and displays as typed. Excel also accepts a leading + as a relic of Lotus 1-2-3 — +C3-C2 becomes =+C3-C2 — but that is an accident to recognise, not a form to use.
The order of operations
Both tools, and R, evaluate an expression in the same order: parentheses first, then ^, then * and / left to right, then + and - left to right. Nothing about reading left to right overrides this; 2 + 3 * 4 is 14, not 20.
Worked example — percent change, right and wrong
Maple & Birch's monthly totals sit in C2:C4: January 1610, February 2560, March 1970. The percent change from January to February is
so in D3 the formula is =(C3-C2)/C2, and the cell shows 0.590062… — format it as a percentage and it reads 59.0 %. Wrap it as =ROUND((C3-C2)/C2, 4) to store exactly 0.5901.
Now drop the parentheses: =C3-C2/C2. The division runs first — C2/C2 is 1 — and then the subtraction: 2560 − 1 = 2559. No error, no warning, a number that looks like it could be a dollar figure. That is the danger of a precedence mistake: the tool never complains, because the formula is perfectly legal; it is simply not the formula you meant. The defence is the one Lesson 3.4 makes a habit: check one row by hand. A 59 % rise is plausible; a percent change of 2559 is not.
The same arithmetic in R is the same expression without the = and with values in place of cells:
> (2560 - 1610) / 1610
[1] 0.5900621
> 2560 - 1610 / 1610
[1] 2559
R prints seven significant digits by default; round((2560 - 1610) / 1610, 4) prints [1] 0.5901. The precedence rule, the trap and the fix are identical. One symbol differs from Python: the power operator is ^ in Sheets, Excel and R (2^3 gives 8 in all three), while Python spells it ** and R treats ** as a tolerated alias. Write ^.
Type both forms, then compute the next change
The snippets are the correct Sheets formula, its rounded version, and the R line. The code block then does the same computation in plain Python for both consecutive pairs of months — January→February 0.5901 and February→March −0.2305, a 23 % fall — so you see the formula as a rule, not a one-off.
CRISP-DM: a percent-change column is data preparation → construct data.