Sub topic 1
Quick refresher: formulas and cell references
The IF function builds on two basic skills: writing formulas and pointing at cells. This chapter reviews both, so the later chapters can focus on decisions rather than mechanics.
Prerequisites
This chapter assumes you can already do the following:
- Enter values and formulas in worksheet cells.
- Read basic cell references such as A1 and B2.
- Copy a formula down a column with the fill handle, the small square at the bottom-right corner of the selected cell.
If any of these is unfamiliar, practice them in a blank workbook first. The rest of the tutorial uses them constantly.
What a formula is
A formula is an instruction that Excel calculates and displays as a result. It always starts with an equals sign. Without the equals sign, Excel treats your entry as plain text.
=A2*B2This formula multiplies the value in A2 by the value in B2. If you change either cell, the result updates automatically. That live link is the main reason to use references instead of typing numbers directly into formulas.
A formula can contain four kinds of parts:
- Cell references, such as A2 or B2.
- Constants, such as 0.1 or "Yes".
- Operators, such as +, -, *, /, and &.
- Functions, such as SUM or IF, written as a name followed by arguments in parentheses.
Arguments are the inputs a function needs, separated by commas. In some regional settings Excel uses semicolons instead. This tutorial uses commas.
How cell references behave when copied
A reference names a cell by its column letter and row number. By default, references are relative. Excel remembers where the referenced cell sits in relation to the formula, not its fixed address. When you copy the formula, the references shift by the same distance.
Suppose C2 contains =A2*B2 and you fill it down:
| Cell | Formula after copying |
|---|---|
| C2 | `=A2*B2` |
| C3 | `=A3*B3` |
| C4 | `=A4*B4` |
Each row uses its own values, which is usually what you want. You write the formula once and the fill handle adapts it for every row.
Copying works in every direction. If you copy =A2*B2 one column to the right, it becomes =B2*C2. The references shift by one column.
Fixing a reference in place
Sometimes you want a reference to stay put when you copy. Placing a dollar sign before the column letter, the row number, or both locks that part. This is called an absolute reference.
=B2*$F$1Here B2 is relative, so it changes from row to row. $F$1 is absolute, so every copy still points at F1. Later chapters use this to compare many values against one threshold. For now, remember that a dollar sign means "do not move this part."
Operators you will reuse
Arithmetic operators work as in school mathematics, and Excel follows the usual order: parentheses first, then multiplication and division, then addition and subtraction.
=(B2+C2)*0.5Without the parentheses, Excel would multiply C2 by 0.5 first and then add B2. When a result looks wrong, check the order of operations first.
The ampersand & joins text together:
=A2&" scored "&B2Text inside a formula must be wrapped in double quotes, as " scored " is above. References and numbers never take quotes. This rule matters a lot once IF starts returning text.
Why this matters for IF
An IF formula is an ordinary formula whose result depends on a test. Everything in this chapter still applies to it:
- It starts with an equals sign.
- It refers to cells, usually relatively, and sometimes absolutely.
- It copies down a column and adjusts its references row by row.
- It needs double quotes around any text.
Check your understanding
Exercise
Cell D2 contains =B2+C2. You copy it to D5, and separately to E2. What formula does each destination cell contain, and why?
Show answer
D5 contains =B5+C5, because copying down three rows shifts each relative reference down three rows. E2 contains =C2+D2, because copying one column right shifts each relative reference one column right.