Sub topic 6
Working with Ranges Such as B2:B10
Assume you can open a spreadsheet, enter values, and use basic arithmetic operators. A range is a group of cells identified by its first and last cell. In Google Sheets, a colon (:) separates the endpoints.
For example, B2:B10 means every cell in column B from row 2 through row 10. Both endpoint cells are included, so this range contains nine cells.
Using a range in a formula
Functions often accept ranges as their input. To add the values in cells B2 through B10, enter this formula:
=SUM(B2:B10)Other functions use the same range notation:
=AVERAGE(B2:B10)
=MIN(B2:B10)
=MAX(B2:B10)
=COUNT(B2:B10)COUNT counts numeric values. It does not count text labels. Empty cells are usually ignored by these functions.
You can also combine a range with other references. This formula calculates the percentage of a total in B2:B10:
=B2/SUM(B2:B10)The range remains fixed in this formula, but the reference B2 can change when you copy the formula to another row.
Reading different range shapes
A range can cover one column, one row, or a rectangle.
| Reference | Cells included |
|---|---|
| `B2:B10` | Column B, rows 2 through 10 |
| `B2:F2` | Row 2, columns B through F |
| `B2:F10` | The rectangle from B2 to F10 |
The rectangular range B2:F10 contains 45 cells: five columns multiplied by nine rows. Functions such as SUM can process the whole rectangle:
=SUM(B2:F10)You can also use separate ranges in one formula:
=SUM(B2:B10,D2:D10)This adds both column ranges while excluding column C.
Selecting and checking a range
You can type a range directly or select it with the mouse while editing a formula. When you select cells, Sheets inserts their reference automatically. Check the highlighted cells before pressing Enter. A selection that starts or ends on the wrong row can silently produce an incorrect result.
A range reference normally adjusts when its formula is copied. For example, copying =SUM(B2:B10) from one column to the next changes it to =SUM(C2:C10). To keep the range fixed, use absolute references:
=SUM($B$2:$B$10)The dollar signs lock both the column and the row. You can still copy this formula to another location without changing the range.
Visual model
Common mistakes
B2-B10is subtraction, not a range.B2:B10includes B2 and B10.B2:B9omits row 10.SUM(B2:B10)andSUM(B2,C2:D10)refer to different sets of cells.- A copied formula may shift a range unless its references use
$.
When a total looks wrong, click the formula and inspect the highlighted range. Confirm its first and last cells, then check whether the function is intended to count, add, average, or inspect blank and text cells.
Exercise
What formula adds all values in cells D3 through D12 and keeps using that exact range when copied elsewhere?
Show answer
=SUM($D$3:$D$12)