1 / 6 · Intro
Cells, rows, columns and ranges
An Excel worksheet has 1,048,576 rows and 16,384 columns. Every one of those cells has a short name such as B7.
Jump to the 10 practice questionsYou will learn
- Find the active cell and what it really holds
1Explain
A grid with names
Put a price in B2 and a quantity in C2. These boxes are cells, and their letters and numbers help you find them again. A spreadsheet is a grid of boxes called cells. The columns run down the page and are labelled with letters: A, B, C and so on. The rows run across and are numbered 1, 2, 3 from the top. A cell is named by its column letter followed by its row number, so the cell in column B and row 7 is B7. That name is called the cell address or cell reference.
The thick outline is the selected cell, B2. The shaded block is the range C2:D4: two columns by three rows, six cells.
2Problem
Column C, row 5
Hint
Letter first, then number.
Solution
Answer: C5
Column letter first, then row number.
3Problem
Row 7
Which cell is in row 7?
Hint
The number is the row.
Solution
Answer: C7
The number in an address is the row. 7C is not a valid address.
4Explore
After column Z
After column Z the letters double up: AA, AB, AC and on to AZ, then BA, and so on. In Excel the last column is XFD, which is column number 16,384, and the last row is 1,048,576, according to Microsoft's list of specifications and limits. Google Sheets sets its limit differently: Google's help page on file sizes allows up to 20 million cells in one spreadsheet, shared by all its sheets. You will rarely come near either limit, but the numbers explain why a spreadsheet can hold a whole year of daily sales without trouble.
Column letters count in base 26 with A as 1: each letter is worth 26 times the one to its right.
const col = "AA";
let n = 0;
for (const ch of col) n = n * 26 + (ch.charCodeAt(0) - 64);
console.log(n);275Problem
After Z
Which column comes right after column Z?
Hint
The letters double up.
Solution
Answer: AA
After Z the names use two letters, starting again from AA.
6Problem
Column XFD
Excel's last column is XFD. What column number is it?
Hint
Pick XFD in the box above.
Solution
Answer: 16384
A worksheet has 16,384 columns, and XFD is the last of them.
7Problem
Rows in Excel
How many rows does an Excel worksheet have?
Hint
Just over a million.
Solution
Answer: 1048576
Microsoft lists 1,048,576 rows by 16,384 columns.
8Explain
Selecting and the name box
Click a cell and it becomes the active cell, drawn with a thick border. Two places show which cell is active. The name box at the left end of the formula bar shows the address, and the column letter and row number in the headers are highlighted. The formula bar itself shows what is really stored in the cell. That difference matters later: a cell can show 12 while it stores a formula that calculates 12. Arrow keys move the active cell one step at a time, Tab moves right and Enter moves down.
9Problem
What is really stored
Where can you see what is really stored in the active cell?
Hint
The bar above the grid.
Solution
Answer: The formula bar
The cell shows a result; the formula bar shows the stored content, such as a formula.
10Explain
Ranges
A rectangle of cells is a range, written as two addresses joined by a colon: the top-left corner and the bottom-right corner. A1:A10 is ten cells in column A. B2:D3 is three columns by two rows, which makes six cells. To count the cells in a range, multiply the number of columns by the number of rows. Microsoft calls the colon the range operator, and you will type it inside nearly every formula you write, as in =SUM(B2:B13) for twelve monthly figures.
11Problem
Cells in A1:C4
How many cells are in the range A1:C4?
Hint
3 columns × 4 rows.
Solution
Answer: 12
Columns A to C are 3 columns, rows 1 to 4 are 4 rows: 3 × 4 = 12.
12Problem
Cells in B2:D3
How many cells are in B2:D3?
Hint
3 columns × 2 rows.
Solution
Answer: 6
B, C, D are 3 columns and rows 2 and 3 are 2 rows: 3 × 2 = 6.
13Problem
Outside B2:D5
Which cell is NOT inside the range B2:D5?
Hint
Columns B to D only.
Solution
Answer: E3
The range covers columns B to D only, so column E is outside.
14Problem
Ten cells in column A
Hint
Top-left, colon, bottom-right.
Solution
Answer: A1:A10
Top-left corner, colon, bottom-right corner.
15Explain
VisiCalc, 1979
The first spreadsheet program for personal computers was VisiCalc, written by Dan Bricklin and Bob Frankston and released for the Apple II in 1979. It already used letters for columns and numbers for rows. Lotus 1-2-3 followed in 1983, and Excel arrived on the Macintosh in 1985. Google Sheets came later, as a spreadsheet that runs in a web browser. The A1 naming has survived every one of these programs, which is why a reference you learn today works in all of them.
16Explore
Practice in the grid
Before selecting a block for a calculation, describe what belongs inside it in words. Does the block contain only entries, or does it also include a heading or a total? Then identify the corners and check the highlighted rectangle against that description. A correctly written range can still be the wrong range for the task. Counting its cells checks the rectangle’s size, but checking its contents tells you whether you selected the intended data.
Drag to turn. Scroll or pinch to zoom.
17Practice
Count the cells of a range
colNum is given. Finish cellCount(range): read the two corners, then return the number of columns times the number of rows.
12
6
10
6function colNum(letters) {
let n = 0;
for (const ch of letters) n = n * 26 + (ch.charCodeAt(0) - 64);
return n;
}
function cellCount(range) {
const [a, b] = range.split(":");
const ca = colNum(a.match(/[A-Z]+/)[0]), cb = colNum(b.match(/[A-Z]+/)[0]);
const ra = Number(a.match(/\d+/)[0]), rb = Number(b.match(/\d+/)[0]);
return 0;
}
console.log(cellCount("A1:C4"));
console.log(cellCount("B2:D3"));
console.log(cellCount("A1:A10"));
console.log(cellCount("Z1:AB2"));
Hint
Both corners are inside the range, so add 1 to each difference.
A solution
function colNum(letters) {
let n = 0;
for (const ch of letters) n = n * 26 + (ch.charCodeAt(0) - 64);
return n;
}
function cellCount(range) {
const [a, b] = range.split(":");
const ca = colNum(a.match(/[A-Z]+/)[0]), cb = colNum(b.match(/[A-Z]+/)[0]);
const ra = Number(a.match(/\d+/)[0]), rb = Number(b.match(/\d+/)[0]);
return (cb - ca + 1) * (rb - ra + 1);
}
console.log(cellCount("A1:C4"));
console.log(cellCount("B2:D3"));
console.log(cellCount("A1:A10"));
console.log(cellCount("Z1:AB2"));18
Summary
- A cell address is column letter then row number, such as B7.
- A range is two corners joined by a colon, such as B2:D3.
- Cells in a range = columns × rows.
- Excel: 1,048,576 rows × 16,384 columns. Google Sheets: up to 20 million cells per spreadsheet.