Intermediate Microsoft Excel

San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Review: Why Use Excel?
Simplifies data manipulation
- Statistical analysis and mathematical calculations
- Table formatting
- Alternative scenario (“what-if”) analysis
- Graphing
- Database management
Common uses of Excel
- Budget reports
- Trend charts
- Summary tables
Review: Overview of the Excel Interface
NOTE: The Fill Handle is the small black square in the bottom-right corner of a
highlighted cell.
05/06/2004
1 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Review: Excel Basics
This workshop assumes basic knowledge of the following: Selecting and dragging cells,
entering data, copying and moving cells, constructing simple formulas, basic formatting.
Review: Formulas
Quick review: Order of Operations
- Exponentiation first
- Multiplication and division
- Addition and subtraction
- Operations performed left-to-right
- NOTE: Order of operations can be overridden using parenthesis.
o 2 * 3 + 5 = ____
o and 2 * (3 + 5) = ____
Formulas in Excel
- NOTE: All formulas in Excel must begin with an equal sign (=).
- Formulas can utilize numeric values or cell references.
- Formulas use the following notation for mathematical operations.
o ^ carrot is used for exponentiation
o * asterisk is used for multiplication
o / slash is used for division
o + plus sign is used for addition
o - minus sign is used for subtraction (and for negative numbers)
- In the simplest case, formulas in Excel can be similar to those of a calculator, but
Excel is far more powerful than any calculator!
o Cell-reference example:
§ In cell B1, enter the digit 2.
§ In cell B2, enter the digit 3.
§ In cell B3, enter the formula that would multiply cell B1 by cell B2
§ The formula in B3 will look like this: =B1*B2
There is more than one way to get this result:
1. Using the keyboard, type the formula =B1*B2.
2. Using the keyboard and mouse, type the = sign, use the mouse to
select cell B1, type the + sign, use
the mouse to select cell B2.
3. Arrow keys can also be used to
select cells.
§ Click Enter.
The value that appears in cell B3
should be 6.
§ Now, to edit the calculation, we can
do so by changing the values in the
referenced cells.
§ Change the value in cell B1 to 5.
§ Click Enter.
The formula in B3 is recalculated – cell B3 should display 15.
05/06/2004
2 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Formulas can utilize cells from more than one worksheet.
- An additional advantage of Excel workbooks is that calculations can include
cells from more than one worksheet.
o Multiple worksheets (budget example):
§ On the “Transportation” tab, in cell B6 add the four types of
transportation costs.
§ Now click on the “Budgetunformatted” tab.
§ The total expense for monthly
transportation must be included
in the budget table… to do this,
select cell B9 in the budget table.
§ Type an “=”.
§ Click on the “Transportation”
tab, and select cell B6.
§ Click Enter.
§ The contents of cell B9 are
actively linked to the
Transportation worksheet. Any
changes we make to the value in
cell B6 on the Transportation
worksheet will be reflected in
the budget table.
Dragging and filling formulas
- To repeat a formula in more than one cell, copy / paste functions can be used,
as well as drag / fill options, just as they are used for text or values.
o Fill formula example (annual expenses from monthly data):
§ In cell C8 enter the formula that
will calculate annual rent expenses
(=B8*12).
§ Click the Calculate now (green
check mark) button.
§ Using the fill handle, fill the
formula down through cell C13 –
the contents of those cells should
now be annual expenses (as shown
to the right).
- NOTE: When a formula is copied from one cell
to another in Excel, the formula’s cell
references also shift.
05/06/2004
3 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Functions
What are functions?
- Excel has built-in procedures that can facilitate complex calculations.
- There are roughly 200 worksheet functions in Excel that cover a range of
purposes: financial, statistical, logical, engineering, trigonometric, etc…
- Summation is perhaps the most commonly used function.
o SUM function (budget example):
§ In cell C7 type =sum(C8:C13)
§ Click Enter.
Total should be $26,400.
§ As always, there are other ways to get the same result.
§ In cell C3 hit the summation, or sigma (Σ), button on the toolbar and
drag the cursor over cells C4 through C5.
§ Click Enter.
Sum should be $40,720.
§ Returning to the “Transportation” tab, delete the contents of cell B6
(where we previously added up the transportation costs).
§ In cell B6, hit the summation button (Σ).
Note that the components (cells B2:B5 are highlighted).
§ Click Enter.
The sum should be 550 (the same result we obtained previously, with
less effort).
Functions accept arguments, or inputs, in an ordered list enclosed by parenthesis. In the
case of the previous SUM function, the argument list consists of a range of cells, such as
(C8:C13). Some functions require several arguments. The PMT function, which can be used
to calculate monthly loan payments, requires five arguments in all: interest rate, number
of payment periods, present value, future value, and type. Other functions, such as NOW
– which returns the date and time - take no arguments (you must still supply the
parenthesis).
IMPORTANT NOTE!
When using formulas and functions in Excel, it is important to know that it is the
formula or function that is stored in a cell, not the computed value.
The simplest way to enter a function, especially an unfamiliar one, is to use the Function
Button, which looks
like a function symbol
fx adjacent to the
formula bar. This can
also be done by
clicking on the down
arrow next to the
sigma (Σ), or
summation, button on
05/06/2004
4 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
the standard toolbar. Alternatively, a function can be inserted by choosing Insert ->
Function from the menu bar. Any of these insert function commands will bring up a list
of available functions, with details as to
what each function does. The function
menu also contains explanations for
each item in the argument list.
Another function example:
- Finding maximums and
minimums without sorting…
o MIN function (city
populations example):
§ In cell B24 type
“Smallest City
Population.”
§ In cell B25 insert
the function
=MIN(B3:B21).
§ This can be
accomplished by
choosing Insert ->
Function from the
menu bar, by
using the drop-down list next to the summation sign on the toolbar, or
by clicking the function button next to the formula bar.
§ In the Insert Function menu, under the “select a category” list, choose
“All.”
§ Scroll through “select a function” (functions are listed alphabetically)
and select
MIN.
§ Click OK.
§ A new menu
will appear.
Make sure the
range in the
box labeled
“Number 1”
is B3:B24. If it
is not, click on
the function
arguments
button (small
light square
with a red
05/06/2004
5 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
§
§
§
arrow), select the appropriate range, then click on the return to menu
button (darker button with a red arrow).
Click OK.
The value in cell B25 should be -4,389.
Is that the smallest population in the list?
Now in cell B26 type “Largest City Population” and in cell B27 use an
Excel function to find the maximum population from the cities list.
Other useful functions in Excel include calculating averages, counting the number of
occurrences of a particular item, reporting the current date, and hundreds of others.
Action
Function
Example
report today’s date
=TODAY()
type =today() in cell A2
calculate an average from
available values (skips blank
cells)
=AVERAGE(range)
insert the function
=AVERAGE(D4: G4) in cell H4
fill the formula down through
H23
rounding
rounding
rounding
rounding
insert the function
=ROUNDUP(number, # decimal places)
=ROUNDUP(I4,0) in cell H4
=ROUNDDOWN(number,# decimal places) and fill the formula down
=ROUND(number,# decimal places)
through I23
options:
up
down
to nearest number
combine strings of
information
=CONCATENATE(item1,item2,item3,etc…)
Items can be cell references, values, or
strings of text. Strings of text must be set
in quotation marks.
insert the function
=CONCATENATE(A4," ",B4)
into cell C4 and fill down
through cell C23
Absolute and Relative Cell Addressing
Relative Cell Addressing
- When formulas are copied, the cell references in the formulas are adjusted
relative to the original formula (recall the budget worksheet). For example, if a
cell is copied over one column, the cell references in the formula will also all be
shifted over by one column. The same holds true for copying up and down
rows.
o Relative cell addressing (city population characteristics example 1):
§ In cell B2, SUM “total population.”
§ Drag SUM formula from cell B22 through cell D22.
§ Note that the formula in cell D22 is “=SUM(D3:D21)”
The cell references changed when the formula was copied.
o Relative cell addressing (example 2): The same method can be used to
calculate the percent of each city’s population that is female.
§ In cell E3, divide the female population of Carlsbad by the total
population of Carlsbad (=C3/B3).
§ Click Enter.
The value should be 51% (or 0.51, we can change the format later).
§ Drag the formula down through cell E22.
§ Note that in cell E22 the formula is “=C22/B22”.
05/06/2004
6 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
USEFUL TRICK!
When working with formulas in Excel, calculations can be complicated, and it may help to
see the cells in a formula. By selecting a cell and clicking once on the formula bar, Excel
will highlight all cells in the formula with a color-coded outline. To return to standard
mode, tap the Escape key.
Absolute Cell Addressing
- In some cases, it is useful to base calculations on a particular cell, or set of cells.
Absolute cell addressing prevents cell references in the formula from changing
when the formula is copied. Absolute addressing uses the $ symbol to “lock” a
cell reference in place.
o Absolute cell addressing (ancestry example):
§ In cell C3, divide the population with Arab Ancestry by the total
population in the San Diego
region.
§ Drag the formula through
cell C31.
§ Is there a problem?
§ Select cell C4 and click once
on the formula bar. Which
cells are highlighted? Hit
ESC.
§ To fix this problem, we need
to use an absolute cell
reference when referring to
the total population.
§ Edit the formula in cell C3 to
read:
=B3/$B$31
§ Drag the revised formula
through cell C31.
§ What is different?
- Using the $ in the cell reference ($B$31)
tells Excel to lock the reference in place.
No matter where the formula is copied,
it will always refer to cell B31.
- NOTE: Absolute cell referencing can also be used to lock a row reference but
not a column reference, or to lock a column reference but not a row. For
example the cell reference $B31 would ensure that no matter where the cell
reference is copied, it will always refer to column B, but may refer to a different
row. Alternatively B$31 would ensure that no matter where the cell reference is
copied, it will always refer to row 31, but may not refer to column B.
05/06/2004
7 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Conditional Formatting
Conditional formatting is an important analytical tool for working with tables of data in
Excel.
- Conditional formatting allows the user to highlight, bold, italicize, underline,
strikethrough, and/or outline cells that meet user-defined criteria.
o Conditional formatting
(ancestry example):
§ Select the population
values on the Ancestry
worksheet (range
B3:B30).
§ Choose Format ->
Conditional
Formatting from the
menu bar.
§ Use the pull down
menus to choose “Cell
Value Is” and “greater
than” for the first two
boxes under
“Condition 1.”
Type 50000 in the blank box to the right.
Click the “Format…” button.
In the Format Cells popup menu that appears, click on the “Patterns”
tab and choose a cell shading color of yellow.
§ Click OK.
§ Click OK again.
All cells with values greater than 50,000 should be highlighted in
yellow.
Up to three conditional formatting criteria can be added to any cell in the
worksheet.
o Conditional formatting with multiple conditions (ancestry example 2):
§ Select the population values on the Ancestry worksheet (range B3:B30).
§ Choose Format -> Conditional Formatting from the menu bar.
§
§
§
-
05/06/2004
8 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
In the
popup
menu
that
appears,
click the
“Add
>>”
button.
§ Use the
pull
down menus to choose “Cell Value Is” and “less than or equal to” for
the first two boxes under “Condition 2.” Then type 6038 in the blank
box to the right.
§ Click the
“Format…” button
associated with
Condition 2.
§ In the Format Cells
popup menu that
appears, click on the
“Font” tab. Select
Bold from the Font
Style menu.
§ Click OK.
§ Click OK again.
Now all cells with
values greater than
50,000 should be
highlighted in
yellow AND all cells
with values less than 6,038 should appear in bold text.
NOTE: “Double” (overlapping) conditional formatting does not work. (For
example, if the condition 1 was cell value is greater than 50,000 and condition 2
was cell value greater than 100,000, the formatting for >50,000 would show up,
but formatting set for the >100,000 criteria would not.)
To remove conditional formatting, open the conditional formatting menu by
choosing Format -> Conditional Formatting from the menu bar. Click the
“Delete” button in the popup menu, and click the check boxes for the
conditional formats being removed.
§
-
-
Importing Data
Data from the web and from text files can be imported into Excel. This saves data entry
time and energy!
05/06/2004
9 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
-
-
-
05/06/2004
When data from the Web is formatted in a tabular format, sometimes a simple
copy and paste is all that’s needed to get the data into Excel.
o Copy and paste (Data Warehouse example 1):
§ Select all of the values in the web-based data table.
§ Copy the data (using CTRL + C or Edit -> Copy).
§ Click on a cell in the blank Excel worksheet, and paste the data (using
CTRL + V or Edit -> Paste).
Data from text files can be imported by using the Text Import Wizard.
o Text Import Wizard (Comma separated text example):
§ Choose File -> Open from the menu bar and open the file
ImportFile.txt.
§ The Text
Import Wizard
popup window
opens. This
data is comma
separated, so
choose
“Delimited”
under
“Original data
type.”
o NOTE: “Delimited”
signifies that there is
a character (a comma, a tab, a space, etc…) that separates individual
chunks of data. Each of those characters will represent a break where the
data will be parsed into cells. “Fixed Width” signifies that the data are in
a tabular format where parsing will occur at certain break-points along
the data series. These break points can be adjusted by adding, moving,
and/or deleting the break lines in step 2.
§ Click “Next.”
§ In step 2, make sure that the check box next to “comma” is checked.
Uncheck all other boxes, if necessary.
§ In step 3 you are given the option to change the data type for each
column being imported. In this case, the step is unnecessary.
§ Click “Finish.”
Text formatted data from the web can also be easily imported…
o Copy and paste (Data Warehouse example 2):
§ Select all of web-based data (this time in comma-separated format).
§ Copy the data (using CTRL + C or Edit -> Copy).
§ Click on a cell in the blank Excel worksheet, and paste the data (using
CTRL + V or Edit -> Paste).
§ Note that the data has remained in long strings, separated by commas.
We will resolve this problem in the next section.
10 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Text to Columns
Sometimes data in Excel needs to be parsed from long strings of information to cell-sized
chunks of data.
- To do this, we use the Text to Columns option.
o Text to colums (Data Warehouse example 2, continued):
§ From the menu bar, choose Data -> Text to Columns. The Text to
Columns
Wizard popup
window opens.
§ In step 1,
choose
“Delimited.”
§ In step 2, make
sure that the
check box next
to “comma” is
checked.
Uncheck all
other boxes, if
necessary.
§ In step 3 you are
given the option to
change the data type
for each column
being imported. In
this case, the step is
unnecessary.
§ Click “Finish.”
Exporting Data
Tables and charts from Excel can be pasted into MS Word documents. Start with both the
Excel document and Word document open. Simply select the Excel information to be
copied, copy it, and position your
cursor in the Word document where
the table or chart will be pasted.
From the Edit menu choose Edit ->
Paste Special. Choose “Microsoft
Excel Worksheet Object” from the
Paste Special popup menu that
appears. Click OK.
Now, by double-clicking on the
Worksheet Object in the Word file,
you can edit data, change
formatting, and otherwise revise the table or chart that you have pasted into Word.
05/06/2004
11 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
NOTE: Edits made to the Worksheet Object in the Word file will NOT be reflected in the
original Excel file.
Tricks and Shortcuts
Procedures in Excel are similar to other MS Office programs. Most keyboard shortcuts
from other Office programs have the same functions in Excel, and (as with all things)
there is usually more than one way to perform each task.
Some useful keyboard shortcuts for moving through and selecting in a worksheet are:
Action
Shortcut
Move by one cell at a time
ARROW keys change the selected cell by one cell at a time in the direction
of the arrow
Extend the selection by one
cell
SHIFT + ARROW key
Move to the beginning of a
row
HOME
Move to the end of a block
of data
END then ARROW
Select to the end of a block
of data
END then SHIFT + ARROW
Extend selection to the
beginning of a row
SHIFT + HOME
Move to the left-most, topmost cell
CTRL + HOME
Extend selection to the leftmost, top-most cell
SHIFT + CTRL + HOME
Move to the right-most,
bottom-most cell containing
data
CTRL + END
Extend selection to the right- SHIFT + CTRL + END
most, bottom-most cell
containing data
Select the entire worksheet
CTRL + A
Move down one screen
PAGE DOWN
Move up one screen
PAGE UP
Some useful keyboard shortcuts for formatting are:
Action
Shortcut
Make cell contents bold
CTRL + B
Make cell contents italic
CTRL + I
Make cell contents underline
CTRL + U
05/06/2004
12 of 13
San Diego Association of Governments Technical Workshops
Intermediate Microsoft Excel
Some useful keyboard shortcuts for copying, pasting, and filling data are:
Action
Shortcut
Cut
CTRL + X
Copy
CTRL + C
Paste
CTRL + V
Fill down
CTRL + D
Fill right
CTRL + R
Find
CTRL + F
Find and replace
CTRL + H
Using the Help Menu
As you continue working in Microsoft Excel , you will run into new challenges that
require skills we have not covered in this workshop. When that happens, one of the most
useful problem-solving resources is the Help menu. This offers a searchable database of
Excel topics.
05/06/2004
13 of 13