This topic covers spreadsheets: formulae and functions, sorting and searching, and display and printing.
20.1 Create a data model
Formulae and functions
- a formula 公式 is a calculation the user writes, starting with
=, e.g.=B2*C2 - a function 函数 is a ready-made, named calculation used inside a formula, e.g.
=SUM(B2:B10) - operators:
+add,-subtract,*multiply,/divide,^indices (powers) - order of operations 运算顺序: brackets first, then indices, then × and ÷, then + and −.
=(B2+C2)/2averages two cells;=B2+C2/2does not
Relative and absolute cell references
| relative reference | absolute reference | |
|---|---|---|
| written | B2 |
$B$2 |
| when the formula is copied (replicated) | changes to match its new position | stays the same |
| use | the cells change from row to row | one fixed cell, e.g. a tax rate |
- a named cell or named range 命名区域 gives a cell a name, e.g.
VATorPrices, which is easier to read and acts as an absolute reference 绝对引用
Functions to know
| function | example | result |
|---|---|---|
SUM, AVERAGE, MAX, MIN |
=AVERAGE(B2:B9) |
the mean of B2 to B9 |
COUNT |
=COUNT(B2:B9) |
how many cells hold numbers |
COUNTA, COUNTIF |
=COUNTIF(C2:C9,"Pass") |
how many cells say Pass |
INT |
=INT(7.8) |
7 (rounds down to the nearest integer; =INT(-7.8) gives -8) |
ROUND |
=ROUND(3.456,2) |
3.46 |
IF |
=IF(B2>=50,"Pass","Fail") |
Pass or Fail |
VLOOKUP |
=VLOOKUP(A2,$F$2:$G$6,2,FALSE) |
looks down the first column of F2:G6 for A2 and returns the value from column 2 |
HLOOKUP |
as VLOOKUP, but looks across the first row | |
LOOKUP, XLOOKUP |
=XLOOKUP(A2,F2:F6,G2:G6) |
finds A2 in F2:F6, returns the matching value from G2:G6 |
- a lookup table can be in another file (an external data source)
- a nested function 嵌套函数 has one function inside another, e.g.
=IF(B2>=70,"Merit",IF(B2>=50,"Pass","Fail"))
Worked example. The VAT rate is in E1. D2 contains =C2*$E$1. Copied down to D3, it becomes =C3*$E$1: C2 changes to C3 (relative), but $E$1 stays fixed (absolute).
20.2 Manipulate data
Sorting
- sort 排序 by one column, ascending 升序 or descending 降序
- with multiple criteria 条件: sort by the first column; records that tie are then sorted by the second, e.g. by
Teamascending, then byPointsdescending - include all the columns of the records in the sort, so each row stays together
Searching and selecting (filters)
A filter 筛选器 shows only the rows that meet the criteria and hides the rest.
| operator | example |
|---|---|
=, <> |
Country = Kenya; Country <> Kenya |
>, <, >=, <= |
Distance > 5000 |
AND |
Age >= 20 AND Age <= 70 |
OR |
Sport = Tennis OR Sport = Golf |
NOT |
NOT Brazil |
| wildcards 通配符 | * any number of characters: B* starts with B; ? exactly one character: ?an matches Dan, Jan, Pan |
Worked example. A table of runners: find runners from Kenya or Ethiopia with a time under 130 minutes. Filter (Country = Kenya OR Country = Ethiopia) AND Time < 130. Then sort the results by Time ascending, so the fastest is first.
20.3 Present data
Display features
- show formulae or values: printing the formulae view 公式视图 shows how each result is calculated
- adjust row height and column width 列宽 so all data, labels and formulae are fully visible;
#####can mean a number is too wide for its column - wrap text 自动换行 in a cell so long labels show in full
- hide rows or columns (e.g. working-out cells) and display them again
Formatting
- enhancements: text colour, cell colour, bold, underline, italic, shading
- numbers: number of decimal places, currency symbols (dollar, euro, yuan, pound), percentages
- conditional formatting 条件格式 changes how a cell looks depending on its contents, e.g. values below 50 shown with red text, so they stand out and the format updates when the value changes
Page layout for printing
- orientation: portrait or landscape (wide sheets)
- fit to a set number of pages, e.g. one page wide
- set the print area 打印区域: only the cells to be printed
- show or hide gridlines 网格线 and row and column headings (A, B, C… and 1, 2, 3…); showing them helps the reader find cells when the formulae view is printed
Worked example. "Print the formulae, showing row and column headings, in landscape, on one page wide" → switch to formulae view; widen the columns so each formula shows in full; set landscape; fit to 1 page wide; turn on row and column headings.
Words in the questions
The exercise sheets for this topic also use these words:
- cell reference 单元格引用
- relative reference 相对引用
- replicate 复制