What is a range in Excel? A1:B5 explained
A range is a block of cells named by its first and last cell, like A1:B5. How to read one, select one, use one in a formula, and the mistakes people make.
A range in Excel is a block of cells. You write it as the first cell, a colon and the last cell. A1:B5 means every cell from A1 to B5. That is 2 columns and 5 rows, so 10 cells.
Most formulas work on a range, so this is the first thing to read in any formula. Here is a small sheet to practise on. It holds 6 months of power and water bills for one home.
| Row | A | B | C |
|---|---|---|---|
| 1 | Home bills | ||
| 2 | Month | Power | Water |
| 3 | Jan | 84 | 31 |
| 4 | Feb | 79 | 29 |
| 5 | Mar | 66 | 30 |
| 6 | Apr | 52 | 28 |
| 7 | May | 41 | 33 |
| 8 | Jun | 38 | 35 |
How to read a range
The first cell is the top-left corner. The last cell is the bottom-right corner. The colon means "and every cell between". So you can picture the block from the two corners.
- B3:B8 is one column: the 6 power bills.
- B3:C3 is one row: the 2 bills for January.
- B3:C8 is a block: all 12 bills.
- A2:B6 is 2 columns and 5 rows, like A1:B5 above. It holds 2 headings, 4 months and 4 power bills.
Excel can count the size for you. =ROWS(A2:B6) gives 5.
=COLUMNS(A2:B6) gives 2. And
=COUNTA(A2:B6) gives 10, because all 10 cells have something in
them.
The order of the corners does not matter. B8:B3 is the same range as B3:B8. Excel rewrites it as B3:B8 when you press Enter.
How to select a range
There are several ways, and all of them give the same result.
- Click B3 and drag to C8.
- Click B3, hold Shift, and click C8.
- Click B3, hold Shift, and press the arrow keys.
- Click B3 and press Ctrl+Shift+Down. This selects down to the last filled cell before an empty one.
- Type B3:C8 in the Name Box, left of the formula bar, and press Enter.
The keyboard ways are worth learning early. On a column of 2,000 rows, dragging with the mouse goes too far or stops too soon. Ctrl+Shift+Down stops at the last filled cell every time.
Look at the bottom of the window after you select. The status bar shows the Average, Count and Sum of the range. Select B3:C8 and it shows a Sum of 546 and a Count of 12. That is a quick check with no formula at all.
How to use a range in a formula
Put the range inside the brackets of a function. Each of these reads a range from the sheet.
=SUM(B3:B8) gives 360, the power bills for 6 months.
=AVERAGE(C3:C8) gives 31, the average water bill.
=MAX(B3:B8) gives 84, the highest power bill.
=COUNT(B3:C8) gives 12, the number of bills.
You do not have to type the range. Type =SUM(, then select B3:B8
with the mouse or the keyboard. Excel writes the range into the formula. Type the closing bracket
and press Enter.
Colon or comma?
A colon means "everything between". A comma means "and also". They look alike and give very different totals.
=SUM(B3:B5) gives 229. That is January, February and March.
=SUM(B3,B8) gives 122. That is January and June only, because
the comma names 2 single cells.
=SUM(B3:B5,B7) gives 270. A range and a single cell can go in
the same brackets.
Whole columns and rows
B:B means all of column B, from the top of the sheet to the bottom. And 2:2 means all of row 2. They are useful when new rows are added every week.
There is one rule. Do not put the formula inside the range it reads. Say you type
=SUM(B:B) in B9. The formula now adds itself. Excel shows a
circular reference warning and the total is wrong. Put the total in another column, or use
B3:B8.
Four mistakes people make with ranges
The heading is inside the range. =COUNTA(B1:B8)
gives 7, but there are only 6 bills. The word Power was counted too. SUM ignores text, so
=SUM(B1:B8) still gives 360. That is why this mistake is hard to
see. Start the range on the first number, not on the heading.
The range is one column too wide. You want the lowest power bill, and you type
=MIN(B3:C8). It gives 28. That is a water bill. The right answer
is =MIN(B3:B8), which gives 38. There is no error, so count the
columns before you trust the answer.
A new row is outside the range. You add July in row 9.
=SUM(B3:B8) still stops at row 8, so July is not in the total.
Change the range to B3:B9. Or press Ctrl+T to make the data a table. A table
grows when you add a row, and so do the formulas that read it.
The range moves when you copy the formula. Copy
=SUM(B3:B8) one cell to the right and it becomes
=SUM(C3:C8). Often that is what you want. When it is not, lock the
range with dollar signs. The
absolute and relative references
article shows when.
Questions people ask
What does the colon mean in an Excel formula?
It joins 2 cells into a range. B3:B8 means B3, B8 and every cell between them. Without the colon
you would have to name every cell, like =B3+B4+B5+B6+B7+B8.
Can a range be one cell?
Yes. B3:B3 is a range of 1 cell. You will rarely type it, but you will see it in formulas that were filled down.
How do I give a range a name?
Select B3:B8. Click the Name Box, type a name such as Power, and press Enter. Now
=SUM(Power) gives 360. A name does not move when you copy the
formula.
Why does COUNT give a different number from COUNTA?
COUNT counts numbers. COUNTA counts every cell that is not empty, text included. The COUNT, COUNTA and COUNTBLANK article has examples.
The Excel practice lessons start with ranges and SUM. Each lesson is a real sheet you type into, and each answer is checked when you press Enter.