Basic Excel Manual
Basic Excel Manual
Basic Excel Manual
No additional restrictions — You may not apply legal terms or technological measures that legally
restrict others from doing anything the license permits.
Contents
List of Figures v
1 Introduction to Excel 1
1.1 What is a spreadsheet? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Excel 2010 main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Excel 2010 ribbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3.1 Contextual tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.2 Access dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.3 Contextual menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Workbooks, worksheets, rows, columns and cells . . . . . . . . . . . . . . . . . . . 7
1.4.1 Ranges of cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.2 Selecting cells, rows, columns, ranges and worksheets . . . . . . . . . . . . 8
1.5 Data edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.1 Insert data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.2 Delete data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.3 Remove cells, rows, columns and worksheets . . . . . . . . . . . . . . . . . 9
1.5.4 Insert cells, rows, columns and worksheets . . . . . . . . . . . . . . . . . . . 10
1.5.5 Cut, copy and paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.5.6 Autofill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.5.7 Undo and redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.6 Column and row sizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.7 File management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.7.1 Save a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.7.2 Open a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.7.3 Create a new workbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.7.4 Close a workbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8 Exporting and importing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8.1 Export to csv format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8.2 Import from csv format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.9 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
i
Contents
2 Formatting data 15
2.1 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.1 Formatting numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.2 Formatting dates and times . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.3 Formatting text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 Align cell contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.1 Horizontal alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2 Vertical alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3 Font properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4 Borders and background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5 Merge cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.6 Copy and paste format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.7 Conditional formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.8 Predefined styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
ii
Contents
3.7.4 PI function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.7.5 SIN, COS and TAN functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.6 ROUND function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.7 ABS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.8 Statistical functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.8.1 AVERAGE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.8.2 AVERAGEIF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.8.3 MEDIAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.8.4 MODE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.8.5 PERCENTILE.EXC function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.8.6 VAR.P function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.8.7 STDEV.P function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.8.8 SKEW function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.8.9 KURT function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.9 Auditing formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.9.1 Tracing formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.9.2 Error checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.9.3 Formula evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4 Plotting charts 39
4.1 Charts creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Types of charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.2.1 Column and bar charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2.2 Line charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2.3 Area charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.2.4 Pie charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.5 Doughnut charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2.6 XY Scatter charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2.7 Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.3 Chart design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.1 Changing the data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.2 Switching rows and columns . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.4 Chart layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.4.1 Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.4.2 Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.4.3 Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.4.4 Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.4.5 Data series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.4.6 Data labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.4.7 Chart styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5 Managing databases 49
5.1 Database creation in Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.2 Data validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
iii
Contents
iv
List of Figures
v
1
Introduction to Excel
There are a lot of programs for managing spreadsheets but the most famous are Excel, in
the Microsoft Office suite, and Calc, in the LibreOffice suite. Although Calc is opensource,
1
1 Introduction to Excel
with all the advantages associated therewith, Excel is by far the most widespread and mature
spreadsheet, thus this manual covers Excel 2010. However, some of the procedures and methods
explained in this manual are also valid for Calc.
File – Performs file management tasks (new file, open file, save file, print file, etc.). It also
contains general configuration options and help.
2
1.3 Excel 2010 ribbon
Home – Common tools (clipboard, fonts, alignment, numbers format, insert rows and
columns, etc.)
Insert – Insert objects in the sheet (tables, illustrations, charts, hyperlinks, text, equations,
etc.)
Page Layout – Configure the printing (page setup, scale, themes, etc. )
3
1 Introduction to Excel
Data – Working with databases (import data, connection with databases, sort and filter data,
data validation, etc.)
View – How Excel appears on screen (custom windows, grids lines, zoom, windows, etc.
Does not affect printing).
Chart layout Allows to insert and configure some parts of charts (title, axis, leyend, gridlines,
etc.)
4
1.3 Excel 2010 ribbon
Chart format Allows to change the aspect of charts (height, width, font, colors, background,
etc.)
Picture Allows to modify images (borders, rotation, crop, color, filters, special effects, etc.)
In addition to these tabs, users can create their own tabs and customise them with buttons as
their convenience.
There exists also a quick access toolbar just above the ribbon that can be customised with the
most common buttons (see figure 1.2.
Example. The figure 1.3 shows the font dialog with all the options related to fonts (font
family, font style, font size, etc.)
Example. The figure 1.4 shows the contextual menu showed right-clicking any cell.
5
1 Introduction to Excel
6
1.4 Workbooks, worksheets, rows, columns and cells
Each worksheet has a name and are arranged in tabs at the bottom. Columns and rows
have also names; columns are named with letters at the top of the column and rows with
numbers to the left of the row. This way each cell is identified by the name of the worksheet,
the name of the column and the name of the row where is located, and cells names follow the
pattern name-of-worksheet ! column-name row-name. However, to refer to any cell in the
active worksheet, the worksheet name may be omitted.
Example. The name of the selected cell in the figure 1.5 is Sheet1!C4.
The names of rows and columns can not be changed, but worksheet names can be changed
double-clicking it and typing the new name.
7
1 Introduction to Excel
8
1.5 Data edition
Example. This animation shows how to select the cell C3, after the row 3, after the column C,
after range B3:D7 and finally the whole worksheet.
Example. This animation shows how to enter the text ‘Excel’ in cell B2 and the number 2010
in cell C2, and after change the number of cell C2 to 2013.
Excel has a smart autocomplete feature that proposes completing the data that is typed with
some predictions.
To remove a whole row, right-click the header of the row and select the option Delete....
To remove a whole column, right-click the header of the column and select the option
Delete....
To remove a worksheet, right-click the tab with the name of the worksheet and select the
option Delete.... Warning: Removing worksheets can not be undone!
Example. This animation shows how to remove a cell, a row, a column and a worksheet.
9
1 Introduction to Excel
To insert a new row, right-click the header of the row above which you want to insert the
new row and select Insert.
To insert a new column, right-click the header of the column to the left of which you want to
insert the new column and select Insert.
To insert a new worksheet, right-click the tab with the name of the worksheet to the left of
which you want to insert the new worksheet and select Insert. In the dialog that appears select
‘Worksheet’.
Example. This animation shows how to insert a cell, a row, a column and a worksheet.
To cut or copy a cell, row, column or range, right-click it and select the option Cut or Copy
respectively, or press the keys Ctrl+x or Ctrl+c respectively. Both options copy the content of
the cell, row, column or range to the clipboard, but the difference between cut and copy is that
cut delete the content from the current cell, row, column or range, while copy no.
To paste the content of the clipboard in a new cell, row, column or range, select the cell or the
first cell of the row, column or range and click the button Paste or press the keys Ctrl+v.
Example. This animation shows how to copy and paste the content of a cell, a row, a column
and a range and a worksheet.
1.5.6 Autofill
An useful feature of Excel is the autofill of cells following a serie or pattern. In some cases, like
for example dates, it is enough to write the content of the first cell and then click the bottom-right
corner of the cell and drag the cursor over the column or row to get the cells filled with the
following dates.
For number or text, this actions replicates the content of the first cell in the others. To autofill
with a serie of numbers is necessary to enter the first two numbers of the serie in two consecutive
cells, then select both cells, click the bottom-left corner and drag the cursor over the column or
row to get the cells filled with the numbers following the serie.
10
1.6 Column and row sizing
Example. This animation shows how to replicate the content of cell A1 to range A2:A10, next
how to auto fill the range B1:B10 with the following dates to the date in cell B1, and finally how
to auto fill the range C1:C10 with the serie of even numbers.
In the quick access toolbar there are buttons Undo and Redo . The Undo button undoes
the last data edition action performed and the Redo button reverses the last undone action. If
you press the undo button several n times, it undoes the last n actions, and the same happens
with the redo button.
Example. This animation shows how to remove the content of cell B2, then change the
content of cell C2 two times, then undo that actions and finally redo the same actions.
In a similar way, to change the height of a row click the line between the row you want to
resize and the next row in the row header, and then drag the pointer mouse to increase or reduce
the row height. If you double-click this line the row height will auto resize to the height of the
highest cell content in the row.
Example. This animation shows how to resize the width of column C and the height of row
3 to fit the content of cell C3.
11
1 Introduction to Excel
Example. This animation shows how to export a worksheet with a students database to a csv
format file.
If you want more control in the importation process, click the From Tex button of the Get
External Data in the ribbon’s Data tab. In the dialog that appears select the csv format file and
12
1.9 Getting help
click the Import button. This brings another dialog where you can select if fields are delimited by
a special character or are a fixed number of characters, the delimiter character (Tab, Semicolon,
Comma, Space or other), the data format or every column (General, Text or Date). After that
click the Finish button and in the dialog that appears select the cell where to put the imported
data and click OK.
Example. This animation shows how to import the csv format file with the students database
of the previous example.
Example. The figure 1.7 shows the help search results for the word “cell”.
13
2
Formatting data
Content of cells can be formatted in many ways: changing the data type, the font family, the
alignment, the color, the border, etc. Most formatting options are grouped in the Format Cells
dialog. To show this dialog click the bottom right corner of the Font panel in the ribbon’s Home
tab.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to change the format of prices to currency type with 3
decimal places.
15
2 Formatting data
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to change the format of dates following the pattern
Month-Year, with the three first letters of months and the two last digits of years.
By default cells with content following the pattern hours:minutes:seconds are of type Time,
but there are a several ways of formatting times.
Text entered in a cell spreads to adjacent cells to the right if these cells have no content. To
confine text to a certain width in the cell, select the cell and click the button Wrap Text in the
Alignment section in the ribbon’s Home tab.
16
2.2 Align cell contents
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to align the average prices centered.
17
2 Formatting data
It’s also possible to change the font family, style, size and color from the Font panel in the
ribbon’s Home tab, and also with the contextual toolbar that appears right-clicking the cell.
18
2.4 Borders and background
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to change the font family of all table to Arial, size 10
pt.
And this animation also shows how to change the font style of average prices to bold and the
color of fruits names to blue.
It’s also possible to change the border of cells with the Border button of the Font panel
in the ribbon’s Home tab, and also with the contextual toolbar that appears right-clicking the
cell.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to put lines to some cell borders.
To format the background of cells select the background color and pattern style in the Fill
tab of the Format Cells dialog (see figure 2.7).
19
2 Formatting data
It’s also possible to change the background color of cells with the Background colour button
of the Font panel in the ribbon’s Home tab, and also with the contextual toolbar that appears
right-clicking the cell.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how set the background colour of some cells.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how merge the cells of the first row and center the title.
20
2.6 Copy and paste format
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to apply the same format of the fruit rows to a new
row for pineapples.
• Format all cells based on their value Applies a format style based on the value of the cell.
There are 4 types of styles:
– 2-Color Scale Applies a colour in a continuous scale ranging from one colour for the
minimum value or percentage to other colour for the maximum value or percentage.
Example. The table in this animation shows the price of fruits during several
months and the average price. The animation shows how to apply to prices a
colour background in a continuous scale from green (the minimum price) to red (the
maximum price).
– 3-Color Scale The same than 2-Color Scale but with a third intermediate colour in the
scale.
– Data bar Plots an horizontal bar in each cell with a length proportional to the value
of the cell.
Example. The table in this animation shows the price of fruits during several months
and the average price. The animation shows how to apply to prices a data bar format.
– Icon Sets Divide the distribution of selected cell values in several parts according to in-
tervals or percentiles, assign an different icon to each part, and plot the corresponding
icon in each cell.
Example. The table in this animation shows the price of fruits during several months
and the average price. The animation shows how to apply to prices an icon set
format. The icon set has three icons: red is applied to values under the 33 percentile,
yellow is applied to values between 33 and 67 percentiles, and green is applied to
values over 67 percentile.
21
2 Formatting data
• Format only cells that contain Applies a format to the cell if satisfies a logical condition.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to apply to prices higher than 2 a red colour.
• Format only top or bottom ranked values Applies a format to a number or percentage of
top or bottom values.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to apply to the three top higher prices a red colour.
• Format only values that are above or below average Applies a format to cells with values
above or below the average of selected cells.
Example. The table in this animation shows the price of fruits during several months and the
average price. The animation shows how to apply a red colour to prices above the average and a
green colour to prices below the average.
To apply a predefined table style click Format as Table button and select the desired style.
It’s also possible to define new table styles. For that click Format as Table button and select
New Table Style option. In the dialog that appears just give a name to the new style, define
the table format (font, borders and fill), press OK, and the new table style will appear in the
table styles menu.
22
3
Calculus with formulas
Spreadsheets are used mainly for doing calculations and one of the most powerful features of
spreadsheets are calculation formulas. In this section we will see how to use them.
Example Assuming that cells A1, B1 and C1 contain the values 6, 3 and 2 respectively, the
next table shows some formulas and their respective results.
Formula Result
A1+B1-C1 7
A1+B1*C1 12
(A1+B1)*C1 18
A1/B1-C1 0
23
3 Calculus with formulas
A1/(B1-C1) 6
A1+B1ˆC1 15
(A1+B1)ˆC1 81
Example. This animation shows how to enter the formula 4+2 in cell A1, the formula 4-2 in
cell B1, the formula 4*2 in cell C1, the formula 4/2 in cell D1, the formula 4ˆ2 in cell E1 and the
formula ((4+1)*2)ˆ3 in cell F1.
Example. This animation shows how to use the formula =A1+B1 to add up the content of
cells A1 and B1 in cell C1.
References that are formed by the name of the cell or range are known as relative references,
because referenced cells change when you copy a cell with a formula and paste in another cell.
In general, when you copy a formula n columns to the right and m rows down, the referenced
cells in the formulas will be updated by the cells n columns to the right and m rows down, an
the same if you copy the cell to the left or top.
Example. This animation shows how to copy the formula =A1+B1 in cell C1, with relative
references to A1 and B1, to the cell E4, that is 2 columns to the right and 3 rows down. Observe
how the formula in cell E4 is updated to =C4+D4.
A common way of copying the formula of a cell to adjacent cells is clicking the bottom-right
corner of the cell and dragging the cursor to the desired range of cells.
Example. This animation shows how to generate the first ten numbers of the Fibonacci
sequence. Cells A1 and B1 contains the two first numbers of the serie and cell C1 the formula
=A1+B1 that add the two first numbers up and gives the third number of the serie. For generating
the rest of the serie it is enough to copy the formula of cell C1 to the range D1:J1. Observe how
references in formulas of these cells are updated.
Although relative references are very helpful in many cases, sometimes we need the references
in a formula to remain fixed when copied elsewhere.
In that case we need to use absolute references, that are like relative references but use the dollar
symbol $ to fix either the row, the column or both on any cell reference, by preceding the column
or row with the dollar sign.
24
3.3 Basic functions
Example. This animation shows how to calculate the IVA of a list of prices. Cells A2 to A5
contains the prices and cell F1 contains the IVA percentage. For calculating the IVA of first price
we use the formula A2*F$4/100 where we fix the row of cell F4 because we wan it remain fixed
when copying the formula down. Observe how the reference to cell F4 doesn’t change when
copying the formula down.
Example. This animation shows how to calculate the multiplication table using absolute
references.
You can also set the name of a cell or range in the name box of the input bar (see figure 3.1).
After that you can use that cell o range name in any formula. Observe that references with
names are always absolutes.
Example. This animation shows how to calculate the IVA of a list of prices using a cell name
for the cell that contains the IVA percentage.
• Select it from the buttons of the Functions Library panel in the Formulas tab of the
ribbon.
25
3 Calculus with formulas
• Click the Insert Function button from the input bar. This will show you a dialog
where you can type some key words for looking the desired function an select it (see
figure 3.2). This dialog also shows help about the function and its syntax.
Example This animation shows how to calculate the sum of the subject grades for every
student in a course.
The expression with the condition can be a number, a cell reference, a logical expression
starting with a logical operator (=,>,<,>=,<=,<>) between quotation marks, or a pattern text with
wildcards like the question mark ? (that matches any character) or the asterisk * (that matches
any character string) between quotation marks.
26
3.3 Basic functions
Example This animation shows how to calculate the sum of the grades greater than or equal
to 5 for every student in a course.
Example This animation shows how to calculate the number of subjects grades for every
student in a course.
The expression with the condition can be a number, a cell reference, a logical expression
starting with a logical operator (=,>,<,>=,<=,<>) between quotation marks, or a pattern text with
wildcards like the question mark ? (that matches any character) or the asterisk * (that matches
any character string) between quotation marks.
Example This animation shows how to calculate the number of passed subjects (grade greater
than or equal to 5).
Example This animation shows how to calculate the minimum grade for every student in a
course.
Example This animation shows how to calculate the maximum grade for every student in a
course.
27
3 Calculus with formulas
3.4.1 If function
The most important logical function is the IF functions, that checks whether a condi-
tion is met and returns a value if is true or another value if is false. Its syntax is
IF(condition,true_value,false_value), where condition is the logical condition to test,
true_value is the returned value if the condition is true, and false_value is the returned value if the
condition is false.
In the logical condition expression you use logical operators like equal =, not equal <>, greater
>, less, <, greater or equal >=, less or equal <=, etc. In the true or false value you can put numbers,
text with double quotes dates, cell references or other formulas.
Example This animation shows how to use the IF function to decide if students pass or don’t
pass a course depending on whether the average grade is greater than or equal to 5.
The following table, known as a truth table, shows the returned value by the function according
to the corresponding values of its arguments.
A B AND(A,B)
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE
Example. This animation shows how to use the AND function to see which students have
passed all the subjects of a course with a grade greater than or equal to 5. Observe that conditions
that involve blank cells are always false.
28
3.5 Date and time functions
3.4.3 Or function
The OR function will return TRUE if one or more of its arguments are true and FALSE if all its
arguments are false. Its syntax is OR(contidion1,condition2,...), where condition1, condition2,
etc are logical conditions.
The following truth table shows the returned value by the function according to the corre-
sponding values of its arguments.
A B OR(A,B)
TRUE TRUE TRUE
TRUE FALSE TRUE
FALSE TRUE TRUE
FALSE FALSE FALSE
Example. This animation shows how to use the OR function to see which students have not
passed some subjects of a course with a grade greater than or equal to 5.
The following truth table shows the returned value by the function according to the corre-
sponding values of its argument.
A NOT(A)
TRUE FALSE
FALSE TRUE
Excel convert automatically any entry with with a date or time formats into a serial number.
For dates, this serial number represents the number of days that have elapsed since the beginning
of the twentieth century (so that January 1, 1900, is serial number 1; January 2, 1900, is serial
number 2; and so on). For times, this serial number is a fraction that represents the number of
29
3 Calculus with formulas
hours, minutes, and seconds that have elapsed since midnight (so that 00:00:00 is serial number
0.00000000, 12:00:00 p.m. (noon) is serial number 0.50000000; 11:00:00 p.m. is 0.95833333; and so
on).
Example. This animation shows how to calculate the time elapsed between two dates and
two times.
Example. This animation shows how to calculate current age of a person using the TODAY
function.
Example. This animation shows how to calculate the date given the year, moth and day.
The WEEKDAY function returns the day of the week of a date. Its’ syntax is
WEEKDAY(date,type), where date is the serial number of the date and type has three pos-
sible values (1: 1 equals Sunday and 7 Saturday, 2: 1 equals Monday and 7 equals Sunday; 3: 0
equals Monday and 6 equals Sunday).
The MONTH function returns the number of the month of a date. Its’ syntax is MONTH(date),
where date is the serial number of the date.
30
3.6 Database functions
The YEAR function returns the year of a date. Its’ syntax is YEAR(date), where date is the
serial number of the date.
Example. This animation shows how to calculate the day, week day, month and year of a
date.
Example. This animation shows how to calculate current age of a person using the TODAY
function.
Example. This animation shows how to calculate the date given the year, moth and day.
The MINUTE function returns the minute of a time. Its’ syntax is MINUTE(time), where time is
the serial number of the time.
The SECOND function returns the hour of a time. Its’ syntax is SECOND(time), where time is
the serial number of the time.
Example. This animation shows how to calculate the hour, minute and second of a time.
31
3 Calculus with formulas
Example This animation shows how to calculate the square root of grades in a course.
Example This animation shows how to calculate the exponential of grades in a course.
The LOG function calculates the logarithm of a number in a given base. Its syntax is
LOG(number,[base]) where number is a number or a cell reference for which you want the
logarithm and base is the base of the logarithm (if this argument is omitted, then base 10 is
taken).
Example This animation shows how to calculate the natural logarithm and the base 10
logarithm of grades in a course.
3.7.4 PI function
The PI function returns the constant value of π. Its syntax is PI() without arguments.
32
3.8 Statistical functions
The COS function calculates the cosine of an angle in radians. Its syntax is COS(angle) where
angle is a number or a cell reference with the radians for which you want the cosine.
The TAN function calculates the tangent of an angle in radians. Its syntax is TAN(angle) where
angle is a number or a cell reference with the radians for which you want the tangent.
If angles are in degrees, they have to be converted to radians before with the function
RADIANS(degrees) where degrees is a number or a cell reference with the degrees that you want
to convert to radians.
Example This animation shows how to calculate the sine, cosine and tangent of several angles.
Observe that the sine of an angle o 180 degrees is not exactly 0 because the RADIANS function
does not calculate the radians corresponding to a number of degrees with total accuracy.
33
3 Calculus with formulas
Example This animation shows how to calculate the average grade for every student in a
course. Observe that the average grade is well calculated even when there are blank cells in the
range.
The expression with the condition can be a number, a cell reference, a logical expression
starting with a logical operator (=,>,<,>=,<=,<>) between quotation marks, or a pattern text with
wildcards like the question mark ? (that matches any character) or the asterisk * (that matches
any character string) between quotation marks.
Example This animation shows how to calculate the average grade of students with a grade
greater than or equal to 5 for every subject in a course.
Example This animation shows how to calculate the median grade for every student in a
course. Observe that the median grade is well calculated even when there are blank cells in the
range.
Example This animation shows how to calculate the mode grade for every student in a course.
Observe that the mode grade is not calculated when there are not repetitions of values.
34
3.8 Statistical functions
Example This animation shows how to calculate the quartiles (percentiles 25, 50 and 75) of
grades for every student in a course. Observe that if we use a cell reference for the k argument,
putting a relative frequency in that cell (0.25 for first quartile, 0.5 for second quartile and 0.75 for
third quartile) we get the correspondent percentile.
Example This animation shows how to calculate the variance of grades for every student in
a course. Observe that the variance is well calculated even when there are blank cells in the
range.
Example This animation shows how to calculate the standard deviation of grades for every
student in a course. Observe that you can also calculate the standard deviation applying the
square root to the variance.
3
n xi − x̄
g1 =
(n − 1)(n − 2) ∑ s
,
35
3 Calculus with formulas
Example This animation shows how to calculate the skewness coefficient of grades for every
subject in a course.
4
n ( n + 1) 3( n − 1)2
xi − x̄
g1 =
(n − 1)(n − 2)(n − 3) ∑ s
−
(n − 2)(n − 3)
,
Example This animation shows how to calculate the kurtosis coefficient of grades for every
subject in a course.
• #NAME? error. Occurs when Excel does not recognize text in a formula. Usually happens
when you misspell the name of a function.
• #VALUE! error. Occurs when a formula has the wrong type of argument. Usually
happens when you try to performs mathematical operations with cells that does not
contain numbers.
• #DIV/0! error. Occurs when a formula tries to divide a number by 0 or an empty cell.
• #REF! error. Occurs when a formula refers to a cell that is not valid. Usually happens
when a formula refers to a deleted cell.
• #NUM! error. Occurs when a formula or function contains invalid numeric values. For
example when trying to calculate the square root of a negative number.
In complex formulas it could be difficult to detect the error. Fortunately, Excel provide some
tools for tracking down errors.
36
3.9 Auditing formulas
Another possibility is to trace precedents or dependents references. If you select a cell with a
formula and click the Trace Precedents button of the Formula Auditing panel on the ribbon’s
Formulas tab, Excel will show arrows to the cells that affect the value of the selected cell. And
if click the Trace Dependents button of the Formula Auditing panel on the ribbon’s Formulas
tab, Excel will show arrows to the cells that are affected by selected cell. To remove the arrow
simply click the Remove Arrows button of the Formula Auditing panel on the ribbon’s Formulas
tab.
Example This animation shows how to trace a formula to calculate the price of product
without discount, with discount but without taxes and with discount and taxes.
Example This animation shows how to check an error in a formula to calculate the price of
product without discount, with discount but without taxes and with discount and taxes.
Example This animation shows how to check an error in a formula to calculate the price of
product without discount, with discount but without taxes and with discount and taxes.
37
4
Plotting charts
A picture is worth a thousand words. That’s why data is usually presented in a graphical form, and
for that reason spreadsheets provide different types of charts. This section presents the main
chart types and how to plot them in Excel 2010.
1. Select the range that contains the data to plot. Data should be arranged in series (vertically
or horizontally) following the next rules:
• Do not leave empty rows or columns within the data range or between data labels
and data.
• Only one row and/or one column should be used for data labels.
2. Select the type of chart from the Charts panel on the ribbon’s Insert tab.
39
4 Plotting charts
3. Set the chart design (data serie to plot, order, etc.). You can use the ribbon’s Design tab.
4. Apply a layout (title, axis, legend, grids, data labels, etc.). You can use the ribbon’s Layout
tab.
5. Apply a style format (text, line and background colours). You can use the ribbon’s Format
tab.
Charts are embedded in the same worksheet that data by default but it’s possible to put it on
a separate worksheet. For that right-clicking the chart background and select Move chart. In the
dialog that appears select New sheet give a name to the worksheet a click OK.
Charts are linked to data from which they come. This means that any change in the data will
be immediately reflected in any derived chart.
Each chart type has a purpose and requires data to be arranged in a particular way. So
choosing the right chart is probably the most important decision. The main chart types and their
purpose are presented below.
40
4.2 Types of charts
Example. The figure 4.1 shows a column chart showing the evolution of fruit prices. Looking
at the chart you can quickly realize that strawberries are the most expensive (longest bars) and
apples the cheapest (shortest bars) along the time. Also that the prices of strawberries and
bananas are decreasing, the prices of oranges are increasing and the prices of apples are almost
stables.
Excel offers a lot of shapes for the bars (rectangles, cylinders, cones, pyramids) in 2-D an 3-D,
and allows to stack bars. Also is possible to add error bars to the bars.
Example. This animation shows how to create a column chart for the apple prices evolution
(one data serie).
And this animation shows how to create a column chart for the fruit prices evolution (several
data series).
41
4 Plotting charts
bars instead of bars, and joining them with straight line segments. Line charts are suitable for
displaying and comparing trends over a period of time.
Example. The figure 4.2 shows a line chart showing the evolution of fruit prices. Looking
at the chart you can quickly realize that strawberries are the most expensive (higher markers)
and apples the cheapest (lowest markers) along the time. Also that the prices of strawberries
and bananas are decreasing (lines with negative slope), the prices of oranges are increasing (line
with positive slope) and the prices of apples first decrease an then increases.
Excel offers different subtypes of line charts, with or without data points in 2-D and 3-D, and
also allows to stack lines.
Example. This animation shows how to create a line chart for the fruit prices evolution.
Looking at the chart you can quickly realize which prices are increasing and which prices are
decreasing.
Example. The figure 4.3 shows an area chart showing the evolution of accumulated fruit
prices. Looking at the chart you can quickly realize that strawberries are the most expensive (the
largest area) and that accumulated prices are decreasing.
Excel allows to plot areas in 2-D or 3-D and also to stack areas.
Example. This animation shows how to create an area chart for the evolution of accumulated
fruit prices.
42
4.2 Types of charts
Pie charts are suitable for displaying the parts of a whole. Unlike the other charts presented
so far, which can graph multiple data series, pie charts can graph just one data series.
Example. The figure 4.4 shows a pie chart comparing fruit prices. Looking at the chart you
can quickly realize that strawberries are the most expensive (biggest sector) and apples are the
cheapest (smallest sector).
Again Excel has several subtypes that allows you to emphasize a part of the whole in 2-D or
3-D.
Example. This animation shows how to create a pie chart comparing the fruit prices of
January.
43
4 Plotting charts
Example. The 4.5 shows a doughnut chart comparing fruit prices in January and April. The
inner doughnut correspond to prices of January and the outer to prices of April. Looking at the
chart you can quickly realize that, although the price of apples were smaller in April than in
January, it was relatively higher in April than in January, compared to the rest of fruit prices.
Example. This animation shows how to create a doughnut chart comparing the fruit prices
in January and April.
Example. The figure 4.6 shows an XY Scatter chart relating banana and strawberry prices.
Looking at the chart you can quickly realize that there is a positive correlation (when banana
price increase, strawberry price increase too).
Example. This animation shows how to create an XY Scatter chart relating banana and
strawberry prices.
4.2.7 Histograms
A histogram is a graphical representation of the distribution of numerical data. It’s similar
to a column chart but data values are grouped into interval classes and each bar represents a
44
4.3 Chart design
Figure 4.6: Example of XY scatter chart relating banana and strawberry prices.
class. Histograms charts are suitable for displaying frequency of data values in one numeric
variable.
Example. This animation shows how to create an histogram of the grades in a course.
Observe that is possible to plot in the same chart data in separated ranges.
Example. This animation shows how to add the orange prices data serie to a column chart
for the apple prices evolution.
45
4 Plotting charts
Example. This animation shows how to switch from row series to column series in a column
chart for the fruit prices evolution.
To format any element of a chart right-click the element (bar, line, title, axis, legend, etc) and
select the corresponding option at the bottom of the contextual menu. This will open a dialog
where you can perform the desired changes for the selected element.
4.4.1 Titles
You can add a title to the chart selecting the chart and clicking the Chart Title button of the
Labels panel on the ribbon’s Layout tab. That will show a drop down menu that let you choose
between a centered overlay title (inside the chart area) or an above chart (outside the chart
area).
Example. This animation shows how to add a title to a column chart for the fruits prices
evolution and how to change the font colour.
4.4.2 Axes
You can add a title to the horizontal or vertical axes selecting the chart and clicking the Axis
Title button of the Labels panel on the ribbon’s Layout tab.
46
4.4 Chart layout
Example. This animation shows how to add a title to the horizontal and vertical axes of a
column chart for the fruits prices evolution. The vertical axis title is rotated 90 degrees.
One of the most important parts of a chart are axis scales. Excel allows you to configure the
axis scale setting the minimum and maximum showed in the axis, the major and minor units,
the format of thick marks (small lines intersecting axis that indicate categories, scale units or
chart data series) and their labels, or even the scale type (linear by default or logarithmic). To
configure an axis right-click any label of the axis (not the axis title) and select the Format Axis
option from the contextual menu. This will open a dialog with a lot of axis options. Change
whatever you want and click Close.
Example. This animation shows how to change the scales of the horizontal and vertical axes
of a column chart for the apple prices evolution. Observe that in the original chart the minimum
value of the vertical axis scale is 1.26, what magnify the differences between month prices. To
avoid that the minimum value of vertical scale is set to 0, and the major unit is set to 0.1. Also
the format of tick marks labels is changed to currency with two decimal places. On the other
hand, the tick marks labels of the horizontal axis are rotated 30 degrees counterclockwise.
4.4.3 Grid
A grid is composed of horizontal or vertical lines (usually equally spaced) over the axes. Grids
are helpful to mark out more precisely the position of markers, bars, lines or other chart elements
in the axis scales.
Excel allows to plot both horizontal and vertical grid lines for major and minor tick marks.
To plot vertical grid lines right-click any label of the horizontal axis and select the Add Major
Gridlines option for drawing lines over the major tick marks, or Add Minor Gridlines for
drawing lines over the minor tick marks. To plot horizontal grid lines do the same but right-
clicking any label of the vertical axis. Once the grid line is plotted you can change its format
right-clicking any label of the axis and selecting the Format Major Gridlines or Format Minor
Gridlines option.
Example. This animation shows how add vertical major grid lines and horizontal minor grid
lines. Also show how to change the line style of minor grid lines.
4.4.4 Legends
A legend is key that identifies patterns, colors, or symbols associated with the markers of a chart
data series. The legend shows the data series name corresponding to each data marker.
Excel usually plots a legend to the right of the chart but it’s possible to change the legend to
other position or to remove it. To plot the lenged of a chart click the Legend button of the Labels
panel on the ribbon’s Layout tab. This shows a drop down menu with different positions for the
legend. After plotting the legend, if you want to format it right-click it and select Format Legend.
This will open a dialog where you can choose the legend position, the frame and background
47
4 Plotting charts
colours and many other legend aspects. Finally if you want to remove a legend, just select it and
press the Supr key.
Example. This animation shows how add a legend for the fruits to the right of a column
chart with the fruit prices evolution. Also it shows how to plot a frame around the legend and
how to move the legend to the top.
Example. This animation shows how to change the background colour of orange bars in a
column chart for the fruits prices evolution. It also shows how to add a glow effect over the
highest bar.
Example. This animation shows how add a legend for the fruits to the right of a column
chart with the fruit prices evolution. Also it shows how to plot a frame around the legend and
how to move the legend to the top.
Also, the Shape styles panel on the ribbon’s Format tab have predefined styles for the
background area and frame of the chart.
Example. This animation shows how to apply some chart and shape styles to a column chart
with the fruit prices evolution.
48
5
Managing databases
A database is an organised collection of data. Usually databases are composed of records that
contains information about the same object (person, company, product, etc), and records are
composed of fields that contains every piece of information (name, address, phone number,
price, etc.).
Example The next table show a students database with fields First name, Last name, Address,
City, Birth date, Average grade and Passed credits.
First name Last name Address City Birth date Average grade Passed credits
María Sánchez García c. Estrella, 9 Madrid 23/10/1994 5,8 78
Carlos Pérez López c. Bravo Murillo, 34 3o -D Madrid 16/08/1993 7,9 123
Luis González Roca c. Antonio López, 67 1o -A Madrid 07/07/1995 8,2 45
Camen Aguirre Jordán c. Espada, 12 4o -C Sevilla 06/03/1994 4,2 28
Luisa Martín Garrido c. Cervantes, 14 Albacete 22/01/1994 6,7 54
Alberto Pintado Marín c. Arroyo, 27 2o -C Sevilla 10/03/1995 4,1 12
Marina Gómez Gómez c. Velázquez 28 4o -A Madrid 12/04/1994 7,7 62
Javier Yagüe Pinzón c. Rosales, 76 8o -B Madrid 18/12/1993 6,1 82
Lucas Guerrero Monzón c. Isaac Peral, 30 Bajo Albacete 12/01/1995 5,4 32
49
5 Managing databases
To create a data list first enter the name of the fields in the first row of the table, each in one
column. This first row with the field names is the headers row. Field names must be unique and
there musn’t be blank cells in the headers row. After creating the fields enter first record data in
the appropriate columns of the row immediately below the one containing the field names. To
Excel recognise this table as a data list, click the Format as Table button on the ribbon’s Home
tab and then click a thumbnail of one of the table styles in the drop-down gallery.
After that you can enter the remaining records, one by row. After entering the data of a field
press the Tab key to go to the next field of the same record, or to the first field of the next record
if you are in the last field of a record.
Example. This animation shows how create a data list of students with the fields First name,
Last name, Address, City, Birth date, Average grade and Passed credits.
After creating a data list Excel will give a name to it, but is advisable to give it a descriptive
name (see the Naming cells and ranges section).
• Whole number allows only integers numbers between a specified minimum and a maximum
or greater o less than a specified number.
• Decimal allows decimal numbers between a specified minimum and maximum or greater
or less than a specified number.
• Date allows dates between two specified dates or before or after a specified date.
• Time allows times between two specified times or before of after a specified time.
After selecting the validating criteria, enter the correspondent parameters (minimum or
maximum numbers, dates, times or range with the entries of the list). You can also define an
input message in the Input Message tab and an error message in the Error Alert tab that will
be shown if an invalid entry is entered in the field.
Example. This animation shows how create a validation rule for the Average grade field in a
data list of students.
50
5.3 Importing databases
Example This animation shows how to import the IBEX 35 serie from Yahoo finances.
After installing the add in a new tab labelled Quandl appears in the ribbon. To import a data
serie from Qandl, first search the data serie clicking the Search button on the ribbon’s Quandl
tab, enter some key words for the search and click the Show Results button, select the data serie
desired from the search results, click the Insert Selected Codes buttom and click the Close
button. This will insert the Quandl code of the data serie (if you know the Quandl code of the
data serie you can avoid the search and enter it directly in a cell). Finally, select the cell with the
Quandl code and click the Download button on the ribbon’s Quandl tab. This will download the
data serie and put it in a range below the cell that contais the Quandl code.
Example This animation shows how to import the IBEX 35 serie from Quandl.
51
5 Managing databases
Largest or Sort Largest to Smallest in a number field. - Sort Oldest to Newest or Sort Newest to
Oldest in a date field.
Other option to sort a data list on a field is to select a cell of the field column an click the
Sort A to Z button of the Sort & Filter panel on the ribbon’s Data tab, to sort ascending,
or the Sort Z to A button to sort descending.
Excel then will reorder all the records in the data list according to the ascending or descending
order selected.
Example. This animation shows how to sort a students database. First ascending on the Birth
date field, next descending on the Average degree field, and finally ascending on the Last name
field.
If you need to sort a data list on more than one field, select a cell of the data list and click
the Sort button of the Sort & Filter panel on the ribbon’s Data tab. Then, in the dialog that
appears, select the first sorting field column and the sorting order (ascending or descending),
next the second sorting field column an the sorting order, and so on.
Example. This animation shows how to sort a students database on the fields City ascending
and Average grade descending.
You can also sort a range of cells in general indicating the name of the columns instead of the
field names.
Example This animation shows how to sum the passed credits of students in a students
database. It also shows how to average the average grade.
Excel also allows subtotaling a field by categories of other field. This procedure only works
with data lists formatted like tables, so if a data list have been formatted like a table first it has to
be converted to a range selecting any cell of the table and clicking the Convert to Range button
52
5.5 Summarizing data
of the Tool panel on the ribbon’s Table Tools - Design tab. After that, you have to sort the
data list by the field with the categories to summarize (see the section 5.4). Finally, to subtotaling
a data list click the Subtotal button of the Outline panel on the ribbons’ Data tab. This will
display a dialog where you have to select the field with the categories in the At each change
in drop-down menu, the function to apply (sum, count, average, etc.) in the Use function
drop-down menu, check the fields to with apply the subtotaling function in the Add subtotal
to list, and click OK.
Example This animation shows how to subtotaling the passed credits of students in a students
database by the city where they live.
To create a pivot table click on any cell of a data list and then click the PivotTable button on
the ribbon’s Insert tab. This display a dialog where you can select the range for the pivot table
(by default Excel select the whole data list) and choose between placing the pivot table in a new
workbook (default) or in the same workbook (in this case you have to indicate in which cell).
After click OK, a pane appears on the right side of the pane:
• Report Filter for the fields that enable you to page through the data summaries shown in
the actual pivot table by filtering out sets of data — they act as the filters for the report.
So, for example, if you designate the Year Field from a data list as a Report Filter, you can
display data summaries in the pivot table for individual years or for all years represented
in the data list.
• Column Labels for the fields that determine the arrangement of data shown in the columns
of the pivot table.
• Row Labels for the fields that determine the arrangement of data shown in the rows of
the pivot table.
• Values for the fields whose data are presented and summarized in the body cells of the
pivot table. By default Excel will use the SUM function to summarize values. To use
another function click the field and select the Value Field Settings option in the menu
that appears. In the dialog that appears just select the function that you want to use for
summarizing and click OK.
Example This animation shows how to create a pivot table for a students database. The pivot
table shows and summarizes the passed credits by degrees on rows and by cities on columns.
This animation shows how to arrange the previous pivot table to show the passed credits
summarized first by city and then by degree and vice versa, both on rows.
53
5 Managing databases
This animation shows how to arrange the previous pivot table to show, in addition to the
passed credits, the average grade of students. The passed credits are summarized using the SUM
function while the average grade is summarized using the AVERAGE function.
This animation shows how to filter the previous pivot table to show only the values of course
year 2014 and not to show the physics degree.
To change the format of a pivot table you can use the Layout panel on ribbon’s PivotTable
Tools - Design tab. This panel has four buttons:
• Subtotals Allows to show subtotals at top of groups, at bottom of groups or not to show
subtotals.
• Grand Totals Allows to show grand totals for rows, for columns, for both rows and
columns, or not to show grand totals.
• Report Layout Allows to show the groups in compact form (all the grouping fields in the
same column), in outline form (every grouping field in a different column) or in tabular
form (like the outline form but adding extra rows for the subtotals).
• Blank rows Allow to insert or not a blank row after each group.
It’s also possible to apply a predefined style to a pivot table just selecting the desired style
from the PivotTable Styles panel on ribbon’s PivotTable Tools - Design tab.
Example This animation shows how to format and how to apply a style to the previous pivot
table.
Example This animation shows how to create a pivot chart from a pivot table for a students
database.
Of course, you can change the pivot chart layout as any other chart (see section 4.4).
54
5.6 Data filtering
Example This animation shows how to filter the students of Sevilla and Albacete in a students
database.
To perform more sophisticated filters you can use the other filter options of the AutoFiller
button. These filter options depend on the type of entries in the field:
• If the column only contains dates, the menu contains a Date Filters option with a
submenu that allows you to filter dates equals to, before o after a given date; dates
between two given dates; dates of today, yesterday and tomorrow; dates of this week, last
week and next week; dates of this month, last month and next month; dates of this quarter,
last quarter and next quarter; dates of this year, last year and next year; and dates in a
specific period (quarter or month).
• If the column contains only numbers or a mixture of dates with numbers, the menu
contains a Number Filters option with a submenu that allows you to filter numbers
equal or not equal to a given number; numbers greater than, greater than or equal to, less
than, less than or equal to a given number; numbers between two given numbers; top 10
numbers; number above the average and numbers below the average.
• If the column only text or a mixture of text, date and numbers, the menu contains a Text
Filters option with a submenu that allows you to filter text equal or not equal to a given
text; text that begins or end with a given text; and text that contains or does not contains a
given text.
If the filter selected requires some parameter (date, number or text), a dialog appears where
you must enter that data and click OK.
55
5 Managing databases
Example This animation shows how to filter the students born before 1/1/1995, with an
average grade greater than or equal to 5, and whose name begins with M, in a students
database.
To perform a filter with calculated criteria first you have to specify the criteria somewhere
in the worksheet that contains the data list. The criteria must have a cell header and a logical
formula in the cell just below. In the logical formula you can use functions and references to the
cells, but it’s important to note that all references must be to cells in the first row of the data
list. After that, to apply the filter you need to select a cell in the data list and click the Advanced
button of the Sort & Filter panel on the ribbons’s Data tab. This shows a dialog where
you have to enter the range of the data list (usually Excel auto recognise it), the range of the filter
criteria and click OK. Excel will apply the logical formula to every row of the data list and show
only the records where the formula returns TRUE.
Example This animation shows how to filter the students with an average grade greater than
or equal to 5, and a number of passed credits over the average, in a students database, using a
calculated criteria. Observe how is used the data list name and the field name to reference the
column of passed credits in the average calculation.
56
5.7 Database functions
Example This animation shows how to sum the passed credits of students from Madrid born
in 1994 or after with an average grade greater or equal to 6, in a students database.
Example This animation shows how to count the students with an average grade greater
than or equal to 6 whose name begins with L, in a students database.
57
5 Managing databases
Example This animation shows how to calculate the minimum and the maximum average
grade of students from Madrid born before 1995, in a students database.
Example This animation shows how to average the average grades of students from Madrid
born in 1994 or after with an average grade greater or equal to 6, in a students database.
Example This animation shows how to calculate the standard deviation of average grades of
students from Madrid born in Madrid before 1995, in a students database.
If no record satisfy the criteria, the function returns a VALUE! error, and if more than one
records satisfy the criteria the functions return a NUM! error.
58
5.7 Database functions
Example This animation shows how to find the student with the highest grade in a student
database.
Example This animation shows how to look the phone up of a student in a students
database.
The HLOOKUP function works like the VLOOKUP function but it performs a search by columns.
Its syntax is HLOOKUP (value, table, row-index, [approx-match]), where value is the value
you want to look up, table is the range of the table or list in which to perform the search, row-index
is the the row number (starting with 1 for the top-most row of table range) that contains the
return value, and approx-match is an optional logical argument that specifies whether to find an
approximate match (TRUE by default) or an exact match (FALSE).
59