Excel Tutorial For Windows
Excel Tutorial For Windows
Excel Tutorial For Windows
3 Creating a Chart
Chart Types
Modifying a Chart
Locating a Chart
Working with Excel Functions
Intro to Functions
Function Help
Basic Summarizing Functions
SUM, AVERAGE, PRODUCT
COUNT, COUNTA, COUNTBLANK
COUNTIF, SUMIF, AVERAGEIF
COUNTIFS, SUMIFS, AVERAGEIFS
2 SUMPRODUCT
Two Essential Functions
IF
VLOOKUP
Math Functions
INT, ROUND
ABS, SQRT, SUMSQ
LN, EXP
RAND, RANDBETWEEN
Text Functions
Concatenating
Parsing with Text to Columns
Parsing with Text Functions
11 Flash Fill
Date, Time Functions
Dates and Times in Excel
TODAY, NOW
YEAR, MONTH, DAY, WEEKDAY
DATE, DATEVALUE
Statistical Functions
MIN, MAX
MEDIAN, QUARTILE, PERCENTILE
STDEV, VAR
CORREL, COVAR
New Statistical Functions
Financial Functions
7,8 PMT
NPV, XNPV
IRR
Reference Functions
INDEX
MATCH
OFFSET
INDIRECT
Data Analysis Tools
Quick Analysis
4 Tables
Pivot Tables
Data Tables
4
Goal Seek
Solver
Power BI
Intro to Power BI
Data Model
Power Pivot
Power View
Power Map
Power Query
Importing External Data
Intro to Importing Data
Importing Data from a Text File
Importing Data from a Database
Importing Data from the Web
Good Spreadsheet Practices
Documenting Your Work
5 Conditional Formatting
Professional Touches
Data Validation
Protecting Worksheet, Workbooks
Developer Ribbon
Using Form Controls
Recording a Macro
category, in this
pic to its worksheet in
eet has a hyperlink
Changes in Excel
If Excel 2007 or a later version is your first exposure to Excel, you will love it.
However, if you are used to Excel 2003 or an earlier version, you will have some
unlearning and relearning to do. Several big changes were made in Excel 2007,
along with many smaller changes. The changes made in Excel 2010 and later
versions were much less dramatic, so moving from Excel 2007 to 2010 or a later
version is quite easy. The text boxes below indicate the primary changes in each
of the post-2003 versions of Excel.
1. The Office button was replaced by the File menu for accessing the
backstage view, and the layout of this backstage view changed slightly.
2. You can now customize ribbons, although there are quite a few restrictions
on what you are allowed to change.
4. Two new buttons were added to the Developer ribbon for quick access to
"regular" or COM add-ins.
5. Sparklines were added to provide quick "mini" charts.
6. Slicers were added for pivot tables, These show filters more visually.
2. The Insert ribbon has several new items in the Charts group. The new
chart types include histograms, box and whisker plots, tree maps, sunburst
charts, waterfall charts, and combo charts.
3. The Data ribbon contains a new Forecast Sheet item for forecasting time
series automatically, using exponential smoothing.
4. The Data ribbon contains a new Get & Transform group for querying
external data sources. These actually implement Power Query, Microsoft's
querying add-in, part of its Power BI (Business Intelligence) suite of tools.
2. The Insert ribbon has several new items in the Charts group. The new
chart types include histograms, box and whisker plots, tree maps, sunburst
charts, waterfall charts, and combo charts.
3. The Data ribbon contains a new Forecast Sheet item for forecasting time
series automatically, using exponential smoothing.
4. The Data ribbon contains a new Get & Transform group for querying
external data sources. These actually implement Power Query, Microsoft's
querying add-in, part of its Power BI (Business Intelligence) suite of tools.
5. The other Power BI add-ins, Power Pivot, Power View, and Power Map
are all part of Excel 2016, available as COM add-ins, with slightly different
interfaces than before. However, these are not available in all versions of
Excel. If you plan to use these tools, you should check carefully before you
purchase Office (or Office 365).
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Starting in Excel 2007, Microsoft completely reorganized the user interface of the Office
products. Instead of the old menus and toolbars, there are now tabs and ribbons. Each
tab (Home, Insert, Page Layout, etc.) has an associated ribbon that is similar to the old
toolbars. (See to the right for the ribbons in Excel 2016. Those in Excel 2007, 2010, and
2013 are similar.) For example, if you click the Formulas tab, you get a ribbon with
buttons that are useful for working with formulas. Each ribbon has several groups of
buttons. For example, the Formulas ribbon has one group called Defined Names for
manipulating range names. There is only one way to learn these ribbons: by practicing
and experimenting. Eventually, you will appreciate that the ribbons are more logically
organized than the old menus.
If you are using Excel 2007, you can’t customize the new ribbons; they are built in and
fixed. (Well, that isn't quite true. You can use the RibbonX technology, not covered
here, to customize them.) However, you can customize the ribbons fairly easily in post-
2007 versions. This is explained in another topic of this tutorial.
With the old menus gone, what about the keyboard shortcuts many of you like to use?
Most of them still work. For example, you can still press Ctrl+s to save a file or Ctrl+p to
print.
If you are a mouse person, hover the mouse above any tab and move the scroll wheel.
This will cycle through all of the tabs. Also, if you prefer keyboarding to mousing, here's
something you will like. Press the Alt key. In the ribbon area, you will see a shortcut key
for each tab. For example, M is for Formulas. Press any of these shortcut keys to see the
corresponding ribbon, and each one of its buttons will have a shortcut key. Press the
one you want, which is equivalent to clicking the button. To make these shortcut keys
disappear, press the Alt key again.
Try it! Use the Alt method to open the Name Manager on the Formulas ribbon.
A few of the new tabs are not visible until you select an appropriate object. For
example, when you select a chart, two Chart Tools tabs (Design, Format) become
visible. (There were three Chart Tools tabs in previous versions.) Or when you select an
Excel table, a Table Tools Design tab becomes visible.
If you need more space, you can right-click any ribbon and select Collapse the Ribbon.
You can then restore it in the same way. Also, note that depending on the width of the
Excel window, some ribbons might not show fully, but everything is still available.
In general, Excel 2007 and later versions are more intelligent about context. In the
context of what you are doing, if something is relevant, it is likely to appear. Otherwise,
it remains hidden.
List of Topics sheet
Home Ribbon
Insert Ribbon
Formulas Ribbon
Data Ribbon
Review Ribbon
View Ribbon
Developer Ribbon
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Starting in Excel 2010, Microsoft made a welcome change that allows you to
customize the built-in ribbons. You might recall that in Excel 2003 and
earlier versions, you could change the menu structure to your liking fairly
easily. Then came the new ribbons in Excel 2007, which were pretty much
fixed (unless you were willing to use the rather obscure RibbonX technology
with XML code). Evidently, Microsoft received enough complaints about the
fixed ribbons that it returned to customizable ribbons in Excel 2010.
Fortunately, customizing is quite easy.
To do so, right-click any ribbon and select Customize the Ribbon. This opens
the dialog box to the right. (This dialog box is also available from the Excel
Options group.) From here, the options are straightforward. You can create
a new tab, create a new group under a given tab, and rename either of
these. Then you can move buttons from the left pane to the right. As an
example, the screenshot to the right illustrates how you could create a new
Tables group under the Data tab and then populate it with PivotTable and
Table buttons. This would allow you to get pivot tables or tables from either
the Insert ribbon or the Data ribbon.
Note that the Reset button lets you restore all of the ribbons or a particular
ribbon to its original state.
Note: The changes described above are the easy "point and click" changes.
If you are more ambitious, you can use RibbonX technology to make more
extensive changes by writing XML code. Do a Web search for RibbonX if
you're interested.
Customize Ribbon dialog box
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
File Menu
Just as users were getting used to the Office button in Office 2007 for getting into
"backstage view," Microsoft replaced it with the File menu in Office 2010, and this has
remained in later versions. The File menu in Excel 2016 leads to slightly different
options than in earlier versions, as shown to the right. In each of these versions of
Excel, the File menu (or Office button) takes you to the backstage view where you can
perform file operations, and it is where you can open the Excel Options dialog box.
There are too many options to explain here, so it is best to experiment. You shouldn't
have any trouble finding what you want. For example, to see exactly which version of
Excel you have, click the Account option.
To leave backstage view, simply click the back arrow at the top left.
of Topics sheet
QAT
Quick Access Toolbar (QAT)
Starting in Excel 2007, there is a Quick Acess Toolbar (QAT) at the top left of the QAT Customize list
Excel window. You can put your favorite buttons on this toolbar so that they are
always visible and available. The QAT comes with a few favorite buttons, but you
can add more. The one shown to the right contains several favorite buttons in
addition to the default buttons.
Click the dropdown arrow to the right of your QAT. You will see the list to the
right of the most commonly used buttons, which you can then check to add them
to your QAT. You can also click the More Commands item in this list to see the
dialog box to the far right. If contains a huge number of other buttons you can
add to your QAT. In fact, if you create your own macros to perform common
tasks, you can place buttons to run them on your QAT.
In Excel 2010 or later, you can get to the Customize dialog box by clicking the File
button, then Options, and then Quick Access Toolbar. Or in any of these versions,
you can simply right-click any QAT button and select the Customize Quick Access
Toolbar option.
You can also right-click any button on the visible ribbon and select Add to Quick
Access Toolbar to add this button to your QAT. Similarly, a quick way to delete a
button from your QAT is to right-click any of its buttons and select Remove from
Quick Access Toolbar.
Try it! Add some of your favorite buttons to the QAT. Fortunately, you will have to
do this only once on any given PC.
QAT Customize list QAT Customize dialog box
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Excel Options
Excel has many options for changing the software's behavior. To get to it,
click the File button in the upper left corner of the screen and then Options.
As shown to the right, you will see that the options are grouped in
categories: General, Formulas, and others. You might have to hunt a while,
but you will eventually find what you are looking for among the large
number of options available.
Try it! Under the General group, change the default number of worksheets
in a new file from 3 to 1. (Why have 3 when you usually need only 1? If you
need more, you can always add them. Note that Microsoft seems to have
changed the default to 1 in Excel 2016.)
Try it! Under the Advanced group, the first Editing option lets you choose
the direction you want the cursor to move when you press Enter. Change it
to the direction you prefer.
Try it! Excel makes some automatic changes for you when you type certain
characters. For example, if you type (c), it automatically changes this to a
copyright symbol. If you find this annoying, you can change it through the
AutoCorrect Options button in the Proofing group. Similarly, add an
abbreviation for your name or company through AutoCorrect Options so
that whenever you type the abbreviation, the full name appears.
Note that most of the options are for Excel as a whole, not for any particular
workbooks or worksheets you might have open. However, there are a few
that are workbook-specific or worksheet-specific. For example, in the
Advanced group, there are two sets of options, "Display options for this
workbook" and "Display options for this worksheet" that can be varied from
one workbook or worksheet to another.
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Note that if you save your file as an .xlsx file, users with Excel 2003 won’t
be able to open it unless they download and install a free file format
converter from Microsoft. (Search the Web for Microsoft Office
Compatibility Pack to find this free download.) In the other direction, if you
save a file created in Excel 2007 or a later version as an .xls file, it will
probably work fine, and it will be readable by users with older versions of
Excel, but it won't be able to take advantage of changes in post-2003
versions. In fact, some new elements such as sparklines won't appear at all.
Keep these points in mind because there will probably continue to be many
Excel users who will not convert to post-2003 versions for years. You and
they can share files, but you need to be aware of the rules and limitations.
There are a few other new file extensions you might see, including the
following:
.xlsm: If your Excel file has associated VBA macros, and you want to save it
in the post-2003 XML format, you must save it as an .xlsm file ("m" for
macro). You might also see files with an .xlam extension. These are Excel
add-ins. In pre-2007 versions, add-ins had an .xla extension.
.xltx: This is a template file ("t" for template). Templates are discussed in
the Templates topic of this tutorial.
.xlsb: This is a binary file ("b" for binary). The only file you will probably see
with this extension is the Personal.xlsb file, used for storing your favorite
macros. See the Recording Macros topic in this tutorial for more about this
special file, your "Personal Macro Workbook."
Try it! Open a new workbook in Excel 2007 or a later version and do a Save
As. You will see the list of file types to the right. Because you are in Excel
2007 or later, the default type is the top one, .xlsx. But if you wanted to
give this to a colleague with Excel 2003, you could save it as an Excel 97-
2003 .xls workbook. (You could even save it as an Excel 5.0/95 .xls
workbook, but let's hope those days are over!) Alternatively, if your file
contained macros, you could store it in the new format as an .xlsm file, or
you could store it in the old 97-2003 .xls format.
contained macros, you could store it in the new format as an .xlsm file, or
you could store it in the old 97-2003 .xls format.
File types (under Save As)
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
When you are working on a large worksheet, you often want to reorient yourself
by going back to cell A1, the "home" cell. This is easy. Just press Ctrl+Home from
anywhere in a worksheet, and you will go to cell A1.
Try it! Scroll way down and way across to the right. Then press Ctrl+Home.
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
61
Splitting the Screen 95
33
It is often useful to split the screen so that you can see more data.
49
To split the screen: 10
Select the cell where you want the split to occur and then click the Split button on the 14
View ribbon. This provides four panes that operate independently. Once you have these 21
panes, practice scrolling around in any of them, and see how the others react. 8
Try it! Split the screen so that you can see the top left cell and the bottom right cell in the 94
data set to the right. Then remove the splits by clicking the Split button again. Actually, if 84
you want to remove only one of the splits, horizontal or vertical, you can drag the split 62
line to the right or down to the edge of the window.
16
Note: Prior to Excel 2013, you could drag buttons next to the scrollbars to split either 93
vertically or horizontally. Perhaps these buttons were too difficult to locate, so they were 6
eliminated in Excel 2013.
28
66
56
3
33
34
80
53
77
64
39
75
58
56
5
80
6
52
83
8
55
51
39
50
42
48
54
15
28
28
99
24
19
21
30
93
32
35
82
23
59
17
4
67
17
71
48
29
58
64
14
67
90
83
21
14
38
64
10
53
79
90
60
67
22
80
86
41
8
58
9
21
64
59
18
17
22
72
56
10
72
72
94
44
4
44
80
41
21
35
44
38
45
47
64
79
25
47
2
73
97
62
22
48
63
59
23
73
87
25
87
1
25
3
21
46
41
74
8
64
60
24
66
5
51
80
69
44
36
90
29
87
80
67
78
59
50
91
36
93
31
32
36
10
51
54
18
20
84
2
80
6
55
6
6
48
49
89
82
29
11
43
17
100
65
26
85
27
74
90
81
87
85
63
8
14
70
35
24
66
75
47
75
62
90
9
58
87
5
71
40
77
62
75
68
68
60
38
13
65
11
100
93
99
47
62
36
50
71
33
68
80
82
70
95
24
1
91
100
58
45
21
53
5
35
53
51
35
22
4
8
75
5
13
31
98
6
97
67
16
49
6
81
55
79
7
97
68
26
91 84 8 3 62 11 33 83 70 84
8 14 68 33 23 13 12 3 100 42
93 80 5 60 30 13 34 23 57 56
47 37 41 56 38 46 50 100 40 59
65 46 42 52 90 37 31 56 29 78
69 15 73 11 75 77 36 66 32 97
80 46 93 35 95 35 95 27 25 39
74 24 77 9 92 46 28 100 22 31
33 56 88 51 73 22 39 93 77 39
17 60 87 32 46 100 61 83 71 93
79 43 80 11 9 24 52 22 58 80
29 76 6 90 32 40 62 94 34 34
54 2 11 82 33 18 31 42 58 13
39 52 66 33 2 23 49 87 46 75
91 57 78 29 82 24 88 45 3 30
28 57 51 87 44 99 18 32 34 71
100 36 48 46 60 71 33 30 26 38
34 87 45 45 76 85 86 28 100 70
13 50 83 53 20 83 13 7 27 92
55 3 9 67 99 25 33 93 18 92
45 89 83 23 31 12 14 27 75 89
96 54 41 100 1 28 21 29 68 76
57 38 52 44 94 46 72 50 83 56
86 26 30 35 69 52 28 48 27 67
28 43 41 27 86 76 44 12 47 79
97 99 71 66 63 42 63 15 91 40
14 66 95 35 18 41 32 29 35 46
58 57 81 48 63 27 54 97 81 34
99 11 59 7 8 84 56 76 54 23
67 47 99 77 50 42 90 92 86 59
22 30 3 40 19 67 32 57 49 8
100 67 91 27 59 11 72 12 79 9
32 19 90 44 22 100 11 18 68 91
51 93 30 28 55 97 60 46 59 77
21 30 49 5 26 1 16 86 85 86
88 93 61 96 88 59 68 44 95 13
97 37 14 25 17 44 69 92 16 86
80 41 96 76 49 43 27 73 88 11
73 4 25 21 30 74 44 68 36 69
60 26 34 87 79 62 96 39 45 13
12 31 66 87 68 48 34 46 29 50
63 54 42 15 32 73 11 91 96 14
41 18 72 18 36 54 96 3 50 58
15 100 28 4 9 94 43 56 98 80
3 52 27 39 60 4 18 63 56 22
32 55 62 100 30 82 17 79 11 41
28 46 73 83 78 96 39 32 42 45
31 14 78 87 14 49 85 75 84 43
76 53 91 46 94 2 64 34 41 41
98 84 86 97 9 98 94 44 61 47
54 80 51 59 62 6 8 29 4 30
32 25 34 37 83 51 54 45 52 57
86 46 28 54 56 26 57 3 67 91
94 71 95 56 37 97 84 7 68 8
62 88 21 2 57 19 66 65 32 89
19 95 63 4 99 93 50 100 2 28
62 36 55 37 49 11 62 7 70 31
58 54 91 39 76 25 22 55 23 23
41 21 18 24 6 65 10 83 45 42
8 45 90 1 34 11 60 21 93 63
41 36 7 69 54 5 9 46 46 60
97 30 76 59 85 39 96 30 40 26
15 37 56 25 71 3 78 83 65 98
66 57 26 39 63 17 46 76 99 14
48 78 6 72 26 1 84 26 48 29
56 76 7 97 89 44 99 19 73 67
97 41 63 79 20 90 95 87 92 71
17 24 75 31 11 98 72 91 5 65
32 27 46 59 22 82 12 65 48 24
27 3 62 48 39 43 8 81 19 36
87 57 5 39 100 56 61 5 62 84
15 57 23 94 63 96 6 54 27 1
24 39 52 80 100 28 88 21 15 62
10 66 31 7 99 48 21 85 20 63
70 94 39 66 37 7 78 57 92 31
19 84 3 4 48 34 91 41 11 41
59 36 83 90 42 45 17 64 83 9
9 71 3 84 2 95 44 67 18 14
53 52 45 50 20 39 23 68 48 12
17 94 59 82 93 50 47 67 46 19
16 44 67 60 14 38 99 57 37 53
46 51 42 50 52 38 16 49 60 66
66 13 63 76 23 58 1 70 47 15
52 88 11 35 21 57 6 14 82 3
10 80 57 97 49 89 1 5 83 24
23 18 11 83 7 50 96 3 33 46
79 96 60 21 49 80 80 80 52 4
93 64 38 26 71 1 66 39 49 58
54 3 25 10 80 46 49 26 52 92
49 70 22 71 98 81 44 23 94 46
24 96 90 79 26 13 63 60 59 38
62 35 54 98 13 94 56 28 85 44
81 96 90 42 44 88 33 37 61 67
95 47 39 40 74 48 72 44 83 30
77 68 43 75 89 23 27 53 55 59
46 33 91 76 68 54 82 74 73 26
62 70 62 1 71 46 49 90 97 12
16 63 96 93 42 98 36 32 31 92
78 4 57 89 63 14 63 11 40 87
53 42 63 53 73 15 21 38 47 62
8 23 12 57 71 55 48 77 6 80
77 13 57 84 1 92 13 19 73 93
28 20 14 34 77 12 47 30 32 43
79 17 53 48 31 52 29 16 42 32
19 27 44 81 54 47 8 24 67 7
82 78 93 9 49 1 20 76 63 63
91 77 37 45 46 5 71 47 15 18
24 39 50 25 65 52 71 14 24 94
36 57 8 7 85 97 6 16 11 84
62 44 21 75 43 58 44 84 64 99
11 56 79 80 68 68 25 21 63 85
1 96 34 33 30 92 70 17 3 22
65 45 17 6 16 19 61 9 23 37
21 96 87 87 33 95 99 19 92 88
29 26 8 25 35 27 30 69 28 63
31 48 1 100 11 71 77 87 38 88
42 23 87 55 73 89 22 73 27 67
12 99 78 21 25 58 88 4 39 15
62 60 7 95 7 9 20 37 63 33
83 41 52 33 77 59 28 78 49 16
53 55 94 79 73 53 45 93 69 6
85 62 26 65 82 48 55 5 82 50
76 44 15 5 76 8 73 54 18 3
36 61 5 95 95 55 44 81 51 39
49 6 24 96 32 90 43 43 36 37
65 3 98 88 93 52 26 76 97 51
7 5 62 60 41 36 43 94 66 60
15 36 21 81 37 48 67 87 79 56
88 92 53 26 82 74 30 71 37 57
8 27 24 80 66 74 33 76 70 91
32 70 57 7 68 37 55 84 29 57
5 50 73 14 35 70 87 65 56 85
52 77 79 18 82 17 29 56 56 56
28 1 99 41 63 89 69 97 26 50
75 59 23 50 98 8 91 84 25 59
32 42 22 45 40 78 92 9 76 58
100 97 47 89 46 89 73 33 29 43
21 61 56 43 59 39 19 41 82 2
11 13 49 60 16 15 94 67 91 32
38 15 55 84 4 68 40 85 2 68
59 95 21 59 78 9 59 36 68 21
43 36 99 84 57 72 11 93 84 75
96 63 2 69 5 56 70 66 65 75
35 33 45 100 95 30 23 92 15 64
11 97 85 100 17 81 87 5 71 57
99 83 90 96 54 33 56 59 32 34
41 1 99 56 87 85 74 85 29 6
86 89 90 17 97 64 6 43 23 3
98 73 2 43 55 81 46 6 58 18
7 61 27 45 25 32 47 66 95 22
65 6 73 62 5 96 69 65 21 72
58 44 11 100 82 50 28 26 93 81
92 28 37 38 4 30 99 17 88 37
31 27 55 85 54 65 94 90 56 4
42 27 37 83 42 5 43 24 68 57
76 74 40 8 61 46 73 31 92 79
13 30 44 71 60 83 68 76 20 8
72 34 68 46 1 35 84 32 34 98
41 64 66 64 25 66 21 38 45 31
51 44 70 39 66 38 21 74 64 99
22 68 19 62 49 31 98 76 84 89
36 76 29 14 36 22 14 68 87 89
81 83 45 67 76 65 53 76 100 39
32 35 35 77 100 51 81 67 46 93
80 49 44 55 44 25 53 58 86 24
73 48 54 20 12 73 27 82 47 50
88 39 92 91 88 70 97 86 53 95
14 68 28 42 87 68 86 16 68 5
85 2 88 9 46 3 68 30 79 3
82 90 87 29 56 68 54 49 100 34
16 70 33 38 89 89 38 22 56 2
65 76 38 66 65 90 52 67 74 77
96 81 70 57 16 56 37 50 6 73
39 13 40 71 72 68 55 21 65 45
49 96 18 36 30 71 10 51 32 27
21 73 40 37 28 24 4 14 56 65
77 29 50 77 10 53 30 55 77 79
87 58 88 19 44 54 82 62 18 84
56 63 89 78 60 49 39 34 92 15
50 7 90 32 25 80 80 9 77 47
4 11 95 8 72 16 30 36 6 38
34 52 95 58 72 88 48 92 13 86
50 36 79 4 91 62 30 79 44 2
4 53 74 9 37 100 77 22 19 16
67 18 3 36 41 24 51 89 8 90
10 62 20 81 35 2 71 26 27 50
30 97 86 13 26 91 11 80 60 98
71 10 68 99 9 92 4 75 99 24
18 40 81 20 19 21 59 12 4 72
23 86 50 65 69 52 75 28 71 32
68 65 22 38 67 79 97 13 88 93
20 39 36 60 83 62 69 11 42 51
42 69 77 10 87 33 4 55 91 52
34 71 48 48 54 45 82 35 14 54
35 7 53 28 9 82 61 82 66 43
61 39 77 63 54 89 92 56 91 73
83 38 56 55 5 96 90 75 65 80
32 49 76 59 48 40 29 33 60 20
2 31 1 86 96 41 11 89 62 22
4 60 71 6 49 33 19 31 56 25
47 83 28 10 39 15 71 84 84 65
29 30 76 72 11 91 2 71 60 9
37 65 32 8 44 42 90 84 68 76
55 13 82 26 58 53 81 39 6 99
27 2 33 73 3 87 10 58 82 100
90 32 82 40 62 49 32 60 4 72
31 22 48 69 66 28 54 3 58 56
7 75 57 36 24 65 72 21 69 79
54 34 43 18 89 25 1 94 64 86
17 81 73 51 24 99 49 99 95 22
53 39 63 39 49 52 66 37 69 88
44 18 1 14 6 88 7 8 87 51
2 66 24 33 64 9 73 50 100 33
78 33 93 61 75 81 47 24 10 8
74 100 95 33 87 58 14 10 41 85
79 1 30 38 38 2 52 10 76 34
77 58 4 76 71 79 10 7 40 73
39 52 60 13 65 16 90 12 57 57
15 65 34 2 49 3 68 46 42 32
100 64 94 41 79 3 11 9 23 40
37 100 34 96 54 46 34 58 61 7
30 8 81 33 75 76 68 2 39 38
63 57 70 12 93 83 29 96 51 85
54 72 49 3 68 38 97 81 6 37
32 91 5 34 66 31 25 69 89 35
89 86 36 50 78 81 78 8 4 51
22 53 19 14 39 86 50 13 62 91
43 74 72 45 41 13 42 87 34 42
33 7 76 39 88 55 64 16 37 35
70 27 78 78 36 85 79 50 15 27
42 24 11 41 78 58 7 51 27 59
26 84 65 71 15 32 95 79 31 75
79 78 99 41 89 12 77 90 48 41
12 65 57 60 52 37 25 71 26 11
98 2 43 82 3 26 52 86 28 100
50 29 23 18 59 79 48 63 97 17
25 43 25 98 79 6 30 89 48 13
51 1 1 36 34 51 17 93 73 53
83 10 62 46 46 82 47 97 46 92
25 29 1 97 7 45 16 62 83 26
24 71 78 75 40 97 97 69 39 89
4 69 90 27 70 16 15 56 96 48
80 64 22 36 66 3 14 81 69 35
54 13 100 97 23 71 46 63 52 11
88 74 93 53 84 2 55 10 2 22
28 66 58 48 87 30 12 83 27 91
35 40 86 85 56 79 20 7 86 34
5 86 97 42 43 21 71 86 70 58
64 50 32 28 86 46 98 2 36 54
67 43 64 41 72 95 83 92 44 61
64 79 7 7 94 92 40 25 88 51
55 34 5 19 89 58 38 82 66 35
43 50 69 37 11 16 79 92 17 18
79 76 21 85 12 67 18 32 68 90
82 70 80 13 44 70 57 27 70 26
83 5 79 15 91 92 29 50 79 67
84 67 96 65 88 82 98 12 30 63
13 37 12 100 57 68 80 27 71 32
51 75 17 89 44 22 34 62 95 25
60 8 51 74 41 84 1 38 82 80
29 35 1 37 65 88 99 45 100 96
29 86 53 36 26 23 83 19 63 68
43 93 34 93 35 17 6 99 55 7
94 30 49 86 7 18 39 54 4
23 85 57 84 89 53 25 57 97
82 3 62 89 17 6 28 99 26
34 22 37 39 24 64 31 5 86
88 67 62 23 32 72 65 32 98
51 41 90 79 49 16 49 75 78
33 93 81 44 4 88 50 19 1
97 78 79 17 62 1 69 26 74
51 75 63 6 63 31 7 55 24
74 34 52 4 26 55 60 27 51
41 93 77 33 8 38 89 95 20
91 57 9 49 93 62 45 7 62
20 20 58 23 16 69 51 15 70
58 95 64 9 8 100 60 65 68
36 90 61 40 12 19 89 39 34
54 65 39 72 94 59 47 24 86
78 44 4 59 90 43 100 9 70
72 45 7 49 10 21 27 54 43
43 19 59 8 91 55 42 23 11
16 9 95 61 27 11 5 36 4
99 9 46 3 51 38 24 33 63
44 97 68 7 19 6 5 58 66
12 29 60 65 93 60 21 8 47
62 52 39 46 20 82 66 58 1
46 32 58 36 71 83 52 40 39
1 68 95 2 61 97 54 39 61
96 80 77 31 34 12 49 70 96
12 85 9 66 69 72 40 83 90
33 77 7 2 2 19 80 23 27
59 94 24 17 90 11 46 62 32
63 64 10 34 41 80 87 45 58
27 31 20 25 54 5 13 91 100
99 41 92 91 19 30 18 86 8
45 7 12 6 57 47 28 83 98
100 90 83 1 63 61 64 84 67
18 81 23 31 28 35 80 70 59
68 83 22 89 64 80 60 12 26
79 6 16 40 73 91 36 4 86
98 35 16 18 54 88 24 57 41
91 85 3 47 50 2 16 61 94
88 14 43 47 47 90 15 46 73
29 64 78 57 91 27 89 65 24
89 69 40 42 5 10 90 97 7
86 71 40 15 90 70 18 61 100
66 36 51 18 29 14 33 53 55
86 87 71 67 93 38 54 44 71
66 2 7 87 67 4 45 69 90
63 48 88 61 71 20 71 58 32
26 17 44 46 100 63 29 24 7
37 24 28 75 84 24 96 11 4
63 63 77 3 11 68 60 60 52
4 41 22 37 31 48 24 53 36
83 73 74 6 54 46 32 19 80
51 24 19 55 32 8 2 67 19
11 58 49 47 38 28 49 39 31
34 92 64 34 58 32 14 27 14
11 67 64 54 37 90 40 81 97
66 74 49 57 66 3 23 17 76
84 57 73 25 58 52 26 91 48
88 93 15 18 40 35 16 98 26
90 18 3 10 84 79 47 67 41
36 82 50 80 68 96 82 17 97
46 78 59 25 9 28 74 1 62
37 30 96 5 76 49 65 52 50
43 21 16 65 24 16 82 99 56
47 34 84 85 42 95 78 91 97
50 68 16 50 17 53 37 33 94
100 75 83 59 92 40 73 19 70
83 93 88 84 64 85 41 63 49
76 57 69 70 52 39 10 16 39
84 11 3 80 49 5 24 37 67
58 23 46 28 58 84 17 80 4
70 91 48 36 56 15 88 39 93
37 20 86 24 81 78 89 69 6
47 61 93 13 91 62 70 41 3
40 59 2 100 33 74 81 81 44
66 92 37 83 58 31 4 66 40
12 31 77 11 53 7 56 47 7
5 79 51 73 41 45 37 15 44
28 23 33 4 62 29 27 44 15
48 92 63 14 15 52 50 92 43
4 10 61 75 62 89 19 47 48
11 25 50 14 88 49 16 14 94
30 59 11 72 82 26 50 63 41
65 32 94 90 63 6 76 15 56
95 22 99 54 46 36 63 38 7
6 2 96 16 42 51 15 38 59
11 42 23 50 40 57 84 62 14
36 2 14 22 82 9 61 72 77
84 7 72 88 46 64 51 68 71
35 22 25 50 83 60 85 94 24
97 88 39 57 66 70 97 30 77
11 88 12 51 21 40 12 10 37
93 97 12 78 55 78 89 6 20
36 73 89 67 83 56 62 87 85
66 95 46 21 56 46 19 80 14
61 50 100 58 92 31 3 37 63
30 61 73 2 83 83 55 41 20
10 30 39 51 55 34 74 72 58
23 62 19 5 96 95 80 4 56
63 34 38 75 73 65 62 50 41
13 72 10 45 43 66 64 68 9
59 89 24 56 64 44 26 47 31
29 99 56 63 14 30 28 94 59
84 28 77 28 76 27 96 84 6
77 16 95 82 15 8 4 41 50
46 36 8 63 8 15 28 32 30
59 63 65 31 93 16 71 88 3
28 95 38 72 50 5 84 15 2
80 70 84 97 90 3 93 96 47
79 37 69 82 95 100 71 26 58
59 5 36 3 39 52 1 45 7
48 20 20 40 75 65 42 17 70
4 57 79 9 84 2 41 9 13
84 25 27 3 4 44 79 55 61
82 92 100 100 32 59 7 1 72
74 73 32 35 100 22 60 37 62
5 10 51 64 23 93 67 3 84
60 25 59 91 15 76 44 28 70
17 13 92 8 77 38 83 41 91
55 98 4 99 58 5 92 23 45
68 83 6 32 7 84 77 76 56
40 51 87 91 87 50 92 62 81
13 30 54 49 1 31 100 16 40
56 47 79 51 14 2 55 93 38
42 54 3 84 69 53 19 95 95
24 100 23 72 92 42 63 99 96
50 52 6 49 61 93 86 70 67
38 79 52 81 29 93 50 46 53
60 83 26 92 63 37 72 38 66
5 82 48 26 40 20 7 84 34
51 54 75 88 27 35 13 20 28
43 30 82 39 9 11 36 50 33
30 9 44 38 9 19 25 64 74
21 50 94 4 32 36 13 71 60
32 44 50 57 98 55 18 18 88
46 41 83 59 75 66 65 88 32
73 84 3 11 36 69 53 10 33
65 21 89 53 90 23 79 75 37
46 3 49 96 43 66 16 68 85
98 28 28 43 75 15 15 46 97
56 15 80 83 32 36 100 78 96
10 97 100 60 1 52 42 8 90
41 25 55 7 30 61 71 5 68
87 40 30 39 55 79 98 85 23
56 17 12 94 57 99 20 35 92
73 40 42 65 73 22 7 7 99
74 60 9 26 83 36 58 66 35
96 91 86 93 2 100 15 54 54
31 61 93 26 3 67 9 3 38
10 27 58 29 28 35 27 68 2
15 33 49 62 75 50 5 45 20
90 1 77 59 61 73 66 32 39
3 84 8 56 20 9 91 72 19
97 67 13 41 20 38 39 11 46
87 18 8 70 43 40 74 98 73
48 25 58 33 53 72 18 12 41
27 52 51 8 16 61 6 68 43
34 17 4 83 1 60 22 74 33
18 98 18 51 87 36 70 19 46
100 96 9 25 81 17 67 34 71
5 42 37 65 87 48 98 10 82
47 28 59 9 22 39 98 65 19
8 83 32 57 16 16 71 27 37
87 48 65 79 38 7 90 6 23
73 76 6 98 65 19 51 78 92
13 61 27 56 89 25 88 73 49
12 97 43 44 78 72 71 82 28
77 14 12 10 13 29 6 30 35
93 31 39 85 87 70 67 32 69
22 71 10 74 95 96 34 99 53
95 88 25 10 67 89 69 42 2
11 82 8 78 66 30 97 83 68
30 73 36 83 50 28 39 57 91
8 26 2 45 59 81 53 1 75
78 7 74 71 47 1 30 27 76
48 25 70 87 64 15 15 72 32
10 61 51 76 97 63 47 53 29
100 19 90 16 86 11 76 81 39
84 5 91 13 8 39 81 4 61
31 51 87 63 27 45 49 50 65
93 91 28 46 23 88 85 35 40
18 39 47 58 8 15 90 15 32
51 66 27 68 38 35 85 43 24
100 27 59 4 52 3 43 57 17
100 5 12 62 10 44 48 71 75
27 76 20 63 11 98 3 100 16
10 49 30 29 55 16 28 9 72
22 93 40 35 2 82 85 97 87
60 39 88 93 51 32 82 69 51
51 51 17 89 70 63 68 73 42
34 36 50 48 7 7 34 32 16
15 62 12 7 66 38 41 87 41
11 40 58 23 97 30 5 84 59
90 67 21 39 41 13 30 75 20
69 83 17 19 16 84 43 31 27
18 42 64 31 92 65 83 1 33
82 56 87 70 7 74 16 95 60
57 67 77 13 42 76 76 89 48
22 19 1 2 64 87 74 46 91
78 72 3 68 36 88 8 32 71
16 94 72 12 82 42 65 93 9
14 79 7 33 35 21 24 85 16
49 77 14 10 50 64 21 88 100
91 83 14 45 6 43 87 6 7
55 97 83 7 32 75 92 65 48
21 100 94 12 94 24 6 14 83
23 10 34 14 47 66 30 97 91
86 25 92 19 34 22 52 51 8
32 5 74 4 19 3 26 66 68
3 86 44 78 43 88 5 38 94
54 35 92 35 1 72 78 79 69
9 90 16 28 65 6 91 29 41
54 21 94 85 70 86 71 1 55
63 5 14 72 9 39 98 56 94
28 82 89 37 68 86 9 97 62
26 6 95 19 27 41 83 90 16
35 80 19 43 13 70 22 74 9
76 41 47 40 73 65 63 98 15
63 60 39 27 18 16 6 19 28
51 55 90 20 49 94 56 53 17
25 64 36 1 18 78 31 90 51
77 22 5 57 15 39 90 19 14
35 11 65 31 14 52 19 42 12
56 39 15 59 88 100 9 38 72
20 88 51 91 14 81 34 27 21
8 63 47 72 79 86 48 37 83
99 84 81 23 29 16 2 96 28
31 4 32 63 94 50 10 95 74
71 66 93 74 40 99 13 81 49
88 8 78 17 63 6 20 69 68
46 39 87 34 73 95 48 44 54
19 5 95 71 17 1 90 40 22
31 70 14 88 34 26 41 73 23
2 10 75 78 3 73 5 25 37
61 39 85 83 56 27 95 58 16
79 80 1 15 35 94 85 44 59
95 53 51 21 88 93 34 27 24
22 63 28 60 26 91 1 48 62
37 36 79 93 56 75 94 87 58
5 79 8 35 38 75 6 94 63
1 24 33 27 52 25 19 13 79
5 9 64 2 45 80 64 47 74
60 47 59 76 77 10 81 3 22
35 39 48 4 93 9 84 74 63
53 26 36 10 46 67 80 84 42
2 63 86 81 17 8 33 79 31
29 73 6 5 10 92 65 39 20
95 100 81 98 51 36 17 77 22
62 3 12 77 12 62 23 90 83
22 59 50 50 36 14 35 52 34
48 59 87 55 93 88 7 82 96
56 13 51 45 14 71 53 31 89
19 28 49 60 12 52 46 48 54
14 67 63 24 34 94 30 31 1
74 10 13 15 92 27 19 19 43
87 90 22 41 37 46 25 88 44
38 95 69 58 74 11 81 99 50
66 66 59 30 19 86 51 6 44
95 64 35 84 26 90 96 8 6
58 5 46 37 11 18 32 63 71
88 10 83 19 26 36 84 78 48
42 29 55 37 95 65 59 47 95
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
If you favor keystrokes to mouse clicks, you can try the methods on this worksheet for
selecting large ranges or for moving around in them. Four types of keystroke
combinations are illustrated here: (1) Ctrl+Arrow combinations, (2) End, Arrow
combinations, (3) Ctrl+End, and (4) Ctrl+a. The first two are basically for moving to
corners of a data range, usually one that doesn't fit on a screen. Just be aware that if
you use either of the first two, the active cell moves from corner to corner, but nothing
in between is selected. To select, you need to hold the Shift key.
Ctrl+Arrow Combinations
It is often useful to zoom to the bottom, top, right, or left corner of a data range.
You can do this easily with the Ctrl+Arrow combinations.
Select some cell in the data range, usually the upper left cell. Then press the Ctrl key
and the appropriate Arrow key simultaneously. For example, press Ctrl+Right Arrow
to go to the right corner of a range.
Try it! Starting at the gray cell to the right, move around to the other corners of the
large data range. You should end back in the gray cell.
Try it again! This time hold the Shift key. Then the Ctrl+Down Arrow combination
followed by the Ctrl+Right Arrow combination selects the entire range.
Try it again! Starting in the blue cell in the small data set above, use the Ctrl+Arrow
combinations to see how they are affected by blank cells.
Try it! Do the same exercises as above but now with End, Arrow combinations.
Try it! Do the same exercises as above but now with End, Arrow combinations.
Ctrl+End combination
Another possibility is to use the Ctrl+End combination. Starting from any cell, this
selects the bottom right nonempty cell in the worksheet. If you hold the Shift key, this
selects the range from the active cell to the bottom right nonempty cell in the
worksheet.
Try it! Select the large data range to the right with the Shift+Ctrl+End combination.
You should start with the upper left cell in the data range.
This key combination often comes in handy when files much larger than you think
they should be. For example, you might see that the size of your "small" file is 1MB or
more. It could be that junk is somewhere way down in a worksheet. If you press
Ctrl+End and it takes you way down or across, well beyond your data, this is a sure
sign of junk that you can then delete.
Ctrl+a combination
A last quick way to select a data range, even one with some blanks as in the small data
set above, is to select any of the cells in the range and press Ctrl+a . (No Shift key is
necessary.) You can think of "a" as an abbreviation for "all".
Try it! Use Ctrl+a to select either the small data set or large data set to the right. You
will note that every cell "surrounding" the selected cell is selected, even the labels
above the data sets. This is why labels such as these are often separated by blank
rows from the real data ranges.
This is another combination that you can use to locate junk, as described in the
previous text box.
Topics sheet
In Excel, you usually select a range and then do something to it, such as enter a
formula in it, format it, delete its contents, and so on. Therefore, it is extremely
important to be able to select a range efficiently.
First, it is important to realize that a rectangular range is defined by its upper left cell
and its bottom right cell. For example, the range address A1:D10 indicates that the
upper left cell is A1 and the bottom right cell is D10. So an easy way to select a range is
to click its upper left cell, hold the Shift key, and click its bottom right cell.
Click the upper left cell of the range and drag to the bottom right cell.
Or:
Click the upper left cell, hold the Shift key, and click the bottom right cell.
Try it! Select the small data range to the right by each of these methods. They are both
easy because the range is so small.
Selecting a range with the top-left/bottom-right method is trickier if you can’t see
the whole range on the screen. Dragging, the method most users seem to use, can
be frustrating because things scroll by too quickly. You scroll too far, then not far
enough, then too far again, and so on. To avoid this endless scrolling , use the
following method instead.
Split the screen horizontally and vertically. To do this, select any cell in the data
range and click the Split button on the View ribbon. Then in the bottom right pane,
press Ctrl+Down Arrow and then Ctrl+Right Arrow to zoom to the bottom right cell
of the data range. Now that you can see the upper left and bottom right cells of the
range, click the upper left cell, hold the Shift key, and click the bottom right cell.
Then you can remove the split.
Try it! Select the entire data range with the method just described. With a little
practice, you should be able to do it in a few seconds.
Try it! Select the entire data range with the method just described. With a little
practice, you should be able to do it in a few seconds.
Topics sheet
Suppose you want to format more than one range in a certain way. The quickest
way is to select all ranges at once and then format them all at once.
Select the first range, press the Ctrl key, select the second range, press the Ctrl key,
select the third range, and so on.
For example, to select the top two ranges to the right, select cell K3, hold the Shift
key and select cell L5 (so now the first range is selected), hold the Ctrl key and
select cell N3, and release the Ctrl key. Finally, hold the Shift key and select cell O7.
Note that in Excel 2007, the highlighting is sometimes hard to see. The shading isn’t
as dark as in previous versions of Excel, so you might be fooled into thinking you
haven’t really selected multiple ranges. But the above method definitely works,
exactly as it always has. (This shading problem was fixed in Excel 2010, so that the
selection is now much more apparent.)
Topics sheet
10 13 7 9
1 9 12 7
5 4 1 1
6 12
15 2
13 4 10
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Copying and pasting (often formulas) is one of the most frequently performed tasks in
Excel, and it can be a real time-waster if it is done inefficiently. For example, many people
scroll through a long range to select it, then click the Copy button or a Copy menu item,
then scroll again to select a paste range, and finally click the Paste button or a Paste menu
item. If this sounds familiar, you can definitely benefit from the tips here. As usual in
Microsoft products, there are multiple ways to perform the same task. You can use any or
all of the methods described here.
Copying and Pasting with the Ctrl+c and Ctrl+v Shortcut Keys
Select the copy range (using one of the efficient selection methods described in the
"Selecting" topics of this tutorial), press Ctrl+c (for copy), select the paste range (again,
efficiently), and press Ctrl+v (for paste). If you practice pressing Ctrl+c or Ctrl+v with
the little finger and index finger of your left hand, it will quickly become automatic.
Of course, you can also click the Copy and Paste buttons on the Home ribbon, but the
keyboard shortcuts are faster. Besides, they work on virtually all Windows programs,
not just Excel.
Note that after pressing Ctrl+v, the copy range still has the "marching ants" dotted
lines around it, meaning that it could be pasted again. Press Esc key to get rid of the
marching ants.
Try it! Copy the formula in the top gray cell to the right to the entire gray range by using
Ctrl+c and Ctrl+v.
A frequent task is to enter a formula in one cell and copy it down a column or across
a row. There are several very efficient ways to do this. One way is to use the
Ctrl+Enter keyboard shortcut.
Starting with the top or left cell, select the range where the results will go. (Use the
efficient selection methods described earlier, especially if this range is a large one.)
Type the typical formula and press Ctrl+Enter (both keys at once) instead of Enter.
Try it! Fill the entire gray range to the right with Ctrl+Enter. Each cell should be the
product of the two values to its left.
Pressing Ctrl+Enter enters what you typed in all of the selected cells (adjusted for
relative addresses), so in general, it can be a real time-saver. For example, it can be
used to enter the number 10 in a whole range of cells. Just select the range, type 10,
and press Ctrl+Enter.
Starting with the top or left cell, select the range where the results will go. (Use the
efficient selection methods described earlier, especially if this range is a large one.)
Type the typical formula and press Ctrl+Enter (both keys at once) instead of Enter.
Try it! Fill the entire gray range to the right with Ctrl+Enter. Each cell should be the
product of the two values to its left.
Pressing Ctrl+Enter enters what you typed in all of the selected cells (adjusted for
relative addresses), so in general, it can be a real time-saver. For example, it can be
used to enter the number 10 in a whole range of cells. Just select the range, type 10,
and press Ctrl+Enter.
Try it! Fill the entire blue range to the right with 10 by using Ctrl+Enter.
Note: The Ctrl+Enter shortcut has one other use. If you enter a value or a formula in
a cell and press Enter, an adjacent cell becomes the next active cell. (The direction
depends on the first option in the Advanced group under Excel Options.) However,
there are often times when you want the current cell to remain selected. To do this,
enter the value and press Ctrl+Enter.
Try it! Enter the value 1500 in the red cell to the right and press Enter. Which cell is
now active? This depends on the first option in the Advanced group of Excel Options
on your PC. Whatever cell is active, enter 2000 in it, but this time press Ctrl+Enter.
Which cell is now active?
If you place the cursor at the bottom right of a cell, the cursor becomes a plus sign. This
is called the AutoFill handle. To copy a formula down, you can use the AutoFill handle in
two different ways. Here is the first.
Enter the formula in the top or left cell of the intended range. Place the cursor on the
AutoFill handle at the lower right of this cell, so that the cursor becomes a plus sign, and
drag this handle down or across to copy.
Try it! Copy the formula in the top gray cell to the right to the entire gray range by
dragging the AutoFill handle.
This method uses Excel’s built-in intelligence, but it works only in certain situations.
Let’s say you have numbers in the range A3:B100. You want to enter a formula in cell
C3 and copy it down to cell C100. Because this is a very common task, Excel does it for
you if you double-click the AutoFill handle in cell C3. It senses the “filled-up” range in
column B and guesses that you want another filled-up range right next to it in column
C. If there were no adjacent filled-up range, double-clicking the AutoFill handle
wouldn’t work. Also, if there is a missing value (a blank) in, say, cell B56, the AutoFill
method might not work the way you want.
The second way to copy down is to double-click the AutoFill handle.
This method uses Excel’s built-in intelligence, but it works only in certain situations.
Let’s say you have numbers in the range A3:B100. You want to enter a formula in cell
C3 and copy it down to cell C100. Because this is a very common task, Excel does it for
you if you double-click the AutoFill handle in cell C3. It senses the “filled-up” range in
column B and guesses that you want another filled-up range right next to it in column
C. If there were no adjacent filled-up range, double-clicking the AutoFill handle
wouldn’t work. Also, if there is a missing value (a blank) in, say, cell B56, the AutoFill
method might not work the way you want.
Try it! In the data range to the right, copy the formula in the top gray cell to the entire
gray range by double-clicking the AutoFill handle.
Notes: For some odd reason, double-clicking the AutoFill handle works only if you are
copying down a column. It doesn't work if you are copying across a row (although you
can drag the AutoFill handle across a row). It would be nice if this functionality were
eventually changed in Excel. We'll see. However, it does work if you are entering the
formulas in a column to the left of the data, that is, if the gray range were in column J
instead of column M.
One final way to copy a range is to select it, hold down the Ctrl key, place the cursor on
any edge of the range so that it becomes a four-way arrow, and drag to where you want to
paste it. Because you're holding the Ctrl key, you should see a small plus sign as you drag.
This means that you are making a copy.
Try it! The gray range to the right has numbers in columns K and L, and formulas in column
M. Use the method in this text box to copy the entire gray range, using the red cell as the
top left cell of the paste range.
Topics sheet
3 3 9
4 1
2 3
2 1
5 1
4 2
3 5
6 2
9 1
4 9
7 6
2 3
8 5
3 9
10 7 70
6 9
4 9
5 1
2 8
8 10
10 7
7 8 56
2 1
10 2
4 1
4 5
3 8
7 8
7 8 56
2 1 2
10 2 20
4 1 4
4 5 20
3 8 24
7 8 56
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Often you would like to move data (or shapes, such as text boxes) from one location
to another.
Select the range (or shape) to be cut, press Ctrl+x (for cutting), select the upper left
corner of the paste range, and press Ctrl+v. (The little finger/index finger
combination on your left hand is good for pressing Ctrl+x or Ctrl+v.)
As with copying and pasting, ribbon buttons can be used instead of key
combinations, but the key combinations are quicker. Also, note that you need only
select the upper left cell of the paste range. Excel knows that the shape of the paste
range must be the same as the shape of the cut range.
Try it! Move the gray range one row down. (You might want to do this so that you
can add labels above the numbers.) Watch how relative addresses affect the
eventual formulas in column M.
There is an even quicker way to move a range. Select the range you want to move,
put the cursor on an edge of the range so that it becomes a 4-way arrow, and drag
the range to where you want it.
Try it! Use the 4-way arrow method to move the range back to where it was
originally, with cell K3 as its top left cell.
Topics sheet
2 3 6
7 4 28
3 6 18
3 9 27
6 7 42
6 6 36
1 4 4
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
When you do a "regular" paste with Ctrl+v or one of the equivalent methods
discussed in the Copying and Pasting topic of this tutorial, several things are
pasted to the paste range: (1) if a copied cell has a value or text, it is pasted; (2)
if a copied cell has a formula, the formula is pasted, adjusted for relative and
absolute addresses; (3) the number formatting of any copied cell is pasted; (4)
other formats of the copied cell, including font, background color, and border,
are pasted. This is what you expect, and this is why you usually use Ctrl+v or an
equivalent method to paste.
However, Excel contains many paste variations in its Paste Special options. One
of the most common is to copy formulas and paste them as values, but there
are quite a few other options.
The Paste Special user interface has evolved over recent versions of Excel, but
the options remained about the same. Is it more user-friendly now than in the
past? You can be the judge of that. However, one really nice feature introduced
in Excel 2010 is that if you copy a range, select a paste range, and then hover
your mouse over any of the Paste Special icons, you immediately see what the
pasted version will look like, without committing to the paste.
Before continuing, be aware that one other way to get to Paste Special options
is to copy and then right-click. This option was available in pre-2007 versions of
Excel, and it continues to be available. In addition, starting in Excel 2007, you
can go directly to the Paste Special dialog box with the Ctrl+Alt+v shortcut.
The rest of this worksheet explains and illustrates some of the Paste Special
options, using both the Paste Special dialog box and the gallery of icons under
the Paste dropdown. Note that one Paste Special option, transposing, is
discussed in the Transposing a Range topic of the tutorial.
Many of these icons have the same functionality as the corresponding items in
the Paste Special dialog box. However, the dialog box has some items with no
corresponding icons and vice versa. In any case, there is no need to memorize
all of the options. The ones illustrated below are the ones you will probably use
them, they are fairly small icons, and they can certainly be confusing. Therefore,
many users jump right to the Paste Special dialog box where everything is
spelled out in words. You might want to do this as well, but you might also want
to learn what these new icons do. They are explained briefly, row by row, to the
right. For more details on any of them, see the cell comments in column N.
Many of these icons have the same functionality as the corresponding items in
the Paste Special dialog box. However, the dialog box has some items with no
corresponding icons and vice versa. In any case, there is no need to memorize
all of the options. The ones illustrated below are the ones you will probably use
most often, and you can always return to this worksheet or online help for
others you might occasionally use.
By the way, the options you see depend on what is currently copied. For
example, if nothing is copied, the entire Paste button is disabled. If a range of
cells (or a single cell) is copied, all of the icons are shown. If a chart or a shape (a
text box, a rectangle, a picture, etc.) is copied, only three of the icons are
shown.
You often have a range of cells that contain formulas, and you would like to
replace the formulas with the values they produce. Usually, you paste these
values over the copy range, that is, you overwrite the formulas with values.
However, it is also possible to select another range for the paste range. This is
totally up to you.
Copy the range with formulas with Ctrl+c, and select the range where you
want to paste the values, often the same as the copy range. Then select the
Paste dropdown on the Home ribbon, and select one of the "Paste Values"
options in the third row of icons. Alternatively, press Ctrl+Alt+v to open the
Paste Special dialog box and select one of the "Values" options.
Try it! Copy the top gray range to the right and paste it over itself as values.
Then check that the paste range contains values, not formulas.
Try it again! Copy the bottom gray range to the right and select a cell in
column O for pasting. Then hover the mouse over the three "Paste Values"
options in the third row of Paste Special icons. You should see clearly how
they differ. Eventually, click the one you prefer.
Here is something interesting about the examples you just tried. In the first
example, it doesn't matter which of the three icons in the third row you
choose. The gray background and dollar formatting are retained because they
start this way, and pasting special doesn't change them. However, in the
second example, when you paste the bottom gray range to a range that starts
with plain formatting, it does matter which "Paste Values" option you choose.
Shortcut tip: If you paste values over formulas frequenty, as many users do,
there is a quick keyboard shortcut you might want to memorize. It is actually
based on the menu system from Excel 2003, but it still works fine. First, press
Ctrl+c to copy. Then press Alt+e and then s to open the Paste Special dialog
box. Finally, press the Down Arrow key twice and then Enter to choose Values
option. Here is the entire keystroke sequence. With some practice, you'll be
able to do it in your sleep!
Sometimes you want to paste formulas to a range, but you don't want to change
the formatting of the paste range. You can do this in Excel 2010 or 2013 with the fx
icon in the first row of Paste Special icons, or you can do it in the Paste Special
dialog box with the Formulas option.
Try it! The gray range to the right contains formulas and various formatting. Paste
these formulas to column O, but don't paste the formats. Again, it is instructive to
copy the formulas, select a cell in column O for pasting, and hover the mouse over
the options in the first row of the Paste Special icons to see their differences.
One rather long way to do this is to select the range, press Ctrl+c, select the paste
range, and select either the first icon from the fourth row of the Paste Special
icons or the Formats option from Paste Special dialog box.
However, a quicker alternative to this method, and one that you should definitely
use, is to use the Format Painter button next to the Paste dropdown, shown to
the right. Select a cell with the format you want to copy, click the paint brush, and
click a cell (or drag a range) that you want to format. Note that if you double-click
the paint brush, you can copy the format multiple times. Press the Esc key when
you are finished.
Try it! Copy the formats (numbers formats, font, background, and border) in
column K to column M. Don't copy the values, just the formats. Then enter some
values in column M to check that the formatting is correct.
Paste Special: Multiplying (or Adding, Subtracting, Dividing) by a Constant
Sometimes you would like to multipy each number in a range by a constant. For
example, if you have revenues expressed in thousands of dollars, you might want
to multiply each value by 1000 so that they are expressed in dollars. Fortunately,
you do this without any formulas!
Enter the constant in a blank cell, and copy this cell. Then select the range of
values to multiply and select Multiply from the Paste Special dialog box.
This same method can also be used to add, subtract, or divide by a constant.
However, note that you do need to do this from the Paste Special dialog box.
These options aren't available on the Paste icon gallery.
Try it! Multiply each value in the range to the right by 1000. Then restore them
to their original values by dividing each value by 1000. Notice that no formulas
are involved; the numbers simply change. So once you are finished, you can
delete the multiplier from the cell where you entered it.
ist of Topics sheet
Paste dropdown
Format painter
$47.65
$44.20
$37.68
$31.34
$89.36
$68.15
$28.57
147
173
217
178
120
203
137
217
153
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Often you set up a spreadsheet and then decide that you would rather have a
portion of it transposed. That is, you would like to “turn it on its side,” so that
rows become columns and vice versa. This is simple with one of Excel’s Paste
Special options.
To transpose a range:
Copy a range that you want to transpose with Ctrl+c. Then select the upper left
cell of the range where you want the transposed version, click the Paste
dropdown, and select the Transpose option circled to the right. Alternatively,
you can click Paste Special to open the Paste Special dialog box, and then select
its Transpose option.
Make sure there is enough room for the transposed version. For example, if the
original range has 3 rows and 5 columns, the transposed version will have 5
rows and 3 columns. If you select cell D5, say, as the upper left cell for the
transposed version, everything in the range D5:F9 will be overwritten by the
transposed version.
Try it! Transpose the range K19:O23 to a range with upper left cell K25. Note
that the gray cells contain formulas. Do the corresponding pasted cells still have
formulas? Are they still correct? Does the number formatting get pasted? What
about other formatting?
1. Select the entire range where you want the result to go. For example, if you
are transposing a range with 3 rows and 5 columns, select a blank range with 5
rows and 3 columns for the result.
3. Press Ctrl+Shift+Enter (all three keys at once), not just Enter. You always use
this key combination to enter an array formula.
Try it! Use the TRANSPOSE function, starting in cell K40, to transpose the range
to the right. After you press Ctrl+Shift+Enter, look at the formula bar. You will
see that there are curly brackets around the formula. You do not actually type
these curly brackets. They simply indicate that this is an array formula.
work.)
3. Press Ctrl+Shift+Enter (all three keys at once), not just Enter. You always use
this key combination to enter an array formula.
Try it! Use the TRANSPOSE function, starting in cell K40, to transpose the range
to the right. After you press Ctrl+Shift+Enter, look at the formula bar. You will
see that there are curly brackets around the formula. You do not actually type
these curly brackets. They simply indicate that this is an array formula.
At least for this example, the TRANSPOSE function method has a couple of
disadvantages. First, the formatting is lost. Second, you will see a 0 in the
upper left cell of the transpose range. This is because the upper left cell of the
copied range is blank. Unfortunately, you can't delete this 0 (although you
could paint it white). The result of TRANSPOSE comes as a "package," and you
can't delete or move any part of the package; you can only delete or move the
whole thing.
However, there is one place where the TRANSPOSE function is really useful,
namely, when you perform matrix multiplication (which is discussed in the
Array Formulas topic of this tutorial). Then you often need to use TRANSPOSE
so that the matrix multiplication is well-defined. For example, you aren't
allowed to multiply a 3x1 column by a 3x3 matrix. But you can multiply a 1x3
row (the column's transpose) by a 3x3 matrix.
ist of Topics sheet
There is also a Redo button, just to the right of the Undo button, for
undoing an undo. Its shortcut key is Ctrl+y.
Note that there is a dropdown arrow next to the Undo button. This allows
you to select the action (not necessarily the previous action) to undo. If you
click this dropdown arrow, you will see that Excel remembers a lot of your
most recent actions. Just be aware that if you select , say, the third most
recent action, you will undo this action and the other two most recent
actions, that is, it is cumulative. The same comments apply to the
dropdown arrow next to the Redo button.
Not all actions can be undone. For example, you can't undo adding a
worksheet or deleting a worksheet. (This is a good reason, one of many, for
saving often!) Although it is hard to remember which actions can be undone
and which can't, you can always press Ctrl+z and hope for the best.
Try it! Enter formulas in the gray range above to sum the two numbers to
their left. Then get rid of these formulas with Ctrl+z or the Undo button.
Then bring them back with Ctrl+y or the Redo button.
Undo and Redo buttons
13
37
32
36
4
50
26
5
48
7
15
5
32
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Sales data
Right-Clicking for Context-Sensitive Menus
Month
Right-clicking various items is certainly not new to Excel 2013, but there are Jan-13
now more options than ever. If you want instant context-sensitive menus,
you should always try right-clicking. This almost always leads to a useful Feb-13
menu of options. Mar-13
Apr-13
Try it! Select the sales figures to the right and right-click. Among other
things, this allows you to format the cells. Format these cells as currency May-13
with zero decimals. Jun-13
Jul-13
Try it! Right-click some part of the chart to the right. You will get a menu,
but the menu items will depend on what you selected on the chart. Try Aug-13
right-clicking different parts of the chart to see how the menus change.
Try it! Right-click this text box that you are currently reading. Among other
things, you will get a Format Shape menu item lets you modify the text box
in many ways.
Try it! Right-click the screenshot to the right (which was inserted as a
Picture). Again, you will get a Format Picture menu item lets you modify the
picture in many ways.
Try it! Right-click this worksheet's tab. You will get still another menu. Are
you starting to appreciate how useful right-clicking can be?
Did you notice that when you right-clicked the sales values, you not only
got a menu, but you also got a mini-toolbar above or below the menu? Try
it again and look carefully. There is also a mini-toolbar when you right-click
a chart. Watch for these mini-toolbars when you right-click something. They
don't always appear, but when they do, they provide still one more quick
way to accomplish common tasks.
Sales Sales
3108 4500
3993 4000
1644 3500
3078
3000
1830
2500
3279
3413 2000
1197 1500
1000
500
0
Jan-13 Feb-13 Mar-13 Apr-13 May-13 Jun-13 Jul-13 Aug-13
ul-13 Aug-13
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
http://www.shortcutw
Shortcut Keys http://www.shortcutw
http://www.veodin.com
It is probably fair to say that the world of Excel users is composed of two
groups: mousers and keyboarders. The developer of this tutorial falls into
the mouse group, and this explains why the tutorial might be somewhat
lacking in shortcut key tips. However, there are plenty of you in the
keyboarders group, and you would probably like some more help on
shortcut keys.
Conventions: The plus sign, as in Ctrl+a, means to press both keys at the
same time. Also, an uppercase F followed by a number, such as F12, refers
to one of the "function" keys near the top of the keyboard.
By the way, if you remember the old menu shortcut keys from pre-2007
versions of Excel, such as Alt+e and then d for deleting selected rows or
columns, you can probably continue to use them. Old habits die hard, so
Microsoft kept most of these for backward compatibility. However, they are
not listed here.
Ctrl+Home: go to cell A1
Ctrl+Arrow Key: move in the direction of the arrow to the last nonblank cell
(if the next cell is nonblank) or to the next nonblank cell (if the next cell is
blank)
Page Down or Page Up: move one screen down or one screen up
Ctrl+Home: go to cell A1
Ctrl+Arrow Key: move in the direction of the arrow to the last nonblank cell
(if the next cell is nonblank) or to the next nonblank cell (if the next cell is
blank)
Page Down or Page Up: move one screen down or one screen up
Alt+Page Down or Alt+Page Up: move one screen to the right or one screen
to the left
End: turns "end" mode on, and then arrow keys work just like with
Ctrl+Arrow Keys listed above
Ctrl+a: select the range of data surrounding the active cell, or press twice to
select the entire worksheet
Shift+Arrow Key: extend the selection by one cell in the direction of the
arrow
Ctrl+Shift+Arrow Key: extend the selection to the last cell nonblank cell in
the direction of the arrow
Ctrl+Shift+End: extend the selection to include all used cells below and to
the right of the active cell
Ctrl+c: copy
Ctrl+x: cut
Ctrl+v: paste
Ctrl+Alt+v: open the Paste Special dialog box (if clipboard is nonempty)
Formatting
F4: enter dollar signs for an absolute address (or keep pressing to cycle
through relative/absolute possibilities)
Shift+F3: display the Insert Function dialog box (same as clicking the f x
button)
Miscellaneous
F2: display the formula in a selected cell (instead of looking the Formula
bar)
Alt+Enter: press while entering text in a cell to force a new line (for long
labels)
Cell borders often add a nice formatting touch to a worksheet, but they are
trickier to implement than you might expect. An easy way to add a border is
to select a cell or range of cells and click the Borders dropdown in the Font
group on the Home ribbon. (It's right above the word Font.) The icons in this
group indicate the type of border you will get.
Alternatively, you can select a cell or range of cells, right-click, select Format
Cells, and select the Borders tab to get the dialog box shown to the right.
Then the trick is to select the options in the right order, and it is easy to do it
wrong. Here is how I got the borders for the three ranges to the right.
For Range 1, I clicked the Outline preset to get the basic border. Then I
clicked a line style, a color, and finally the "bottom" border icon to get the
bottom blue border. This last part wouldn't have worked if I had clicked the
"bottom" border icon first and then the line style and color, and this can be a
source of frustration.
For Range 2, I didn't use a preset. I first chose a line style and a color, and
then I clicked the "left," "top," and "right" border icons. With the dialog still
open, I chose another line style and another color, and I then clicked the
"bottom" border icon. As before, I had to select a line style and color first,
before clicking the border icons.
For Range 3, I used both the Outline and Inside presets. Then I chose a line
style and a color, and finally clicked the two "middle" border icons.
An easy way to get rid of any of these borders is to select the range, get into
the Border dialog, and click the None preset. Alternatively, you can do it from
the Borders dropdown on the Home ribbon. You can either select No Border,
or you can select Erase Border. In the latter case, the cursor becomes an
eraser, and you can erase the borders you don't want. Then press Esc to get
out of erase mode.
Try it! Select ranges below the ranges to the right, and format them the same
as those above them. Then get rid of the borders you just created.
List of Topics sheet
Illustration Group on I
Shapes and Pictures
The Illustrations group on the Insert ribbon includes several types of items
you can add to a worksheet. These include a wide variety of shapes, such as
rectangles and arrows. These shapes are quite easy to use. You just click any
of them and then drag it to the location you want.
When a shape is selected, a Drawing Tools Format ribbon appears (see to the
far right). This allows you to change the shape in a wide variety of ways.
Many of these same options appear if you right-click a shape. The best way
to learn the possibilities is to experiment.
Try it! Insert a rectangle and modify it so that it looks like the rectangle to the
right, including the text inside. Then modify the shape of your rectangle so
that it has rounded corners.
One nice feature of shapes is that if you want to use arrows to connect
rectangles, for example, there are "hot spots" on the sides of the rectangles
for connecting. If you start and end the arrows on these hot spots, the arrows
will move with the rectangles when you move the rectangles.
Try it! Draw two or more rectangles and connect them with arrows,
connecting to the hot spots. Then move the rectangles and watch how the
arrows move with them.
The other items in the Illustrations group act similarly, and you can
experiment with them. For example, you can insert an image from a picture
file and then manipulate it with the Picture Tools Format ribbon that appears
when you select the image.
Try it! Each of the screenshots to the right is the image of a picture file. Select
any of them and check the possibilities on the resulting Picture Tools Format
ribbon.
Illustration Group on Insert Ribbon Drawing Tools Format Ribbon for modifying a shape
A cool shape!
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Often you want to insert rows or columns somewhere in the middle of your
worksheet.
Click a row number and drag down as many rows as you want to insert.
Then right-click and select Insert. Alternatively, you can click the Insert
dropdown on the Home ribbon and select Insert Sheet Rows. (Interestingly,
this Insert dropdown is on the Home ribbon, not on the Insert ribbon.)
The rows you insert are inserted above the first row you selected. For
example, if you select rows 8 through 11 and then insert, four blank rows
will be inserted between the old rows 7 and 8.
Try it! Insert blank rows for the data below for Feb, Apr, and May.
You can insert columns in exactly the same way. The keyboard shortcut is
Alt+i and then c.
First, note that deleting a row or column is not the same as clearing the
contents of a row or column—making all of its cells blank. Deleting a row or
column means wiping it out completely.
Click a row number and drag down as many rows as you want to delete. Then
right-click and select Delete. Alternatively, you can click the Delete dropdown
on the Cells group of the Home ribbon and select Delete Sheet Rows.
If you prefer a keyboard shortcut, press Alt+e and then d (e for edit, d for
delete).
Try it! Delete the rows you inserted in the above exercise.
You can delete columns in exactly the same way. In fact, the keyboard
shortcut is still Alt+e and then d.
right-click and select Delete. Alternatively, you can click the Delete dropdown
on the Cells group of the Home ribbon and select Delete Sheet Rows.
If you prefer a keyboard shortcut, press Alt+e and then d (e for edit, d for
delete).
Try it! Delete the rows you inserted in the above exercise.
You can delete columns in exactly the same way. In fact, the keyboard
shortcut is still Alt+e and then d.
You can also hide or unhide rows or columns. The following explains how to
hide or unhide rows. The same directions work for columns.
To hide a group of adjacent rows, click the top row number you want to
hide, hold down the Shift key, and click the bottom row number you want
to hide. This selects the rows you want to hide. (Alternatively, you can drag
the row numbers.) Then right-click and select Hide. Alternatively, you can
click the Hide and Unhide arrow from the Format dropdown in the Cells
group of the Home ribbon, as shown to the right. From there, click on Hide
Rows.
To unhide rows, select the adjacent nonhidden rows. For example, if you hid
rows 69-75, you would select rows 68 and 76. Then right-click and select
Unhide, or use the dialog box to the right.
Again, there are leftover menu item shortcuts for hiding and unhiding:
Try it! Hide any subset of the rows in the data set below. Then unhide them.
Person Age
1 36
2 33
3 49
4 25
5 21
6 46
7 27
8 35
9 22
10 27
11 37
12 36
13 21
14 35
15 39
16 48
17 35
18 38
19 36
20 44
21 34
22 50
23 44
24 41
25 43
26 48
27 29
28 34
29 22
30 28
Hide and Unhide items from Home ribbon
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Worksheets are where you place your data and formulas in Excel. Many people
call them "sheets" but this isn't exactly accurate. Strictly speaking, a worksheet is
a sheet that has rows and columns--a rectangular grid of cells. There is another
kind of sheet, called a chart sheet. This type of sheet has no rows or columns,
only a chart. The discussion here is mainly about worksheets, not chart sheets.
The actions discussed below are things you will do every day, so you need to
know how to do them efficiently.
Renaming a Worksheet
The name of a worksheet appears in its tab at the bottom of the screen.
To rename a worksheet:
Try it! Rename this worksheet as Worksheet Tasks. Then change its name back to
Topic.
In some situations, you might not want the new sheet to be way out to the
right. There is another option. You can right-click a worksheet tab, select
Insert, and select a blank worksheet as the item to add. The new worksheet
will be placed to the left of the tab you right-clicked.
Try it! Create a new worksheet to the left of this one and rename it Practice1.
Selecting One or More Worksheets
You can select one or more worksheets. The active worksheet is the one
you are viewing. Its tab is boldfaced. But others can be selected as well. If
you do anything to the active worksheet, such as format a cell or enter a
value, the same thing is done to all of the selected worksheets. This can
save a lot of time with common labels, formulas, and formatting.
Click the tab of the leftmost of these, hold down the Shift key, and click the
tab of the rightmost of these.
Click the tab of any of them, hold down the Ctrl key, and click the other tabs
you want to select.
When multiple worksheets are selected, one will be active, but the tabs of
the others will also be highlighted, indicating that they are selected. (In
Excel 2013, the active sheet's tab is green; the others are black.) They will
remain selected until you click the tab of some other worksheet. There is
one exception to this. If all of the worksheets are selected, you can click any
other worksheet tab to activate it and deselect all of the others.
Try it! You should already have a Practice1 worksheet. Create several more
new worksheets to its right and rename them Practice2, Practice3, and so
on. Then select them all and enter the label "This is practice" in cell A1 of
the active worksheet, Practice1. By viewing the other Practice worksheets,
you should see that they all have this label in cell A1. Finally, activate the
worksheet you are reading now (Topic). This deselects the Practice
worksheets.
You can delete one or more worksheets. However, if you try to delete all of the
worksheets, Excel will warn you that at least one has to remain.
Select the ones you want to delete, as explained in the previous text box. Then
right-click any of the selected tabs. This brings up a context-sensitive menu,
which has a few options you might want to try. For now, select Delete.
Note that if the worksheets have any contents, you will be asked if you really
want to delete them. Deleting worksheets can be dangerous because it cannot
be undone. So be careful!
which has a few options you might want to try. For now, select Delete.
Note that if the worksheets have any contents, you will be asked if you really
want to delete them. Deleting worksheets can be dangerous because it cannot
be undone. So be careful!
You can also move or copy a worksheet. You can do this in one of two ways:
by dragging tabs or through the Move or Copy menu item. The first way is
easier; the second gives you more options.
Drag the worksheet's tab right or left to the position you want. If you hold
down the Ctrl key while you are dragging, you will make a copy of the
worksheet.
Try it! Move this worksheet to some other position, and then move it back
again. Next, make a copy of this worksheet, just to the right of its current
position. The copy will have the name Topic (2), which you can then rename
if you want. For now, delete the copy.
Right-click the worksheet's tab and select Move or Copy, as shown to the
right. This brings up the Move or Copy dialog that lets you select the Move or Copy menu it
workbook you want to move or copy to, including a new workbook, the
position within that workbook, and whether you want to create a copy. If
you select a different workbook and don't check the latter option, the
worksheet will be removed from the current file; it will move to the other
workbook. So be careful.
Try it! If necessary, create a new worksheet called Practice and enter some
data in it. Then move it to a new workbook. It will disappear from this
workbook and appear in a new one. You can then close the new workbook
without saving to delete it.
Finally, you can hide or unhide a worksheet. For example, you might want to
hide, but not delete, a worksheet that contains technical data used in
formulas in other worksheets. Of course, you might receive such a file, with
formulas you can't figure out because they refer to data on a hidden
worksheet. If you sense that something mysterious is going on, check
whether there are any hidden worksheets!
To hide a worksheet:
To hide a worksheet:
To unhide a worksheet:
Right-click any worksheet's tab. If the Unhide option is disabled, you know
there are no hidden worksheets. (Well, this isn't quite true. See the note
below.) Otherwise, select Unhide. You will see a list of the hidden
worksheets, and you can choose the one you want to unhide.
Unfortunately, if there are several hidden worksheets, you have to unhide
them one at a time; you can't unhide them all at once.
Try it! Hide this worksheet. Then unhide it.
Note: It is possible that there is at least one hidden worksheet even if the
Unhide option is disabled. By using a macro, it is possible to set the status of
a worksheet to "very hidden." Such worksheets can be unhidden only
through another macro. Software companies sometimes create very hidden
worksheets because they know these worksheets would only confuse users,
or because they don't really want users to see their contents.
In pre-2013 versions of Excel, there are two buttons at the lower left corner of
the Excel window for going to the left through the worksheets. The second takes
you to the previous worksheet, and the first takes you the whole way back to
the first (leftmost) worksheet. Similarly, there are two buttons for going to the
right. Starting in Excel 2013, there are only two buttons, one for going to the
previous worksheet and one for going to the next worksheet.
Fortunately, if you press the Ctrl key and one of these newer buttons, it takes
you to the first or last worksheet. This can save plenty of scrolling if you have
dozens of worksheets, so it is definitely a tip worth remembering!
New Sheet button
Move or Copy menu item Move or Copy dialog box
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The usual situation is that you have a data set such as the one to the right. If
you want to perform a simple sort on any of its columns, select any single Person
data cell in this column and click the A-Z or the Z-A button. You can find 1
these buttons under the Sort & Filter dropdown on the Home ribbon, and 2
they are also on the Data ribbon. But because they are used so often, you
probably ought to add them to your Quick Access Toolbar so that they are 3
always available. 4
5
Try it! Sort on any of the columns to the right, either in A-Z or Z-A order.
Note that when you sort on any column such as Salary, the other columns 6
change accordingly. That is, each row remains intact. Of course, this is the 7
behavior you would expect and want. 8
You can undo a sort, but just in case, it is often nice to have an "ID" column 9
with consecutive integers, 1, 2, 3, etc. This is the role of the Person column 10
in this data set. No matter how many sorts you do, you can return to the
original sort order by sorting (A-Z) on Person. 11
12
13
14
15
16
17
18
19
Sorting the Correct Range
20
The above instructions said to select a single cell before you click A-Z or Z-A. If 21
you select a range, such as the entire State column, and then click A-Z or Z-A, you 22
will be asked if you want to expand the selection (meaning to the full data set) or
continue with the current selection. You almost always want to expand the
selection. If you continue with the current selection, only the Salary values will
be sorted, and the sorted salaries will not correspond to the right people.
Excel gives you many more sort possibilities with its Custom Sort item under
the Sort & Filter items (on both the Home and Data ribbons). When you click
either of these, you seel the Custom Sort dialog box to the right where,
among other things, you can add levels. The data set above illustrates why
you might want to do this. Suppose you want to sort so that all of the
females are at the top. Then within each gender, you would like to sort in A-Z
order on State. Then if there are multiple people of a given gender in the
same state, you would like to sort them in decreasing order of Salary. This is
possible only with a custom sort with three levels: first Gender, then State,
then Salary. The correct settings for this sort are shown to the right.
the Sort & Filter items (on both the Home and Data ribbons). When you click
either of these, you seel the Custom Sort dialog box to the right where,
among other things, you can add levels. The data set above illustrates why
you might want to do this. Suppose you want to sort so that all of the
females are at the top. Then within each gender, you would like to sort in A-Z
order on State. Then if there are multiple people of a given gender in the
same state, you would like to sort them in decreasing order of Salary. This is
possible only with a custom sort with three levels: first Gender, then State,
then Salary. The correct settings for this sort are shown to the right.
Try it! Sort the above data set as explained in the previous paragraph. Check
that it works as intended.
Try it again! This time have the three levels be Salary, then State, then
Gender. Do you see the difference? There are no ties on Salary, so once
Salary is sorted, no more sorting takes place. In general, the lower levels
apply only when there are ties in the levels above them.
Grade
Sorting Text A+
A
Sorting columns of text can be tricky, especially when non-alphabetic symbols
are present. For example, sort in A-Z order on the Grade column to the right. A-
Is this what you expected? Probably not. (See the next text box for a fix.) B+
B
What about the Name column to the right, where some names are upper
case and some are lower case? By default, the sort order is case-insentive, B-
that is, case doesn't matter. Try sorting on Name with the A-Z button. They C+
are indeed sorted in alphabetical order, except that the Name label got sorted C
too. (Press Ctrl+z to undo this sort.) To prevent the label getting sorted, bring
up the Custom Sort dialog box and check the "My data has headers" option. C-
D+
While you are in Custom Sort dialog box, note the Options button at the top.
One option is to check or uncheck the "Case sensitive" box. It is probably D
unchecked by default. However, check it and then sort on the Name column D-
to the right. It is still sorted in alphabetical order, ignoring case. This appears F
to be a bug in Excel, or at least it's unexpected.
Order
Creating a Custom List for Sorting 1
2
Sometimes you want to sort in a "natural" order, such as months in a year 3
(Jan, Feb, etc.) or days of the week (Sun, Mon, etc.). You can do this with a
custom list. To get to this option, bring up the Custom Sort dialog box, click 4
the Order dropdown, and select Custom List. (You can also get to the Custom 5
Lists dialog box from the Advanced group in Excel Options.) As shown to the
right, you will see several custom lists built into Excel: the months of the 6
year and the days of the week, either three-letter abbreviations or written
out. You can also click NEW LIST and enter your own custom list. This new
custom list is remembered on your PC for later uses.
You will probably create custom lists for sorting only for lists you use
Sometimes you want to sort in a "natural" order, such as months in a year
(Jan, Feb, etc.) or days of the week (Sun, Mon, etc.). You can do this with a
custom list. To get to this option, bring up the Custom Sort dialog box, click
the Order dropdown, and select Custom List. (You can also get to the Custom
Lists dialog box from the Advanced group in Excel Options.) As shown to the
right, you will see several custom lists built into Excel: the months of the
year and the days of the week, either three-letter abbreviations or written 7
out. You can also click NEW LIST and enter your own custom list. This new 8
custom list is remembered on your PC for later uses.
9
You will probably create custom lists for sorting only for lists you use 10
frequently. For example, if you are an instructor and typically have a list of 11
possible grades as in the Grade range above, you might want to create a
custom list with the grades in the "natural" order. But if this is a list you need 12
only once, it is easier to enter the grades manually in the order you want 13
them. 14
Try it! Sort on Day, using the built-in custom list. Then create a new custom 15
list with items Morning, Afternoon, Evening, in this order, and sort on Time 16
using this custom list.
17
18
19
20
21
22
23
24
25
A-Z and Z-A buttons on Data ribbon
Page tab on Page Setup dialog box Sheet tab on Page Setup dialog box
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
1. The dollar signs are relevant only for the purpose of copying or moving;
they have no inherent effect on the formula itself. For example, the
formulas =5*B3 and =5*$B$3 in some cell produce exactly the same result.
Their difference is relevant only if you want to copy the formula to some
range.
2. There is never any need to type the dollar signs. You can do it with the F4
key. This is explained in more detail below.
Enter a cell reference such as =B3 in a formula. Then press the F4 key.
In fact, if you press the F4 key repeatedly, you cycle through the possibilities:
B3 (neither row nor column fixed), then $B$3 (both column B and row 3
fixed), then B$3 (only row 3 fixed), then $B3 (only column B fixed), and back
again to B3.
Try it! Enter the appropriate formula in cell L35 and copy across to O35. (Scroll
to the right to see the answer.)
Units sold
50 100 150 200
Unit price $3.25
$3.50
$3.75
$4.00
$4.25
Fixed cost $50
Variable cost $2
Units sold
50 100 150 200
Unit price $3.25 $162.50 $325.00 $487.50 $650.00
$3.50 $175.00 $350.00 $525.00 $700.00
$3.75 $187.50 $375.00 $562.50 $750.00
$4.00 $200.00 $400.00 $600.00 $800.00
$4.25 $212.50 $425.00 $637.50 $850.00
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Calculation options on
Calculation Options
You might not even think about it, but Excel is an amazing calculation
engine. Not only does it calculate a formula as soon as you enter it, but it
recalculates everything that is affected by any changes you make in any cell
or range of any worksheet. This behavior is called Automatic recalculation,
and it is the behavior you are accustomed to in Excel.
Click the Calculation Options dropdown from the Formulas ribbon and
select any of the three options shown to the right.
With the Automatic Except for Data Tables setting, data tables will not
recalculate until you force it to. This is useful because data tables can
sometimes take a long time to recalculate. (Data tables are discussed in
another topic of this tutorial.)
Forcing a Recalculation
The easiest and most common way to force a recalculation is to press the F9 key.
This is often called the "recalc" key. You can also click the Calculate Now button
or the Calculate Sheet button, both on the Formulas ribbon (see the above
screenshot). Calculate Now recalculates all formulas in the workbook. Calculate
Sheet recalculates only the formulas in the active worksheet.
Inheritance
1. Launch Excel and, if necessary, open a new blank workbook. Change the
Calculation setting to Manual, save this file as CalcTest1.xlsx, and close the
Inheritance
1. Launch Excel and, if necessary, open a new blank workbook. Change the
Calculation setting to Manual, save this file as CalcTest1.xlsx, and close the
file (but keep Excel open).
2. Open a new blank workbook. Its Calculation setting will be Manual,
inherited from CalcTest1. Change the setting to Automatic, save this file as
CalcTest2.xlsx, close the file, and close Excel.
3. Launch Excel again, and open CalcTest1. Its Calculation setting will still be
Manual. Then open CalcTest2. Even though this file was saved with the
Automatic setting, its setting now will be Manual. Save CalcTest2, and then
close both files and Excel.
4. Launch Excel once more, and open CalcTest2. Its Calculation setting will
now be Manual.
The upshot of all of this is that if you change the Calculation setting to a
non-Automatic setting for one file, later files you open in this session will
inherit the non-Automatic setting, which can produce unexpected results.
(You'll be asking, Why won't anything recalculate??) Worse yet, if you save
any of these later files, their non-Automatic setting will be saved, which will
likely cause unexpected results down the road.
AutoSum button on Ho
Using AutoSum to Create Row and/or Column Sums
The SUM function is used so often to sum across rows or columns that a
button (the S button) is available to automate the procedure. This button is
on the Home ribbon and the Formulas ribbon, as shown to the right.
To illustrate its use, suppose you have a table of numbers in some AutoSum button on Fo
rectangular range. You want row sums to appear to the right of the range,
and you want column sums to appear below the range. This is easy.
Select the range(s) where you want the sums to appear and click the
AutoSum button.
Note that if you select multiple cells, you get the sums automatically. If you
select a single cell, such as when you have a single column of numbers to
sum, you are shown the sum formula “for your approval,” and you have to
press Enter to actually enter it.
Try it! Use the AutoSum button to fill in the row and column sums in the gray 51
cells to the right, including the darker gray cell which should show the sum 37
of all the data.
13
73
38
Note that there is a dropdown arrow next to the AutoSum button. If you want a
sum, you can click the S button directly. However, you can click the dropdown
arrow for other options, including Average, Count Numbers, Max, and Min, as
shown to the right.
AutoSum button on Home ribbon
94 15 7
6 2 41
83 29 88
64 46 32
11 3 80
Range names are used for one basic purpose: to make your formulas more
readable. After all, which formula do you prefer: =B20-B21 or =Revenue-
Cost? Efficient use of range names takes some experience, but this
worksheet provides a few useful tips.
A range name can be applied to a single cell or to any range of cells. There
are a few rules for the names you can use. The most important are that (1)
the names cannot include a few "illegal" characters, the most common being
spaces, and (2) they can't look like cell addresses. For example, DAN37 is
illegal because DAN37 is a cell address.
You can definitely go overboard in the use of named ranges, and you can err
in the other direction by refusing to use them. You should use some
discretion (and possibly company policy) when deciding how extensively to
use range names.
Range names have been available for many years, but they are more
prominent in Excel 2007 and later versions. Their functionality is in the
Defined Names group, right in the middle of the Formula ribbon, as shown to
the right.
The easiest and best-known way to name a range is to use the Name box, just
to the left of the Formula bar. This is shown to the right, where the Name box
originally contains a cell address.
Select a range you want to name, which can be a single cell, click in the Name
box, type a range name, and press Enter. Don't forget to press Enter after
typing the range name or the name you type won't "stick." 71
15
Try it! Name the gray range to the right Data. 14
The Name box is also useful for finding named ranges. To do so, click the 40
dropdown arrow in the Name box to see a list of all range names, and click one 28
of them. This will select the corresponding range. 41
28
You get much more control of named ranges by clicking the Name Manager on
the Formulas ribbon. This displays the dialog box to the right. It shows a list of
Name Manager dialog
Using the Name Manager
You get much more control of named ranges by clicking the Name Manager on
the Formulas ribbon. This displays the dialog box to the right. It shows a list of
all range names in your workbook, the values in these ranges, and the
corresponding range addresses. You can select any range name and then Edit or
Delete it. (Delete doesn't delete the contents of the range; it only deletes the
range name.) You can also click the New button to create a new named range.
In this case, you need to supply a name and an address.
Try it! Rename the above gray range of numbers MyData. Then delete the
MyData range name. Then use the Name Manager to create the Data range
name again.
Suppose you have the labels such as Revenue, Cost, and Profit in some range,
and you would like the adjacent cells (which will contain the values of
revenue, cost, and profit) to have these range names. There is a very quick Create Names from Se
way to do this.
Select the range consisting of the labels and the cells to be named. Then click
the Create from Selection button in the Defined Names group on the
Formulas ribbon. In the resulting dialog box, make sure the appropriate
option (in this case, Left Column) is checked, and click OK. Excel tries, usually
successfully, to guess where the labels are that you want to use as range
names. You can always override its guess.
Try it! Name each of the colored ranges to the right (but not the totals) with
the labels above them. You will notice that Excel guesses Top row and Left
column. You can uncheck Left column unless you want the rows to be named
by the month names.
Select Apply Names from the Define Name dropdown in the Defined Names
group, as shown to the right. Then select all range names that you want to
apply to any cell formulas. For example, if you select all range names in the
list, all formulas that reference any of these named ranges will change to
do it in the opposite order. That is, you enter a formula using cell addresses,
such as =B20-B21, and later you name B20 as Revenue and B21 as Cost. The
formula does not change to =Revenue-Cost automatically. However, you can
make it change, and hence become more readable, as follows.
Try it! You should now have the range names UnitsSold and Revenue for the
red and orange ranges to the above right. Apply these to all formulas that
reference them, that is, to the SUM formulas in darker red and orange cells.
If you have many range names, it is often useful to show a list of them and the
range addresses they apply to. This is easy.
To paste a list of all range names on a worksheet:
Select a cell with plenty of blank space below it, select the Use in Formula
dropdown in the Defined Names group, and click the Paste Names option, as
shown to the right.
Try it! Paste a list of all range names, starting in the gray cell to the right.
Defined Names group in Formulas ribbon
31 9 69 5
74 46 84 27
49 25 38 83
43 20 75 83
72 30 92 75
56 90 89 73
81 43 81 61
Name Manager dialog box
There are times when you will receive a spreadsheet from a colleague and
you will have absolutely no idea how its various cells are related. Where are
the constants? Where are the formulas? How do the formulas incorporate
the constants? How do the formulas build upon one another? In these very
common situations, Excel's auditing tools can be a huge help. They let you
find the precedents and dependents of any particular cell, defined as
follows.
1. The precedents of any cell that contains a formula are all cells referenced
by the formula in that cell. (If a cell doesn't contain a formula, it doesn't
have any precedents.)
2. The dependents of any cell are all cells with formulas that reference that
cell.
The Formula Auditing group on the Formulas ribbon, shown to the right,
has buttons for tracing precedents and dependents. If you select a cell and
click Trace Precedents, you will see arrows from all of the cell's precedents
to it. If you click Trace Dependents, you will see arrows from the cell to all of
its dependents. You can then click the Remove Arrows button to get rid of
these arrows.
You can do this multiple times. For example, if you show a cell's dependents
and then click Trace Dependents again, you will see all of the dependents'
dependents.
Try it! In the example to the right, a company sends catalogs to customers,
and this costs money. Unfortunately, only a small percentage of these
customers responds by purchasing something. Use the formula auditing
buttons to learn what is related to what. This should help you understand
the business model and how it has been implemented in Excel.
Note that many spreadsheets in real businesses have cells that aren't
related to anything. That is, they have no precendents or dependents.
Typically, this is not good. It could mean that the constants in these cells are
"hard-coded" (entered as constants) in one or more formulas, which is
always a bad practice. It could also mean that these constants have been
incorporated in the model with "mental arithmetic" rather than formulas,
another bad practice. See if you can find examples of such "dangling"
constants in the example to the right. Then incorporate them with
appropriate formulas.
Keyboard Shortcuts for Tracing Precedents and Dependents
If you like keyboard shortcuts, these are a few you will really appreciate.
Instead of using arrows to indicate precedents and dependents, these
shortcuts select cells that are precedents and dependents.
Ctrl+Shift+[ : select all precedents, direct and indirect, of the selected cell
Ctrl+Shift+] : select all dependents, direct and indirect, of the selected cell
Try it! Use these keyboard shortcuts in the above model to better understand
the relationships.
Adding a Watch
The Formula Auditing group also contains a Watch Window button. You can
click it to add a watch on any cell (or cells). The screenshot to the right shows
how a watch was added to the profit cell on this worksheet. This is particularly
useful for large models (unlike the small model here) where you can't see your
inputs and outputs all at once on the same screen. Once this watch is added,
you keep the window open and enter values for various inputs to see how
profit changes. If it doesn't change at all, or if it doesn't change in the way you
expect, you can examine your formulas for errors.
Try it! Add watches on total revenue, total cost, and profit. Then watch how
they change in the Watch Window as you change inputs such as average
revenue per order or the response rate.
Showing Formulas
A common wish is to see all of the formulas, not their values. This is easy. Just
click the Show Formulas button in the Formula Auditing group. This button is
actually a toggle between values and formulas. Equivalently, you can use
keyboard shortcut Ctrl+~.
Try it! Click the Show Formulas button to see all formulas in the model. Then
click this button again to show the values. Note that the columns expand when
you show formulas, but fortunately, they revert back to their original widths
when you show values.
keyboard shortcut Ctrl+~.
Try it! Click the Show Formulas button to see all formulas in the model. Then
click this button again to show the values. Note that the columns expand when
you show formulas, but fortunately, they revert back to their original widths
when you show values.
List of Topics sheet
Profit model
Unit printing cost $0.10
Unit mailing cost $0.15
Variable cost of printing and mailing $0.25
Number mailed 100000
Response rate 3%
Number of responses 3000
Watch window
Introduction to Charts
Nothing tells a story better than a well-designed chart, and Excel provides a
huge number of charting possibilities. In fact, whole books have been
devoted to Excel charts. It is impossible to cover all of the possibilities here,
but the files in this group illustrate how to create and modify basic charts
quickly and easily.
You create a chart by selecting one of many options from the Charts group
on the Insert ribbon. (Several of these chart types, such as histogram and
waterfall, are new to Excel 2016.) Then once you have a chart and select it,
two Chart Tools ribbons, Design and Format, become available. Also, three
handy buttons appear to the right of the chart for making modifications.
Rather than read long chapters on charts, it is best to experiment. But here
are a few basics.
1. To create a chart, use the Insert ribbon. It has a Charts group with
buttons for Column, Line, Pie, Bar, Area, Scatter, and Other Charts (see to
the right). Each button has a dropdown list for the various subtypes.
Starting in Excel 2013, there is even has a Recommended Charts button for
guessing the most appropriate type of chart for your specific data.
2. Once you have a chart and then select it you get two Chart Tools tabs,
Design and Format, shown to the right. The corresponding ribbons have
plenty of buttons for modifying an existing chart. Probably the most
important of these is the Select Data button on the Design ribbon. It lets
you edit the data range(s) the chart is based on. Of course, you can
experiment with the other buttons, and you can also experiment by right-
clicking various parts of a chart to see many possibilities.
List of Topics sheet
Probably the easiest way to create a chart, based on a given data set, is to select
the data set, including the data to be charted and the labels for the horizontal
axis, if any, and select one of the chart types from the Insert ribbon. You will
probably want to modify the resulting chart, but this usually provides a good
start.
The data set to the right is typical. The goal is to create a column chart of
monthly sales, so the entire gray range to the right was selected, including the
labels in the top row, and a column chart of the first subtype was chosen from
the Insert ribbon. The only change that was then made to the chart was to
delete the legend. (Even this is not necessary in Excel 2013. It doesn't add a
legend for a single series.) Excel guessed correctly that it should chart one
series, Sales, and that it should use the dates in column K as labels for the
horizontal axis.
Here is another example. The data set to the right includes monthly sales of two
products, and the goal is to create a line chart that contains both series. In this
case, the entire gray range was selected, and a line chart with markers was chosen
from the Insert ribbon. This time, a legend is appropriate. However, there was no
title above the chart by default, so the one shown was entered (by selecting the
title and then typing a new title in the formula bar).
The most important concept for charts is a series. Every Excel chart contains one
or more series. In the first chart above, there is one series, Sales. In the second
chart above, there are two series, Sales1 and Sales2. Typically, each series is a
column of data, with a label at the top. However, series are sometimes in rows, as
in the example to the right. Again, you can select the entire gray range and insert
a line chart. Excel guesses correctly that the data series are in rows, not columns.
But what if it makes the wrong guess? See the next example.
in the example to the right. Again, you can select the entire gray range and insert
a line chart. Excel guesses correctly that the data series are in rows, not columns.
But what if it makes the wrong guess? See the next example.
Switching the Roles of Rows and Columns and Changing the Chart Type
The data set to the right contains sales data for four products in six regions.
You can select the entire gray range and insert a line chart. But what are the
series? By default, Excel creates a line for each product, with the region labels
on the horizontal axis. That is, it guesses that the columns are the series.
Suppose you would rather have the rows as the series, that is, you would
rather have a line for each region. This is easy.
Select the chart and click the Switch Row/Column button on the Chart Tools
Design ribbon.
Try it! Create a column chart of the first subtype for the monthly data in the
gray range to the right, where each series corresponds to a time series for a
particular product.
Sometimes you change your mind and want to have another chart type.
Select the chart and click the Change Chart Type button on the Chart Tools
Design ribbon.
Try it! Change the column chart you just created to a line chart. Make sure
each series still corresponds to a product.
Sometimes you have two series of very different magnitudes that you want to
plot on a single chart. If you use the same vertical axis for both series, the one
with the smaller magnitudes will be swamped by the other series; it will barely
show up. However, you can plot either series with a secondary axis, which
appears to the right of the chart.
It is actually very easy. The chart to the right plots both sales series on a single
vertical axis, so the much smaller Sales1 series hugs the horizontal axis. To
Using a Secondary Axis for a Second Series
Sometimes you have two series of very different magnitudes that you want to
plot on a single chart. If you use the same vertical axis for both series, the one
with the smaller magnitudes will be swamped by the other series; it will barely
show up. However, you can plot either series with a secondary axis, which
appears to the right of the chart.
It is actually very easy. The chart to the right plots both sales series on a single
vertical axis, so the much smaller Sales1 series hugs the horizontal axis. To
create a secondary axis, right-click the series you want on the secondary axis,
select Format Data Series, and select the Secondary Axis option.
Try it! Using the chart to the right, put the Sales1 series on a secondary axis.
Note: You can do this with multiple series, but it is most common when
plotting only two series. If there are more than two series and you assign at
least one of them to a secondary axus, it is difficult to tell which series goes
with which axis.
By selecting the appropriate data and then inserting a chart, you usually get
what you want. But suppose you create a chart and it doesn't chart the right
data. You can either delete this chart and start over, or you can modify the
data series.
Select the chart and click the Select Data button on the Chart Tools Design
ribbon. This brings up the Select Data Source dialog box shown to the right,
with the series charted on the left and the data used for the horizontal axis
labels on the right. You can then edit any of these.
Try it! The line chart to right was created by selecting the gray range to the
right, without the labels in the left column or the top row. There are three
problems: (1) the months should be labels on the horizontal axis; (2) the two
"junk" series shouldn't be part of the chart; and (3) the two sales series should
be named by the Sales1 and Sales2 labels in the top row. Open the Data Series
dialog box and fix these problems.
Scatter Charts
One chart type that works a bit differently from the others is the scatter chart.
This type of chart is useful for detecting relationships between two variables,
such as height and weight in the data set to the right.
To create the scatter chart, you can select the gray range to the right and
insert a scatter chart of the first subtype. You can then change the title and
add horizontal and vertical axis titles, as shown. (Excel 2013 doesn't add the
Scatter Charts
One chart type that works a bit differently from the others is the scatter chart.
This type of chart is useful for detecting relationships between two variables,
such as height and weight in the data set to the right.
To create the scatter chart, you can select the gray range to the right and
insert a scatter chart of the first subtype. You can then change the title and
add horizontal and vertical axis titles, as shown. (Excel 2013 doesn't add the
legend that was added automatically in previous versions of Excel.) If you then
open the Data Series dialog box by clicking the Select Data button, you will see
that there is one series, Weight. However, if you click the Edit button for this
series, you will see that there is a Y-series and an X-series.
By default, when you select two columns for a scatter chart, the data in the
rightmost column, in this case Weight, is the Y-axis series, and the other is the
X-axis series. If you want them reversed, you have to go through the Edit
Series dialog box.
Try it! Starting with the scatter chart to the right, change it so that Height is on
the vertical axis and Weight is on the horizontal axis. (If you created axis titles,
you will have to change them manually.)
st of Topics sheet
Month Sales
Jan-13 $8,627 Sales
Feb-13 $5,343 $10,000
Mar-13 $6,244 $9,000
Apr-13 $9,451 $8,000
May-13 $6,698 $7,000
Jun-13 $6,752 $6,000
Jul-13 $5,985 $5,000
Aug-13 $5,586 $4,000
Sep-13 $8,476 $3,000
Oct-13 $9,191
$2,000
Nov-13 $7,242
$1,000
Dec-13 $8,277
$0
Jan-13 Feb-13Mar-13Apr-13May-13Jun-13 Jul-13 Aug-13Sep-13 Oct-13 Nov-13Dec-13
Sales1 Sales2
$10,000
$8,000
$6,000
$4,000
$12,000
$10,000
$8,000
$6,000
$4,000
$2,000
$0
Jan-13 Feb-13Mar-13 Apr-13May-13 Jun-13 Jul-13 Aug-13 Sep-13 Oct-13 Nov-13 Dec-13
Sales1 Sales2
$600,000
$400,000
Monthly Sales of Two Products
$1,200,000
$1,000,000
Sales1 Sales2
Month Junk1 Junk2 Sales1 Sales2 Select Data Source dialog box
Jan-13 29 27 $2,625 $4,139
Feb-13 74 23 $1,776 $4,955
Mar-13 78 59 $2,537 $2,379
Apr-13 6 12 $4,360 $4,631
May-13 69 2 $3,636 $2,413
Jun-13 62 3 $2,135 $4,187
6000
5000
4000
3000
2000
1000
0
1 2 3 4 5 6
200
150
Weight
300
4 63 162 250
5 63 164
200
6 65 168
7 70 175
150
8 72 199
9 72 215 100
10 76 241
50
0
58 60 62 64 66 68 70 72 74 76
-13Sep-13 Oct-13 Nov-13Dec-13
Two Products
Sales2
Two Products
Two Products
3 3 13 13 3 13 13
l- 1 g- p- ct
-1 v- c-
Ju A u S e O N o De
Sales2
ht
ht
70 72 74 76 78
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Chart Types
When you create a chart in Excel, you have to choose the chart type, and
there are plenty to choose from. The most common types, the ones you have
probably used, are column charts, line charts, pie charts, and scatter charts.
There are also several new types of charts introduced in Excel 2016 that you
should be aware of. Of course, the appropriate chart type depends on the
type of data you have. For example, line charts are especially useful for time
series data, and scatter charts are useful for exploring relationships between
two columns of data.
This topic briefly explores the various chart types. Based on the information
provided here, you can then experiment with your own data. Just be aware
that it is easy to change the chart type once you have created a chart. Just
select the chart, click the Change Chart Type button on the Chart Tools
Design ribbon, and choose a chart type.Also, you can modify an existing
chart of a given type in an endless number of ways.
Before proceeding, note that when you select your data, you can always click
the Recommended Charts button on the Insert ribbon. This suggests chart
types that might be appropriate for your data, and you can select any of
these.
Column charts (vertical bars) or bar charts (horizontal bars) are useful for
breaking down numeric variables by categories. The example to the right is
typical, where each bar shows the sales for some region. If you have two or more
series, such as Q1 Sales, Q2 Sales, and so on, you can try any of the 2-D types.
However, we don't recommend the 3-D types. Granted, the latter are fancier, but
they often obscure the data. In general, we recommend keeping it simple (and
this goes for the other chart types discussed below as well).
Line Charts
Line charts are especially useful for time series data. The example to the right
shows how monthly sales have changed during a given year. We particularly like
the line chart with markers (the fourth option in the top row), although you can
experiment with the many different options.
Pie Charts
Pie charts are ubiquitous, appearing in magazines, newspapers, and all over the
Web. They play the same roll as column or bar charts for breaking down data by
categories. However, we prefer column or bar charts to any of these "circular"
charts. It is sometimes hard to accurately gauge the relationships between the
various pieces of the pie. For example, is one piece twice as large as another;
three times as large; or what? These comparisons are more obvious in a column
or bar chart.
A special type of scatter chart, a bubble chart, allows you to add a third
dimension. The bubble chart to the right sizes each bubble in proportion to the
family's salary. To create it, you can start with a regular scatter chart, then
change it to a bubble chart, click the Select Data from the Chart Tools Design
ribbon, and enter the range for the bubble sizes.
Histograms and Box-Whisker Charts (introduced in Excel 2016)
Box and Whisker charts are useful for comparing the distributions of some
variable across two or more groups. The example to the right compares
salaries of males and females. The height of each box extends from the first
to the third quartiles (the middle half of the data), the line inside the box is
the median, the x inside the box is the mean, and the lines from the box
indicate the lows and highs of the data. (More precise definitions can be
found in statistics books.) This particular chart clearly indicates that male
salaries tend to be higher and more spread out than female salaries.
A special type of histogram is the Pareto chart (the second button in the top
row of options). It is useful for showing the number, and cumulative
number, of "events" from different causes. The example below and to the
right shows the number of failures from various causes. The bars in a Pareto
chart always decrease from left to the right, so that the most likely causes
are to the left.
Hierarchy Charts (introduced in Excel 2016)
The two chart types in this category, Treemap charts and Sunburst charts, are
used to break down a numeric variable by categorical variables. The example to
the right breaks down average salary by gender and state. You can use these
"fancy" charts if you like, but we prefer simpler charts such as column charts to
show the comparisons.
A waterfall chart is useful for showing changes, usually over time, from some
initial value. The example to the right shows how a company's monthly cash
balances have changed over the year, starting with a balance of $50,000.
This group also includes stock charts, which are useful for showing the
Waterfall Charts (introduced in Excel 2016)
A waterfall chart is useful for showing changes, usually over time, from some
initial value. The example to the right shows how a company's monthly cash
balances have changed over the year, starting with a balance of $50,000.
This group also includes stock charts, which are useful for showing the
movement of stock prices over time.
Combo Charts
A combo chart lets you graph two or more series with different chart types. The
example to the right, using the default options for the first combo chart type, uses
a column chart for 2015 sales and a line chart for 2016 sales. Of course, you can
then change either of these chart types.
You can try these chart types if you like, but we don't recommend them. If your
goal is to explain the data in the clearest possible way -- and this should be your
goal! -- then some other chart type is almost surely a better option.
List of Topics sheet
Region Sales
North $50,000 Sales
South $90,000 $100,000
$90,000
East $30,000 $80,000
West $80,000 $70,000
$60,000
$50,000
$40,000
$30,000
$20,000
$10,000
$0
North South E
Sale
West
East
South
North
South
North
Month Sales
Jan $80,000 Sale
Feb $70,000 $200,000
Mar $90,000 $180,000
$160,000
Apr $120,000
$140,000
May $140,000 $120,000
Jun $160,000 $100,000
Jul $180,000 $80,000
Aug $190,000 $60,000
$40,000
Sep $130,000
$20,000
Oct $110,000 $0
Nov $70,000 Jan Feb Mar Apr May Ju
Dec $60,000
Region Sales
North $50,000 Sales
South $90,000
East $30,000
West $80,000
Culture Sports
$1,020 $990 Expenses on Sports Vs Exp
$1,100 $460 ture
$900 $780 $2,000
$1,000 $860 $1,800
$1,600
$900 $1,390
$1,400
$820 $1,880 $1,200
$1,340 $710 $1,000
$1,250 $680 $800
$1,190 $1,220 $600
$400
$640 $1,480
$200
$900 $820 $0
$710 $1,080 $600 $700 $800 $900 $1,000 $1
Gender State Avg Salary This chart isn’t available in your version
Female California $81,400
Female Indiana $62,000 Editing this shape or saving this workboo
permanently break the chart.
Female Pennsylvania $59,900
Male California $97,500
Male Indiana $45,200
Male Pennsylvania $45,900
Sales
Sales
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Sales
his shape or saving this workbook into a different file format will
ntly break the chart.
his shape or saving this workbook into a different file format will
ntly break the chart.
rt isn’t available in your version of Excel.
his shape or saving this workbook into a different file format will
ntly break the chart.
his shape or saving this workbook into a different file format will
ntly break the chart.
his shape or saving this workbook into a different file format will
ntly break the chart.
his shape or saving this workbook into a different file format will
ntly break the chart.
rt isn’t available in your version of Excel.
his shape or saving this workbook into a different file format will
ntly break the chart.
Monthly Sales
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Once you create a chart and ensure that it charts the correct series, you are
usually still not finished. Just about everything you see on the chart can be
modified to suit your taste or tell the story better. Here are some, but
certainly not all, of the changes you can make:
To make these or other changes, you can use the buttons on the Chart Tools
ribbons, or you can right-click the part of the chart you want to change to
get a context-sensitive menu. From there, it is a matter of experimenting. It
would be a waste of your time to read about all of the possibilities. Your
time would be better spent trying things, as in the following exercise.
Try it! The top chart to the right was created by selecting the gray data
range to the right and inserting a scatter chart of the first subtype. Then it
was modified to produce the bottom chart. Repeat this exercise by creating
the default scatter chart and then modifying it to look like the finished
version.
If you have trouble, particularly with the March data label, watch the
corresponding video of this topic. Note that this was done in Excel 2013,
where the user interface is different from previous versions of Excel.
Clearly, you can spend a lot of time modifying a chart. Sometimes it is time
well spent, and sometimes it isn't. You have to use common sense. The best
advice is: Make sure it looks professional, make sure it tells the intended
story clearly, and keep it simple! Usually, simple and uncluttered charts look
best and tell the story best.
List of Topics sheet
Sales1 Sales2
$8,627 $23,919 Sales2
$5,343 $19,507 $40,000
$6,244 $34,377
$35,000
$9,451 $30,285
$6,698 $19,673 $30,000
$35,000 March
Product 2 ($1000s)
$30,000
$25,000
$20,000
$15,000
00 00 00 00 00 00 00 00 00 00 00
0
,0 ,5 ,0 ,5 ,0 ,5 ,0 ,5 ,0 ,5 0,
$5 $5 $6 $6 $7 $7 $8 $8 $9 $9 $1
Product 1 ($1000s)
March
0 $9,500 $10,000
0 00 0
00 ,5 00
$9 10,
$
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Select the chart and click the Move Chart button on the Chart Tools Design
ribbon (see below). You can then choose from the above two options.
Try it! Create a chart on this worksheet using the data to the right and then
move this chart to a separate chart sheet. (This chart sheet will have a name
like Chart1, but you can rename it.) Then move the chart back to this
worksheet. Note that when you move the chart back to this worksheet, the
chart sheet will disappear.
Overlapping Charts
Some users like to create several charts on the same worksheet and cascade
them, as shown to the right. The problem with this is that only the "front"
chart is totally visible. To see all of the charts, you have three options.
1. You can bring one to the front or send one to the back. To do so, right-click
either chart and select Send to Front or Send to Back. Note that it isn’t
enough to select the one in the back. For example, if you select the Revenue 1
chart to the right, you still won't see it.
3. You can move each chart to its own chart sheet, as explained in the text box
above.
Try it! Use each of these three methods on the two charts to the right. Finish
by putting them back to the cascading positions you currently see.
2. You can move them around so they don’t overlap.
3. You can move each chart to its own chart sheet, as explained in the text box
above.
Try it! Use each of these three methods on the two charts to the right. Finish
by putting them back to the cascading positions you currently see.
List of Topics sheet
Month Sales
Jan-13 $8,627
Feb-13 $5,343
Mar-13 $6,244
Apr-13 $9,451
May-13 $6,698
Jun-13 $6,752
Jul-13 $5,985
Aug-13 $5,586
Sep-13 $8,476
Oct-13 $9,191
Nov-13 $7,242
Dec-13 $8,277
$0
13 13 r-1
3
r-1
3 13 13 l- 1
3 13 13
n- b- y- n- Ju g- p- t-
J a F e M
a A p
M
a J u A u S e Oc
$3,000
$300,000
$2,000
$1,000 $200,000
$0
Jan-13$100,000
Feb-13Mar-13Apr-13May-13Jun-13 Jul-13 Aug-13Sep-13 Oct-13 Nov-13Dec
$0
13 13 r-1
3
r-1
3 13 13 l- 1
3 13 13
n- b- y- n- Ju g- p- t-
J a F e M
a A p
M
a J u A u S e Oc
nue2
13 3 13 13 3 13 13
l- 1 g- p- t-1 v- c-
Ju A u S e O c
N o De
-13Sep-13 Oct-13 Nov-13Dec-13
13 3 13 13 3 13 13
l- 1 g- p- t-1 v- c-
Ju A u S e O c
N o De
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Function categories on
Introduction to Excel Functions
Most of the formulas you create in Excel include one or more built-in Excel
functions, such as SUM, IF, VLOOKUP, and many others. Probably no one,
not even the developers at Microsoft, is familiar with all of the Excel
functions, but you should strive to learn, or at least be aware of, as many as
you can.
Excel's functions are grouped into categories, including Financial, Math &
Trig, Date & Time, and others. You can see these categories in the Function
Library group on the Formulas ribbon (see to the right). The topics in this
group of the tutorial illustrate some of the more useful Excel functions in
the various categories.
The names of these functions are capitalized in this tutorial, but this is only
for emphasis. They are not case sensitive. You can enter SUM or sum or Bob
even sUM, all with the same result. 10
5
Some functions are so useful that Excel automatically applies them to
selected ranges (when at least two cells are selected). The results are 13
displayed in the status bar at the bottom of the screen. If you right-click any 2
blank space on the status bar, you can check the functions you want to be 9
visible.
18
Try it! Select any parts of the data to the right (even discontigous ranges) 18
and look at the status bar. Then right-click the status bar and select more 2
options if you want them.
18
Function categories on Formulas ribbon
Mary Jack
6 5
11 7
10 6
15 19
5 20
16 19
15 1
19 10
14 6
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
If you haven’t used the fx (Insert Function) button located just to the left of
the formula bar, you should give it a try. It not only lists all of the functions
available in Excel, by category, but it also leads you through the use of
them. As an example, suppose you know there is an Excel function that
calculates payments on a loan, but you are not sure what its name is or how
to use it. You can proceed as follows.
Select a blank cell where you want to enter the formula. Click the fx button
and select the category that seems most appropriate, Financial in this case.
Scan through the list for a likely candidate and select it. (Try PMT.) At this
point, you can get help by clicking the "Help on this function" link, or you
can click the OK button and enter the appropriate arguments for the
function: interest rate, term, and principal, the latter expressed as a
negative number. (See screenshots to the right.)
Some people use the fx button as a "crutch" every time they want to enter
an Excel function. You probably shouldn't do this for functions you know
well because it takes more time. However, it is great for learning how to use
functions you are less familiar with.
Try it! Use the fx button to help you determine the function in the gray cell
to the right. (Scroll to the right for the solution.)
You can get the same help from the categories buttons on the Formulas
ribbon. You can scan the list for any category very quickly. In fact, this is a
good way to expand your repertoire of Excel functions. Just look at any of
the lists and ask for help on any that look interesting.
The SUM function is probably the most used Excel function of all. It sums all
values in one or more ranges.
Enter the formula =SUM(range), where range is any range. This sums the
numeric values in the range. If there are any nonnumeric or blank cells in
this range, they are ignored.
Here is a shortcut, which works for any function that takes multiple ranges,
separated by commas. Hold the Ctrl key and then drag the ranges, one after
the other. The commas will be entered for you automatically.
Try it! Use the SUM function in the above gray cell to calculate the total of
all costs. (Scroll to the right for the answer.)
Enter the formula =AVERAGE(range) where range is any range. This produces
the average of the numeric values in the range.
Note that the AVERAGE function ignores labels and blank cells. So, for
example, if the range C3:C50 includes scores for students on an exam, but
cells C6 and C32 are blank because these students haven’t yet taken the
exam, then =AVERAGE(C3:C50) averages only the scores for the students who
took the exam. (It does not automatically average in 0s for the two who didn’t
take the exam.)
Try it! Use the AVERAGE function in the two gray cells to the right to calculate
the averages indicated. (For the formula in the lower gray cell, replicate the
exam scores in column M and make some changes. Scroll to the right for the
answers.)
Try it! Use the AVERAGE function in the two gray cells to the right to calculate
the averages indicated. (For the formula in the lower gray cell, replicate the
exam scores in column M and make some changes. Scroll to the right for the
answers.)
You certainly know the SUM function for summing, but you might not be aware
that there is a PRODUCT function for multiplying. It works exactly like the SUM
function, that is, all of its arguments are multiplied together. Any blank or text
cells are ignored in the product. Specifically, they are not treated as 0s.
Try it! Find the product of the first six exam scores to the right, including the
Absent value. Then delete the Absent value, that is, make its cell blank. Does this
change the product?
List of Topics sheet
Total cost
Student ID Exam score Average (only for students who took the exam)
1533 68
8031 74
9859 80 Average (giving 0s to students who were absent)
9106 63
3535 72
8192 Absent
6102 85
6774 70
7558 64
314 72
9082 81
2397 75
2517 80
2432 73
6016 63
5269 80
4847 88
6537 71
9922 73
4525 71
1491 71
7897 68 Product
4088 82
166 76
7925 75
6405 81
802 76
2931 83
7625 67
2628 67
5417 92
7804 72
3994 69
394 85
8847 78
7855 81
8668 Absent
3738 77
5534 70
6965 71
8863 69
8762 73
6466 60
6100 76
1878 74
5970 67
9691 62
8666 77
4865 91
6198 81
8554 87
6753 76
9574 77
3891 81
8186 Absent
1306 73
6835 83
3136 59
4938 74
4807 74
4421 78
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The COUNT function counts all of the cells in a range with numeric values.
The COUNTA function counts all nonblank cells in a range. For example, if
cells A1, A2, and A3 contain Month, 1, and 2, respectively, then
=COUNT(A1:A3) returns 2, whereas =COUNTA(A1:A3) returns 3.
Enter the formula =COUNT(range), where range is any range. This returns
the number of numeric values in the range.
Enter the formula =COUNTA(range), where range is any range. This returns
the number of nonblank cells in the range.
The COUNTBLANK function counts all blank cells in a range.
Note: Excel uses somewhat different terms on the status bar. If you select a
range and right-click the status bar, you will see the two options "Count"
and "Numerical Count." The first corresponds to the COUNTA function, and
the second corresponds to the COUNT function.
List of Topics sheet
There are several Excel functions that allow you to count values, or sum or
average values, subject to conditions. Until Excel 2007, this was possible only for
a single condition, such as all people younger than 35 years old, and there were
only two functions available, COUNTIF and SUMIF. In response to customer
demand, Microsoft added four new functions in Excel 2007: AVERAGEIF (for a
single condition), and COUNTIFS, SUMIFS, and AVERAGEIFS (for multiple
conditions). These are all handy functions, and you should learn how to use
them.
The COUNTIF function counts all values in a specified range that satisfy a
certain condition.
The criterion can be tricky to specify. If you want a specific value, such as
Male, you can specify it as "Male" (double quotes required), or you can use
a cell reference such as Q8. Also, if you want a specific inequality, such as
younger than 20, you can specify it literally as "<20" (again, double quotes
required). But if you want it to be younger than the value in cell Q9, you
need to piece it together as a literal part, "<", and a variable part, whatever
is in cell Q9. The correct syntax is "<"&Q9. The ampersand (&) symbol
concatenates (pieces together) the two parts. For example, if you want to
count the number of students who are older than then the value in cell Q9,
the correct formula is =COUNTIF(M9:M80,">"&Q9).
Try it! Use COUNTIF in the top gray cell to the right to find the number of
students who scored at least as high as the value in cell Q10. (Scroll to the
right for the answer.)
Try it! Calculate the sums indicated in rows 14-16 to the right. (Scroll to the
right for the answers.)
Try it! Calculate the averages indicated in rows 18-20 to the right. (Scroll to the
right for the answers.)
List of Topics sheet
The "plural" functions discussed here, COUNTIFS, SUMIFS, and AVERAGEIFS, were added in
Excel 2007. They allow you to impose multiple conditions, such as male and younger than
some value. Their arguments, described in more detail below, include any number of pairs of
criterion ranges and criteria, such as L9:L80,"Male".
Try it! In the top gray cell to the right, find the number of students with the gender in cell Q8
and age younger than the age cutoff in cell Q9 who scored less than or equal to the score
cutoff in cell Q10. (Scroll to the right for the answer.)
The SUMIFS function is similar in concept to SUMIF, but its syntax is different. (Microsoft
chose this syntax instead of the original SUMIF syntax for logical reasons, but they didn't
want to change the SUMIF syntax because it would have broken too many existing
spreadsheets.) Now the range to sum comes first, and the criteria ranges and criteria
come last.
=SUMIFS(sum_range,criterion_range1,criterion1,criterion_range2,criterion2,...)
Again, the setup is typically like the example to the right. There is a column such as exam
score to sum. The criteria impose conditions on other columns, or even the same column.
Only those rows that meet all of the conditions are part of the sum.
Try it! In the middle gray cell to the right, calculate the total of all scores made by the
gender in cell Q8 and ages younger than the age cutoff in cell Q9. (Scroll to the right for
the answer.)
Try it! In the middle gray cell to the right, calculate the total of all scores made by the
gender in cell Q8 and ages younger than the age cutoff in cell Q9. (Scroll to the right for
the answer.)
The AVERAGEIFS function works just like the SUMIFS function, except that it averages the
values in the the average_range argument.
Try it! Calculate the average in the bottom gray cell to the right, using the same criteria as in
the SUMIFS exercise above. (Scroll to the right for the answer.)
Return to List of Topics sheet
ed in
han
airs of
38 Male 18 75
39 Male 20 86
40 Male 21 77
41 Male 20 73
42 Male 20 74
43 Female 20 79
44 Male 18 80
he 45 Male 20 77
46 Female 21 72
as in 47 Male 19 77
48 Male 19 71
49 Female 23 70
50 Female 19 68
51 Female 24 79
52 Male 19 75
53 Male 18 80
54 Female 19 73
55 Female 21 61
56 Female 21 62
57 Male 19 68
58 Male 19 92
59 Female 20 85
60 Male 22 77
61 Female 19 79
62 Male 20 86
63 Female 19 83
64 Male 19 83
65 Male 18 76
66 Female 24 89
67 Female 18 72
68 Female 21 69
69 Male 23 66
70 Male 24 71
71 Male 20 80
72 Female 18 61
Female
20
87
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
There are many times when you need to sum products of values in two (or
possibly more than two) same-size ranges. Fortunately, there is a
SUMPRODUCT function that sums products quickly.
There can actually be more than two ranges in the SUMPRODUCT formula,
separated by commas, as long as all of them have exactly the same size.
This is not as common as having only two ranges, but it is sometimes useful.
Try it! Sum the products of the two ranges in the example to the right to
find the total shipping cost in the gray cell. (Scroll to the right for the
answer.)
By the way, if you are tempted to write the formula without the
SUMPRODUCT function as the sum of nine products, as many beginning
users tend to do, imagine how long your formula would be if there were 10
plants and 50 cities! The SUMPRODUCT function is extremely efficient, so
get used to using it.
List of Topics sheet
Total cost
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
IF functions are very useful for performing logic, and they vary from simple to
complex. A few typical examples are illustrated here. For each product, if the
enough units are order
To enter a basic IF function:
units of that product ar
Enter the formula =IF(condition,expression1,expression2), where condition is
any condition that is either true or false, expression1 is the value of the Product
formula if the condition is true, and expression2 is the value of the formula if
the condition is false. 1
2
A simple example is =IF(A1<5,10,“NA”). Note that if either of the expressions 3
is text, as opposed to a numeric value, it should be enclosed in double quotes.
4
Try it! Enter appropriate IF formulas in columns M and N. (Scroll to the right
for answers.)
Try it! Use a nested IF function to get the grades in column M. (Scroll to the
right for answers.)
Try it! Use an IF function with an AND condition to fill in the gray range for
selling to the right. Make sure you use double quotes for text. (Scroll to the
right for answers.) Any student who score
which is 1% of their tot
To use an OR condition in an IF function:
Enter the formula =IF(OR(condition1,condition2),expression1,expression2). Student
This results in expression1 if either condition1 or condition2 is true (or if 1
both are true). Otherwise, it results in expression2. 2
Again, any number of conditions, not just two, can be included in the OR. 3
4
Try it! Use an IF function with an OR condition to fill in the bonuses in
column P. (Scroll to the right for answers.) 5
6
You can even have AND and OR conditions in the same formula. A typical
example is =IF(OR(AND(B3>=10,C3>=15),D3<50),1000,2000). For example,
if cells B3, C3, and D3 have values 12, 10, and 40, this returns 1000 because
the second condition (D3<50) is true, even though the AND condition is
false.
The key to writing (and reading) such complex formulas is to pay careful
attention to the parentheses. Fortunately, Excel helps you by color-coding
pairs of parentheses. From now on, pay close attention to this color coding.
You will come to depend on it!
For each product, if the end inventory is less than or equal to 50 units,
enough units are ordered to bring stock back up to 200; otherwise, no
units of that product are ordered
Each student gets an A (if score is 90 or above), S for satisfactory (if score
is 60 or above but less than 90) or U for unsatisfactory if score is below 60
Score Grade
70
95
55
80
60
90
Investor sells stock only if its price has gone up three consecutive days
(including the current day)
Any student who scores at least 95 on any of the exams gets a bonus
which is 1% of their total score.
No
No
Yes
No
Bonus
0
3.2
3.29
3.53
0
0
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Lookup tables are useful when you want to compare a particular value to a
set of values, and depending on where your value falls, return the
appropriate result. For example, you might have a tax table that shows, for
any income, what the corresponding tax is. There are two versions of
lookup tables, vertical (VLOOKUP) and horizontal (HLOOKUP). Because they
are virtually identical except that vertical goes down and horizontal goes
across, only the VLOOKUP function is discussed here. Besides, VLOOKUP is
used much more frequently than HLOOKUP.
The optional fourth argument requires some explanation. The default value,
TRUE, indicates that you are looking for an approximate match; you don't
necessarily expect to find your exact lookup value in the lookup table. In
this case, the first column of the lookup table must be in ascending order.
However, if the fourth argument is FALSE, this indicates that you are looking
for an exact match in the first column of the lookup table. In this case, it
doesn't matter whether the first column is in ascending order or not.
However, the function will return an error if no exact match can be found.
Student
Looking Up a Value in a Range (an Approximate Match) 1
2
The most common use of a lookup table is when you want to see where a 3
value fits in a range of values. Then the fourth argument can then be
omitted because its default value is TRUE. For example, suppose you want
to assign letter grades to students based on a straight scale: below 60, an F:
at least 60 but below 70, a D; at least 70 but below 80, a C; at least 80 but
below 90, a B; and 90 or above, an A. The lookup table to the right (columns
O and P) shows how you would set this up. The comparison column in the
Looking Up a Value in a Range (an Approximate Match)
The most common use of a lookup table is when you want to see where a
value fits in a range of values. Then the fourth argument can then be
omitted because its default value is TRUE. For example, suppose you want 4
to assign letter grades to students based on a straight scale: below 60, an F: 5
at least 60 but below 70, a D; at least 70 but below 80, a C; at least 80 but 6
below 90, a B; and 90 or above, an A. The lookup table to the right (columns
O and P) shows how you would set this up. The comparison column in the 7
lookup table starts at 0 (the lowest grade possible) and then records the 8
cutoff scores 60 through 90. 9
The formula in the gray cell is =VLOOKUP(L43,$O$43:$P$47,2), which is
copied down column M. This formula compares the value in L43 (67) to the Order #
values in column O and chooses the largest value less than or equal to it.
This is 60. Then because the third argument in the VLOOKUP function is 2, 1
the score reported in the gray cell comes from the second column of the 2
lookup table next to 60, namely, D. 3
Try it! For the orders to the right, create a lookup table in columns O and P, 4
and a copyable VLOOKUP formula in column M. Assume there is quantity 5
discount pricing: for orders less than 300 units, the unit price is $3.00; for 6
orders of at least 300 units but less than 400, the unit price is $2.50; for
orders of 400 units or more, the unit price is $2.00. (Scroll to the right for 7
the answer.) 8
Student
Looking for an Exact Match Adams
Davis
In the examples above, it wouldn't make sense to look for an exact match
because there usually isn't one. For example, a typical score such as 67 does Edwards
not exactly match any of the values in the first column of the lookup table. Johnson
However, there are many cases when it does make sense to look for an exact Myers
match. Then there are three things to remember. (1) The fourth arguments is
not optional; it must be FALSE. (2) The first column of the lookup table doesn't Smith
have to be in ascending order; it can be, but order doesn't matter. (3) If no Thomson
exact match exists, the function returns an error.
Williams
Try it! Use a VLOOKUP function in column M to find the gradepoints for each
student, using the lookup table in columns O and P. What happens with
Williams? (Scroll to the right for the answers.)
Note that the grades in column O of the lookup table are in the “natural”
order, but they are not in Excel’s A-Z sort order. Therefore, FALSE must be
entered as the fourth argument in the VLOOKUP function. Try it with the
fourth argument TRUE to confirm that you get incorrect results.
Score Grade Lookup table
67 D 0 F
72 C 60 D
77 C 70 C
70 C 80 B
66 D 90 A
81 B
93 A
59 F
90 A
The INT function takes a decimal value and returns an integer by "chopping off"
(truncating) the decimal. More exactly, it returns the integer just to the left of
the given decimal number on the number line. It does not round to the nearest
integer. To use it:
Enter the formula =INT(value), where value is a number or a reference to a
numeric cell.
Try it! In row 11, apply the INT function to the numbers in row 10. (Scroll to the
right for answers.)
The ROUND function rounds a value to the number of decimals you specify. To
use it:
INT function
1.7 -3.2 14 -7
ROUND function
100.35 14325 16.3467 154432 0.3569
0 -2 2 -3 1
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The ABS function returns the absolute value of a number. To use it:
Enter the formula =ABS(value), where value is a number or a reference to a
numeric cell.
Try it! In row 10, apply the ABS function to the numbers in row 9. (Scroll to the right
for answers.)
The SQRT function returns the square root of a number. To use it:
Try it! In row 16, apply the SQRT function to the numbers in row 15. (Scroll to the
right for answers.)
Try it! In cell P26, calculate the sum of squares of the numbers to its left. (Scroll to
the right for answers.)
List of Topics sheet
ABS function
6 -50 0
SQRT function
64 0.5 -20 0
SUMSQ function
21 43 4 21 35
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
There is also a LOG10 function, which returns the log to the base 10 that you
might have learned in high school. There is also a LOG function, where you can
supply the base. But LN tends to be used in most applications.
EXP function
EXP (Exponential) Function (Math & Trig Category) 1
The EXP function returns the exponential function of a number. That is, if you
apply EXP to some number x, the result is the special number e raised to the
power x, where e is approximately 2.718. In math books, you see this written
as ex.
It turns out that EXP and LN are "inverses" of one another. If you start with a
number x and take EXP of it, and then take LN of the result, you end up with
x. Alternatively, if you start with a (positive) number x and take LN of it, and
then take EXP of the result, you end up with x.
Try it! In row 20, apply the EXP function to the numbers in row 19. Then in
row 21, apply the LN function to the numbers in row 20. Note that the value
you get in cell K20 is the special number e. (Scroll to the right for answers.)
LN function
0.7 1 0 -40
EXP function
-4 2.3 0 15
Logs aren't defined for 0
or negative numbers.
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
You can enter this formula in as many cells as you like, and each will have a
different random number. Also, these numbers are "live." If you press the
recalc (F9) key, they will all change.
Try it! Enter the RAND function in any cell to the right and copy it to some
range. Then press the F9 key a few times and watch the random numbers
change. (Scroll to the right for some possible live values.)
Until Excel 2007, the RAND function was the only function for generating
random numbers in Excel. Fortunately, another very useful function,
RANDBETWEEN, was added in Excel 2007. It takes two integer arguments and
generates a random integer between these two values (inclusive) so that all of
the possibilities are equally likely. To use it:
Enter the formula =RANDBETWEEN(min,max), where min and max are two
integers (with min less than max).
Try it! Generate random rolls of a die (1 to 6) in several cells to the right. Then
press the F9 key to see how they change randomly. (Scroll to the right for some
possible live values.)
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
To concatenate, you start with two or more pieces of text and “piece them
together.” For example, you might concatenate “Bob” and “Jones” into “Bob
Jones”. There are two equivalent ways to concatenate: with the ampersand
(&) symbol and with the CONCATENATE function. Both are described here.
Suppose cells A1 and B1 contain text such as a first name and a last name. To
concatenate them with the ampersand symbol, you enter the formula
=A1&B1 in some other cell such as cell C1. Literal text, such as a comma and
a space, can also be included, such as =A1&“, ”&B1. In this case, if cell A1
contains “Jones” and cell B1 contains “Bob”, then cell C1 will contain “Jones,
Bob”. This concatenates the last name, the literal comma and space, and the
first name. In general, you separate the pieces with ampersands, and you
surround literal text with double quotes.
Try it! Concatenate the first names, middle initials, and last names in columns
K, L, and M with the ampersand symbol so that full names of the form Jones,
Bob E. appear in column N. Do this with again with the CONCATENATE
function in column O. (Scroll to the right for answers.)
List of Topics sheet
Ampersand CONCATENATE
Bob E Jones
Stephen C Davis
Andy T Thompson
John F Wilson
Kathy C Fredericks
Karen D Williams
Tom T Smith
Peter F Jennings
Ted R Benson
Jason E Samson
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Parsing text, that is, separating it into its pieces, is sometimes easy, and it is
sometimes difficult. The text functions illustrated in the other parsing topic
in this tutorial are for the difficult cases, but this topic discusses an easy tool
that is worth trying first. Suppose you import data from a legacy system or a
Web site, and everything gets imported to a single column, such as in
column K to the right. The pattern is pretty clear: each cell contains five
numbers, all separated by commas. To parse these into five columns with
one number per cell, you can use the Text to Columns button on the Data
ribbon shown to the right. This launches a fairly simple wizard (basically, the
same wizard used for importing a text file), where you can indicate that the
"delimiter" is a comma.
Try it! Select the data in column K and try the Text to Columns wizard. Note
that it places the results in columns K-O, replacing the original data in
column K. If you want to keep the original data for some reason, you should
first make a copy in column L and then parse the copy.
Note: You might see little green triangles in the cells in column K. These
indicate errors, or at least what Excel thinks are errors. If you select any of
these cells, or all of them, you will see a dropdown to the left, which
provides options for dealing with the "errors," including ignoring them.
(They should be ignored in this example.) More generally, if you don't want
Excel to enter these error warnings in the first place--in any of your
workbooks--you can go to the Formulas section of Excel Options and
uncheck the "Enable error background checking" option.
List of Topics sheet
606,360,516,1757,371
1631,1337,1260,1855,2823
904,749,486,1852,1612
2463,1324,1889,2597,312
1256,1839,1745,244,1508
2159,2917,1699,1351,974
1084,2379,1791,1933,507
1686,2454,1954,256,1068
1274,2330,2334,343,255
303,2128,578,824,1714
2989,2317,2196,642,2812
1743,2122,2428,871,2701
2817,2330,1217,407,327
894,1893,1963,1641,2533
2747,1952,243,2832,1487
358,2674,1660,1006,1249
1032,939,2172,2112,347
2639,2489,2905,412,2877
730,696,639,454,1591
1774,2506,2690,2498,2407
2406,493,1457,1317,2993
1359,894,2281,2454,1239
2847,1432,381,1518,941
1597,313,1231,596,702
2838,2547,846,868,1753
2049,558,201,1034,351
1395,1314,1004,489,275
2628,2596,1901,2114,381
1439,1574,2318,277,1202
918,2177,621,1777,2106
867,2906,2844,2173,1370
2314,236,1387,1586,1106
1316,1475,1791,1494,2405
1006,795,1804,861,979
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Suppose that someone has given you a spreadsheet with a list of names
such as the one to the right. Each cell in column K has a last name, then a
comma and a space, and then a first name. Your job is to parse (that is,
separate) these names as indicated for the name in cells L10 and M10. That
is, column L should have all of the first names and column M should have all
of the last names. If this sounds easy, imagine that there are 10,000 names
in column K. What would you do? If you just start typing, you will be busy
for a long time, and you will undoubtedly make mistakes along the way!
Fortunately, there is a much better way. The key is to look for patterns. In
this example, note that every name has a comma and a space. The first
name comes after the comma and space, and the last name comes before it.
For the name "Jones, Bob", there are 10 characters, including the comma
and space, and the comma and space are characters 6 and 7. So the first
name is the rightmost 3 characters and the last name is the leftmost 5
characters. In any parsing operation, this is the first and the most crucial
step: discover the pattern.
Once you discover the pattern, you can then exploit it with a number of
useful text functions. The ones discussed here are FIND, LEN, RIGHT, LEFT,
and MID. If you want to learn about other text functions, click the Text
dropdown list on the Formulas ribbon.
For example, =LEN("Bobby Jones") returns 11. This includes the space.
These functions return the left, right, or middle characters from a piece of
text, where you indicate the number of characters to return.
These functions return the left, right, or middle characters from a piece of
text, where you indicate the number of characters to return.
Enter the formula =RIGHT(text, n), where n is an integer. This returns the
right n characters in text. (If n is greater than the number of characters in
text, it returns the entire text.)
Enter the formula =LEFT(text, n), where n is an integer. This returns the left
n characters in text. (If n is greater than the number of characters in text, it
returns the entire text.)
The last example is trickier. As the next text box indicates, the FIND function
in this formula returns 6, the position of the comma, so this formula is
equivalent to =MID("Jones, Bob",8,1). Note that the starting position is 8,
not 7, because of the space.
The FIND function returns the position of the first occurrence of a string of
characters (which could be a single character) in a piece of text.
The formula =FIND(“,”,“Jones, Bob”) returns 6, because the comma is the 6th
character in Jones, Bob.
The formula =FIND(“,”,“Jones, Bob”) returns 6, because the comma is the 6th
character in Jones, Bob.
1. In cell L107, find the length of the text in cell K107 with the LEN function.
This results in 10 in cell L107 because cell K107 has 10 characters, including
the comma and space.
2. In cell M107, find the position of the comma with the FIND function. This
results in 6 in cell M107 because the comma in Jones, Bob is the 6th
character.
3. In cell N107, add 1 to find the position of the space after the comma. This
results in 7 in cell N107 because the space is the character right after the
comma.
4. In cell O107, find the first name with the RIGHT function, using the
rightmost (10-7) characters. Make sure you use cell references to enable
copying down.
5. In cell P107, find the last name with the LEFT function, using the leftmost
(6-1) characters. Again, use cell references to enable copying.
The beauty of this method is that you have to do it only once, in the first
row. Then you can copy all of the formulas down for the rest of the names,
even if there are thousands of them!
Try it! Enter the formulas as indicated in the above steps and copy them
down. (Scroll to the right for the correct answers.)
Now try a tougher one. The names to the right either have a middle initial,
a first initial, or no initial. See if you can parse these names into four pieces:
Last name, Used name, Initial, and Middle initial, where:
Used name is the name (first or middle) the person goes by.
Initial is the single initial character, if any, or is blank if there is no initial.
Middle initial is "Yes" if the initial is a middle initial, "No" if it is a first initial,
and blank if there is no initial.
As in the previous exercise, you can have other "helper" columns as needed.
Hints: (1) FIND returns an error if it can't find the requested text. (2) There is
an ISERROR function that can check whether a cell contains an error. Scroll
Used name is the name (first or middle) the person goes by.
Initial is the single initial character, if any, or is blank if there is no initial.
Middle initial is "Yes" if the initial is a middle initial, "No" if it is a first initial,
and blank if there is no initial.
As in the previous exercise, you can have other "helper" columns as needed.
Hints: (1) FIND returns an error if it can't find the requested text. (2) There is
an ISERROR function that can check whether a cell contains an error. Scroll
to the right for a solution.
OK, this one is not easy, and it requires some careful planning and logic. But
it sure beats typing a long list of hundreds or thousands of names!
Excel 2013 introduced a new Flash Fill tool that eliminates the need for some (but
not all) of these complex parsing formulas. You can read about Flash Fill in the Text
Functions section of the tutorial.
List of Topics sheet
Flash Fill
Has Excel become a mind reader with the new Flash Fill tool introduced in
Excel 2013? You might think so after you read this topic. However, it's not
really about mind reading but rather about the ability to recognize patterns.
Specifically, Flash Fill allows you to parse names, numbers, or dates without
any formulas if the items in your list follow a recognizable pattern. A typical
example where it applies is in the list of names to the right. Each name
follows a pattern: last name, comma and space, first name, space, middle
initial and period. Row 4 illustrates the desired results in gray. There are
several ways to proceed, and you can try any of these methods. Just be
aware that each method works only one column at a time, and you must
proceed from left to right, starting in the column adjacent to the data
column.
Method 1. Try it! Type the first name in the top row: Bob in cell L7. Then
select Flash Fill from the Fill dropdown on the Home ribbon. Pretty amazing,
isn't it? Now you could repeat with the other columns. Note that right after
doing a flash fill, you get a mini dropdown that provides several options,
such as undoing the flash fill.
Method 2. Try it! Type the middle initial and period in the top row: E. in cell
M7. Then start typing the next initial in the second row: T. in cell M8. Pretty
soon, Excel will guess the pattern and show it for all rows in light font, at
which time you can press Enter to accept the results. Again, you could now
repeat with the other columns.
Method 3. Try it! Type the last name in the top row: Jones in cell N7. Then
with any gray cell in column N selected, use the Flash Fill shortcut key
combination, Ctrl+e. Now repeat this method for the other columns.
By the way, as you do any of these, you might see text appear in row 6, not
just in the gray range. This is because Flash Fill is also parsing the Names to
parse label in cell K6!
Note how Flash Fill can recognize many patterns, such as the initials in
column Q and even the lower case name in column R. However, if names
don't fit the pattern, Flash Fill will likely fail. For example, if the bottom two
names were replaced with Lincoln, Abe and Fitzgerald, F. Scott, Flash Fill
wouldn't get everything correct. (You might want to verify this.) As this
indicates, Flash Fill can't completely take the place of text functions for all
parsing tasks.
Flash Fill also works on certain patterns of numbers and dates, as you can
check on the examples to the right. However, except for the year column on
the dates, only methods 1 and 3 seem to work; method 2 doesn't work. It
isn't clear why method 2 works in some situations but not in others, and
you’ll probably have to experiment to see which method works best for
you. In any case, the Flash Fill tool can often save you from entering a lot of
complex text formulas.
List of Topics sheet
Names to parse
Jones, Bob E. Bob
Davis, Stephen T.
Thompson, Andy S.
Wilson, John T.
Kelley, Jennifer B.
Williams, Karen S.
Smith, Tom F.
Jennings, Peter R.
Benson, Ted A.
Samson, Jason T.
21
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
We tend to take dates and times for granted, but they appear in many, if not
most, real-world business spreadsheets. They can actually be quite tricky to
work with, and a complete treatment of dates and times could fill a long
chapter of a book. This tutorial can't cover all of the intricacies of Excel-
based dates and times, but it does illustrate some of the most useful
methods for working with them, including several of the functions listed to
the right.
The first thing to realize is that a date-time value that appears in a cell as
something like 3/14/2004 4:30 PM is really stored as a number. Excel refers
to this number as the serial value. The serial value corresponding to this
particular date-time happens to be 38060.688. The value to the left of the
decimal is the number of days since a “base” date (January 1, 1900), and
the decimal part indicates the fraction of time through the day, starting
right after midnight. In this example 4:30 PM is 68.8% of the way from
midnight to the next midnight. If the decimal part is omitted, it is assumed
to be midnight. In this case, you usually format the value so that only the
date, not the time, appears.
If you happen to know the numbering system for dates, that is, you
somehow know that 38060 corresponds to 3/14/2004, you could enter the
number 38060 in a cell and then format it to look like a date. However, you
usually enter a date like 3/14/2004 in a cell. Actually, there are several
formats Excel recognizes as dates, including 3/14/2004, March 14, 2004, 3-
14-04, and a few others, but they are all stored as 38060.
The same is true for date-times, such as 3/14/2004 4:30 PM, or just times,
such as 4:30 PM. If you enter either of these in a format that Excel
recognizes as a date-time or just a time, Excel will recognize that these are
date-times or times, but it will store them as numbers, 68030.688 or 0.688.
By the way, if you enter a date-time in a format that Excel doesn’t recognize,
you are entirely out of luck. It will simply be stored as a label, with no
inherent “date-time” meaning. And Excel can be fussy. For example, it
doesn’t understand 3/14/2004 4:30PM, simply because there is no space
between 4:30 and PM! On the other hand, Excel is smart about dates. It will
recognize that 9/31/1999 and 2/29/2003 are not dates, regardless of how
they are formatted.
Try it! The cells to the right include some date-times, dates (no times
specified), and times (no dates specified), formatted in several ways. Format
these as numbers with three decimals to see the serial values. Then
reformat them as date-times in any formats you prefer.
List of Topics sheet
Excel has two useful functions, TODAY and NOW, for automatically entering
the current date or the current date and time .
Enter the formula =TODAY() in any blank cell. (The blank parentheses are
necessary.) It returns the current date. If you open this spreadsheet
tomorrow, it will list tomorrow’s date, that is, it will update each day.
To use the NOW function:
Enter the formula =NOW() in any blank cell. (Again, the blank parentheses
are necessary.) It returns the current date and time. It is also dynamic, but it
won't change until worksheet recalculates.
Try it! Enter the TODAY and NOW functions in the gray cells. Then format the
result of NOW as time only—no date. (Scroll to the right for answers.)
After you have worked a few other exercises in this tutorial, come back to
this topic and see whether the time has changed. (You might have to force a
recalculation to see the change. You can do this by pressing the F9 key.)
List of Topics sheet
Today's date
Current time
The value in cell AF8 was
formatted to show time only,
not date and time.
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
If a cell contains a date, it is easy to strip off the year, month, and day with
the YEAR, MONTH, and DAY functions. There is also a WEEKDAY function
that returns the weekday index, 1 (Sunday) to 7 (Saturday). Each of these
functions has a single argument, a date or a reference to a cell containing a
date.
Try it! For each date to the right in column K, return the year, month, day,
and weekday in columns L-O. (See to the right for answers.)
You might want the month name, such as September, and the day name,
such as Tuesday, rather than numbers. You can do this with custom
formatting. To get to custom formatting, right-click on any cell, select Format
Cells, and select Custom to bring up the dialog box to the right. For month
names, you can enter the code mmm (for three-letter abbreviations) or
mmmm (for full month names). Similarly, you can enter the codes ddd or
dddd for days.
Try it! Copy the values in columns M and O to columns P and Q, respectively.
Then custom format the months in column P as mmmm, and custom format
the days in column Q as dddd. This serves as an excellent reminder that
dates can be formatted in many ways.
List of Topics sheet
The DATE function takes three numerical arguments, a year, a month, and a
day, and it returns the corresponding date. The important part is that Excel
recognizes the result as a date, which you can then format in any date format
you like.
To use the DATE function:
This function can be very useful for manipulating dates. For example, it can be
used to find your next birthday, given your birthdate, as illustrated in cell L8.
The formula in cell L8 is a long one, but it is simple logic. This person's next
birthday will certainly be on July 22. The only question is whether it will be in
the current year or the next year. The IF function checks for this. Note that
YEAR(TODAY()) returns the year corresponding to today's date.
Tip: Depending on the width of your Excel window, you might not be able to
see all of the long cell L8 formula in the formula bar. To see long formulas like
this one, you can make the formula bar "taller." Just drag the border below the
formula bar down.
Try it! Enter your birthdate in cell K17 and then calculate your current age (as
an integer) in cell L17. (Scroll to the right for the answer.)
The DATEVALUE function can be a real life-saver. It takes a date stored as text
and returns the corresponding serial value, which you can then format as a date.
Why is this important? Suppose you have a lot of data stored in some type of
legacy system in your business, and you are somehow able to dump it into Excel.
The chances are that all dates will be imported as text. That is, a cell value will
look something like 5/20/2001, but Excel won’t recognize it as a date. Without
the DATEVALUE function, you would have to retype all of the dates! However,
DATEVALUE saves you this mind-numbing work.
Try it! Create dates in column L corresponding to the text values in column K that
happen to look like dates. Then format the results with any date format you
prefer. (Scroll to the right for answers.)
Enter the formula =DATEVALUE(datetext), where datetext refers to a date stored
as text. Then format the result as a date.
Try it! Create dates in column L corresponding to the text values in column K that
happen to look like dates. Then format the results with any date format you
prefer. (Scroll to the right for answers.)
List of Topics sheet
Birthdate Age
The MIN function returns the smallest numeric value in a range. Similarly, the
MAX function returns the largest numeric value in a range.
Sales rep
To use MIN and MAX functions:
Jan sales
Enter the formula =MIN(range) or =MAX(range) where range is any range. Feb sales
These produce the obvious results: the maximum (or minimum) value in the
range.
Try it! Use the MIN and MAX functions to fill in the gray range to the right.
(Scroll to the right for answers.) Jan
Note that MIN and MAX work only on numeric data. If you have a list of Feb
names, you might expect MIN and MAX to return the first and last names in
alphabetical order, but unfortunately they don't. (There are two other
functions called MINA and MAXA, but they don't appear to be very useful.)
Allison Baker Jones Miller Smith Taylor
$3,700 $2,400 $2,300 $3,000 $3,800 $3,700
$2,600 $2,200 $2,400 $2,800 $3,600 $2,300
The median is the middle value in a set of n numbers, in the sense that half are
above it and half are below it. More precisely, when the values are sorted in
increasing order, it is the middle value if n is odd, and it is the average of the two
middle values if n is even. Fortunately, Excel takes care of the details with the
MEDIAN function.
Note that if range contains labels or blank cells, these are ignored when
calculating the median. This is also true for the other statistical functions.
Try it! Find the median of the data in column K. Does it equal the average? Why or
why not? (Scroll to the right for answers.)
The values in a data set are often ranked in some way. For example, if you take
the SAT exam to get into college, you learn your ranking by a percentile. If you
are at the 85th percentile, you know that 85% of all people scored lower than
you, and only 15% scored higher. Excel has two useful functions for finding this
type of information: PERCENTILE and QUARTILE.
The QUARTILE function is the easiest to understand. Imagine that you have
1000 scores. You sort them from low to high and then divide them into four sets
of 250 scores each, where the first set contains the smallest scores, the second
set contains the next smallest scores, and so on. The first, second, and third
quartiles are the breakpoints between these sets. For example, 25% of the
scores are below the first quartile, and 75% are above it. By definition, the
second quartile is the median.
Try it! Find all three quartiles, Q1, Q2, and Q3, for the data in column K.
PERCENTILE Function (Statistical Category)
Try it! Find the requested percentiles for the data in column K. For example, P10
indicates the 10th percentile. Do you see the relationship between the quartiles
and certain percentiles?
The QUARTILE and PERCENTILE functions are typically used on data sets with a
large number of values. If they are used on a very small data set, you might be
surprised at the results. In fact, you might even disagree with them. For example,
if the data set has the five values 10, 20, 30, 40, and 50, Excel’s PERCENTILE
function indicates that the 10th percentile is 14. This is certainly not a very intuitive
answer, and you might disagree with it, but why anyone would want the 10 th
percentile of a five-value data set in the first place?
33 Average
3 Median
0
1 Quartiles
4 Q1
14 Q2
5 Q3
41
3 Percentiles
5 P01
9 P05
1 P10
0 P25
22 P50
10 P75
5 P90
13 P95
7 P99
6
3
9
5
14
7
27
10
7
3
11
15
35
9
0
5
6
11
13
4
17
3
19
4
5
1
21
4
16
6
18
18
2
3
17
7
9
6
4
2
7
3
0
14
2
4
24
12
1
4
36
3
0
2
4
12
7
2
1
16
5
31
15
29
12
5
4
5
22
14
7
7
19
38
15
45
1
4
14
3
16
4
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
% within 1 stdev
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
If there are two columns of data that are matched in a particular way, such
as monthly sales of two company products, it is often useful to see how
they are related. If one is unusually large, does the other tend to be
unusually large or does it tend to be unusually small? The statistical
measure for this is correlation, and it can be calculated with the CORREL
function. A correlation is a number between -1 and +1. If the correlation is
positive, the two sets of numbers tend to vary in the same direction. If one
is small, the other tends to be small; if one is large, the other tends to be
large. Exactly the opposite is true if the correlation is negative. In this case,
the two sets of numbers tend to vary in opposite directions. The magnitude
of the correlation indicates the strength of the relationship between the
two sets of numbers. There is a strong relationship (positve or negative) if
the correlation is close to -1 or +1. The relationship is much weaker, or
nonexistent, if the correlation is close to 0.
To calculate a correlation between two sets of numbers:
Try it! The data to the right represent monthly sales of three products.
Calculate the indicated correlations in column Q. (Scroll to the right for the
answers.)
Note: This item should be of particular to users who have used, or plan to
use, Excel's many statistical functions such as NORMDIST.
Similar functions, with .DIST and .INV versions, now exist for other
probability distributions such as binomial, chi-square, and others. In fact, for
the t distribution, commonly used in statistical inference, there are six
versions. Their functionality was available in the older TDIST and TINV
functions, but only through obscure combinations of arguments. Now their
names indicate more precisely their purpose. (Only five of the six are shown
to the right. The other one is T.TEST, which you can look up in online help.)
A few of the more common statistical functions are illustrated to the right.
As you can see, the changes are not exactly earth-shaking, but the names of
the new functions and their arguments are more intuitive. Admittedly, the T
functions are still far from obvious, but they are much better than before.
(Note: If you are viewing these in Excel 2007 or earlier, you will see _xlfn. in
front of the functions in column M in the Formula bar. This indicates that
these functions aren't available in pre-2010 versions of Excel.)
Again, the majority of the new (or newly named) functions are statistical
functions, but there are a few others. For example, in the Date & Time
group, there are NETWORKDAYS (old) and NETWORKDAYS.INTL (new)
functions. The best way to get acquainted with these new functions is to go
to the Formulas tab and click one of the dropdowns lists in the Function
Library group. From there, you can get as much help as you need. By the
way, help for the old functions such as NORMDIST is still available. You can
find it in the Compatibility group under More Functions on the Formulas
ribbon.
List of Topics sheet
he right of it
The PMT function is usually used to find the monthly payment for a car loan
or a home mortgage loan. The inputs are typically an annual interest rate, a
term (number of months financed), and the amount borrowed (the
principal). The PMT function finds the amount you have to pay each month
of the term. Part of this payment is principal and part is interest. At the end
of the term, you will have paid just enough to pay off the entire loan.
Try it! Suppose you take out a $30,000 loan for a new car when the annual
interest rate is 3.75% and the term of the loan is 36 months. Calculate your
monthly payment in the gray cell. Then use a data table to see how your
monthly payment varies for terms of 24, 36, 48, or 60 months. (Scroll to the
right for the answers. The Data Table topic in this tutorial explains data
tables.)
List of Topics sheet
Much of the theory of finance is about the time value of money. Basically, a
dollar earned in the future is less valuable than a dollar earned today
because the dollar earned today can earn interest. To account for this, future
cash inflows or outflows are discounted to get their present values now.
Given a future stream of cash inflows and/or outflows, the sum of all their
present values is called the net present value, or NPV. If this stream is
incurred at regular time intervals—at the end of each year from year 1 on—
you can use Excel’s handy NPV function to calculate the NPV of the stream.
Note that if there is an initial cash inflow or outflow at the beginning of year
1, it should be entered outside the NPV function. The reason is that it
doesn’t need to be discounted.
Try it! Assume a company pays $100,000 at the beginning of year 1 to get
into an investment. It then receives the cash inflows at the ends of years 1
through 5 shown to the right. What is the NPV of this investment (inflows
minus outflows) with a 12% discount rate? Does the NPV increase or
decrease as the discount rate increases? (Scroll to the right for the answer.)
Typically, the first cash value will be an outflow and the rest will be inflows. In
this case, the initial outflow (investment) should be included in the XNPV
function, and the NPV will be discounted back to the date of this initial
payment. This payment should be entered as a negative number.
Try it! Find the net present value of the stream of cash inflows shown to the
right, where the first is really a payment at the beginning of 2013. (Scroll to
the right for the answer.)
List of Topics sheet
NPV
NPV
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Companies often have investment opportunities where they pay initially and
then receive returns in the future. It is easy to show that the NPV of such an
investment decreases as the discount rate increases. In fact, for large
enough discount rates, the NPV will typically become negative, meaning that
the future returns are not enough to offset the initial payment. The discount
rate at which NPV changes from positive to negative is called the internal
rate of return, or IRR. Specifically, the IRR is the discount rate at which NPV
equals 0.
Companies are interested in IRR for the following reason. Typically, they
have a "hurdle rate" that they use to discount potential investments. If the
NPV of an investment is positive, discounted at the hurdle rate, it is worth
pursuing. If it is negative, it is not attractive. Stated equivalently, the
investment is worth pursuing only if its IRR is greater than the company’s
hurdle rate.
Excel has an IRR function that calculates an investment’s IRR. As with the
NPV function, the investment should be structured so that there is an initial
cash payment at the beginning of year 1 and then regular cash returns at the
ends of years 1, 2, and so on.
This seems strange. Why should you have to guess at the answer? It is
because Excel calculates the IRR iteratively, starting with your guess. Your
actual guess shouldn’t make any difference in the final answer except in
unusual cases.
Try it! Find the IRR for the investment to the right, using an initial guess of
15%. What does this IRR say about the attractiveness of the investment?
(Scroll to the right for the answer.)
Note: The NPV topic in this tutorial describes an XNPV function for cash
flows that don't occur at regularly spaced intervals. There is a corresponding
XIRR function. You can look it up in online help.
List of Topics sheet
IRR
The company will find this investment
attractive only if its hurdle rate is below
19.81% (which it probably is).
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The INDEX function is useful for finding the value in a particular cell of a
rectangular range. You access this value by the indexes of the cell you want.
Specifically, you specify a row index and a column index. For example, if the
range has 10 rows and 20 columns, the indexes 4, 8 indicate the 4th row
and 8th column of the range.
Try it! Find the unit shipping cost from Plant2 to City3 with a formula in the
top gray cell. Then enter a formula in the bottom gray cell that finds the unit
shipping cost from the plant to the city specified in the two cells above it.
This formula should respond appropriately to whatever plant and city
indexes are entered in these two cells. (Scroll to the right for the answers.)
List of Topics sheet
Plant 1
City 2
Unit shipping cost
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
The MATCH function is handy for finding a cell in a range that matches a
given value. It is often used in the following situation. Suppose you have a
decision variable such as order quantity that needs to be chosen to
maximize profit. You enter some formulas that link order quantity to profit.
Then you create a data table that finds the profit for a number of possible
order quantities. The MATCH function lets you locate the order quantity in
the data table with the largest profit.
To use the MATCH function:
Enter the formula =MATCH(value,range,0). This returns the index of the cell
in range that matches value. For example, if the match occurs in the third
cell of the range, this returns 3. The last argument, 0, indicates that you
want an exact match. If there is no exact match, the formula returns an
error. (Actually, the MATCH function can also look for an inexact match by
using a +1 or -1 for the third argument. You can look up the details in online
help.)
The top example to the right indicates how MATCH can be used in
conjunction with INDEX. Imagine that a profit model has led to the table
shown, where each order quantity listed leads to the corresponding profit.
For this small example, it is obvious that the largest profit is $5,640,
corresponding to an order quantity of 300. However, if inputs (not shown
here) that drive the profit model change, the best order quantity and the
corresponding profit could change. You want formulas in the two gray cells
to show the best profit and best order quantity regardless of where they
appear in the table.
Try it! The table to the right shows the profit for each order quantity (along
the side) and each unit stockout cost (along the top). Enter copyable
formulas in the gray range to find the best order quantity for each unit
stockout cost. (Scroll to the right for the answers.)
List of Topics sheet
Profit for various order quantities (column L) and unit stockout costs (row 32)
$2 $3 $4 $5
200 $5,235 $5,175 $5,025 $4,935
250 $5,465 $5,285 $5,190 $5,085
300 $5,355 $5,325 $5,265 $5,100
350 $5,215 $5,195 $5,130 $5,125
400 $5,145 $5,085 $5,015 $5,005
The OFFSET function allows you to reference a range (or a single cell)
relative to another cell. It is hard to appreciate this function unless you see
some examples, so some typical examples are illustrated here.
A good example of the OFFSET function appears in the example to the right.
A company sells to a retailer, and the retailer pays a certain number of
months later, as indicated by the payment delay (in months) in cell L30. The
sales occur as indicated in row 33, but the receipts from the retailer occur
two months later, as indicated in row 34. The goal is to calculate the
receipts from January on.
Without the OFFSET function, you could simply put links in the Receipts row
that point to sales two months earlier. For example, the formula for receipts
in January would be =M33. But what if the retailer decides to delay
payments by three months instead of two? Then you would need to fix the
links in the Receipts row. However, the OFFSET function avoids this updating
of links. You can use the formula =OFFSET(O33,0,-$L$30) in cell O34 for
January and copy it across row 34 for the other months. This formula says
to start in the January sales cell and go a certain number of cells to the left
(because of the minus sign), where this number is specified in cell L30. To
see how it works, change the value in cell L30 to 3 or 1. (If the delay is 3,
you will need to copy the formula ahead to September; if the delay is 1, you
can delete the August formula.)
Try it! Suppose that a manufacturing company buys raw materials from a
supplier. If the cost in any month is $x, the company pays 40% of this cost
one month from now and the other 60% two months from now. Use the
OFFSET function to calculate the payments made in January through
August, based on the costs through July. These calculated payments should
to start in the January sales cell and go a certain number of cells to the left
(because of the minus sign), where this number is specified in cell L30. To
see how it works, change the value in cell L30 to 3 or 1. (If the delay is 3,
you will need to copy the formula ahead to September; if the delay is 1, you
can delete the August formula.)
Try it! Suppose that a manufacturing company buys raw materials from a
supplier. If the cost in any month is $x, the company pays 40% of this cost
one month from now and the other 60% two months from now. Use the
OFFSET function to calculate the payments made in January through
August, based on the costs through July. These calculated payments should
update automatically if you change the inputs in the blue cells. For example,
make sure your formulas react correctly if you enter 2 and 3 in the blue cells
in column N. (Scroll to the right for answers.)
To do this, select the Define Name dropdown in the Formulas ribbon. In the
Name box at the top of the resulting dialog box, enter Sales as the range
name, as shown to the right. In the Refers To box at the bottom, enter the
formula
=OFFSET($L$61,0,0,COUNTA($L:$L)-COUNTA($L$1:$L$60),1).
Then click OK. Finally, enter the formula =SUM(Sales) in the gray cell. Note
that COUNTA($L:$L) returns the number of nonblank cells in column L, and
COUNTA($L$1:$L$60) returns the number of nonblank cells in the first 60
rows of column L. So the difference is the number of sales values in column
L. Therefore, this OFFSET function refers to a range that starts in cell L61
and has as many rows as there are sales values in column L. To see how it
adjusts, enter a sales value for June in cell L66 and watch how the total
changes automatically.
Try it! Create the dynamic range name just described. Then enter the
formula for the total in the gray range, and add a new sales value for June
to see if your formula updates as it should.
Try it! Create the dynamic range name just described. Then enter the
formula for the total in the gray range, and add a new sales value for June
to see if your formula updates as it should.
List of Topics sheet
The INDIRECT function is useful when you have named ranges and want to refer
to these, via labels, in your formulas. For example, suppose you have ranges
named Sales1, Sales2, and Sales3. Each of these is a long column of data. Then
suppose you have labels Sales1, Sales2, and Sales3 in some other cells, say, G1,
G2, and G3. If you enter the formulas =AVERAGE(INDIRECT(G1)),
=AVERAGE(INDIRECT(G2)), and =AVERAGE(INDIRECT(G3)) in cells H1, H2, and
H3, this is the same as entering the formulas =AVERAGE(Sales1),
=AVERAGE(Sales2), and =AVERAGE(Sales3). The name of the function implies
that you are indirectly referencing a range via a label with this range name.
Try it! Name the data ranges in columns L-O by their labels in row 4. Then use
the AVERAGE, STDEV, and CORREL functions, along with the INDIRECT function,
to enter copyable formulas in the gray ranges below. As you should appreciate,
this is particularly useful for the matrix of correlations. (See to the right for the
answers.)
of Topics sheet
Monthly sales
Month Product1 Product2 Product3 Product4
Jan-13 1043 1047 957 1031
Feb-13 993 832 883 796
Mar-13 968 1114 1206 1048
Apr-13 1461 1487 1495 1519
May-13 1137 1183 1035 1045
Jun-13 1103 999 931 1133
Jul-13 1140 1025 1124 982
Aug-13 772 927 797 922
Sep-13 1195 1297 1231 1230
Oct-13 1140 1358 1267 1253
Nov-13 1236 1120 1107 1275
Dec-13 696 573 513 687
Jan-14 749 581 481 711
Feb-14 984 1005 998 804
Mar-14 1114 933 1084 963
Apr-14 758 832 950 745
May-14 307 418 428 508
Jun-14 1055 807 865 1102
Jul-14 1108 1149 1240 1275
Aug-14 1286 1041 919 968
Correlations
Product1 Product2 Product3 Product4
Product1
Product2
Product3
Product4
Total sales
Jan-05
Feb-05
Mar-05
Apr-05
May-05
Jun-05
Jul-05
Smith Jones Wilson Donalds
$6,700 $7,400 $5,800 $9,000 Answer: Open the name manager and look at
the definition of the Sales1 range name.
$5,800 $8,900 $5,500 $7,900
$5,000 $7,900 $5,900 $8,300
$6,700 $5,800 $6,000 $9,700
$9,400 $7,800 $6,700 $8,400
$6,200 $5,800 $9,400 $8,500
$8,700 $5,300 $6,900 $7,500
e name manager and look at
the Sales1 range name.
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Date
Quick Analysis 6-Mar
6-Mar
The Quick Analysis tool, introduced in Excel 2013, is a feature that received 6-Mar
considerable publicity. Starting with a data set such as the one to the right,
the new Quick Analysis tools provide you with instant conditional 6-Mar
formatting, pivot tables, charts, and other results with almost no work. You 6-Mar
can decide how useful this new feature really is. It undoubtedly gives you 6-Mar
very quick results, but it might not give you the results you want.
7-Mar
To see how this works, select the entire data range to the right, including 7-Mar
the labels in row 3. You will see a Quick Analysis icon at the bottom right of 7-Mar
the data range. (Remember that if you are using a pre-2013 version of Excel,
this won't work.) When you click this icon (or press Ctrl+Q), you see the 8-Mar
Quick Analysis options below and to the right. Then you can explore the 8-Mar
possibilities. They are all straightforward.
8-Mar
As an example, if you choose Tables and then choose the first of several 9-Mar
automatic pivot tables, you get the pivot table on the next sheet, which 9-Mar
breaks down the sum of Total Cost by Region. This might or might not be
the pivot table you really want, but at least it gives you a pivot table that 10-Mar
you can then modify as you like. Similar statements can be made about the 10-Mar
automatic charts available from the Charts item. You can decide whether 10-Mar
this is any easier than building the pivot table or the chart you really want
from scratch. 10-Mar
11-Mar
Starting in Excel 2013, two of these Quick Analysis options are duplicated by 11-Mar
two "let us guess what you want" items in the Insert ribbon, shown to the
right. These are the Recommended PivotTables and Recommended Charts
items. They provide exactly the same options for pivot tables and charts as Quick Analysis options
from the Quick Analysis tools.
Pivot tables are a manager's dream. They allow you to "slice and dice" data in all sorts
of ways. Essentially, you use pivot tables to break down variables like revenue or items
sold by categories, such as region, month, and store.
Pivot tables have been in Excel since the late 1990s, and each new version has changed
them slightly. Then Excel 2007 made significant changes to the user interface for pivot
tables. Minor changes have then been made in Excel 2010 and 2013. Regardless of the
version, an argument can be made that no tool in any software package enables you to
get as much information as quickly and easily as Excel's pivot tables.
The only thing that makes pivot tables difficult for some users is that there are so many
options. Whole books have been written about pivot tables. However, rather than read
such books, you can learn the essentials discussed here and then experiment. Don't
worry about making mistakes. Pivot tables are very forgiving, and if nothing else, you
can always start over.
The data set starting in column AA is typical. Each row is a sale to some customer.
The last two variables, Items Ordered and Total Cost, are numeric, so they are
candidates for breaking down by the categorical variables to their left.
To create a pivot table, select any cell in the data set and click the Pivot Table button
on the Insert ribbon. Excel guesses the data range, which you can override if
necessary, and it asks where you want the pivot table to be placed. (Throughout this
topic, refer to the screenshots to the right.)
Try it! Create a pivot table from this data set, and place it on a new worksheet. You
can then use this pivot table to try all of the modifications discussed below. (Note
that there are no pivot tables on this Topic sheet. It contains only screen captures of
pivot tables; they are not "live.")
You will see a blank pivot table as shown to the right, and if the active cell is inside it,
you will see a PivotTable Fields pane and two PivotTable Tools tabs, Analyze and
Design. (The Analyze ribbon was called Options before Excel 2013.) Just remember
that the Fields pane and the pivot table tabs are visible only when the pivot table is
selected. So if they disappear, you now know why.
The key is the PivotTable Fields pane. The top section shows all of the available fields
(columns), and the bottom section shows the four areas you can drag these to.
Rather than read through a long explanation, try the following:
Drag Gender to the Rows area, Region to the Columns area, Paid With to the Filters
area, and Total Cost to the Values area. You have just broken down Total Cost by
Gender, Region, and Paid With. Each number in the pivot table is the sum of Total
Cost for its category values. (See the typical pivot table screenshot below and to the
right.)
Rather than read through a long explanation, try the following:
Drag Gender to the Rows area, Region to the Columns area, Paid With to the Filters
area, and Total Cost to the Values area. You have just broken down Total Cost by
Gender, Region, and Paid With. Each number in the pivot table is the sum of Total
Cost for its category values. (See the typical pivot table screenshot below and to the
right.)
Here are some other things you can do to the pivot table you just built. Try each of
these, hands-on. (Screenshots are not shown for all of these, but if you follow the
directions, you shouldn't have any problems with these modifications.)
1. The default layout for a pivot table (starting in Excel 2007) is called Compact
layout. You might prefer Tabular layout (the only layout in pre-2007 versions)
because it shows the names of the fields in the row and column areas. Both layouts
are shown in the screenshots to the right. You can change the layout through the
Report Layout dropdown on the PivotTable Tools Design ribbon.
2. By default, the sums are for all categories of any variables in the Filters area. To
show sums for VISA sales only, say, click the dropdown arrow next to Paid With and
select VISA.
3. You can hide any row or column categories. For example, click the Column Labels
dropdown list and select only Midwest and West.
4. You can change the way Total Cost is summarized and the way its values are
formatted. To do so, right-click any number in the pivot table and select a
summarizing function from the Summarize Values By dropdown list. For example,
select Average. Then right-click again and select Number Format and choose a
number format in the usual way. Now you see the average of Total Cost for the
various categories. (As an alternative, you can right-click and select Value Field
Settings. This opens a dialog box where you can make several changes at once.)
5. In the bottom section of the Fields pane, drag Gender to the Columns area and
Region to the Rows area. This is called pivoting. In fact, this is why they are called
pivot tables!
6. In the bottom section of the Fields pane, drag any of the fields to a blank space on
the worksheet, or simply uncheck its box in the top section. This removes the field
from the pivot table. There is no requirement that each of the four areas must
contain a field.
7. You can have two or more fields in a given area. For example, drag both Region
and Time to the Rows area. It starts to get "busy," but you are certainly allowed to
do it. Let's say you drag Gender to the Rows area and then you drag Time to the
Rows area. As you will see, the Gender button will be above the Time button in the
bottom section of the Fields pane, and Gender will be the "outer" field in the pivot
table. If you would rather reverse their roles, you can drag the Time button above
the Gender button in the bottom section of the Fields pane.
8. You can sort the values in the Rows or Columns areas through the dropdown
arrows, but the sort order might not be the natural order. For example, drag Time to
the Rows area (and drag any other variables off). The natural order is Morning,
Afternoon, Evening, but this isn't what you get with a sort. To sort appropriately,
select the Morning cell, and place your cursor at the bottom of the cell so that it
becomes a four-way arrow, and drag it up above Afternoon.
9. You can remove the grand totals from the rows and/or the columns. To do so,
the Gender button in the bottom section of the Fields pane.
8. You can sort the values in the Rows or Columns areas through the dropdown
arrows, but the sort order might not be the natural order. For example, drag Time to
the Rows area (and drag any other variables off). The natural order is Morning,
Afternoon, Evening, but this isn't what you get with a sort. To sort appropriately,
select the Morning cell, and place your cursor at the bottom of the cell so that it
becomes a four-way arrow, and drag it up above Afternoon.
9. You can remove the grand totals from the rows and/or the columns. To do so,
right-click any number in the pivot table and select PivotTable Options. This leads to
a dialog box with many pivot table options, including the option to show or hide
grand totals.
Pivot Charts
A pivot table begs for a corresponding chart. Fortunately, it is very easy to get such a
chart, called a pivot chart. Just select the pivot table, click the PivotChart button on the
PivotTable Tools Analyze (or Options) ribbon, and select a chart type. You not only get a
very nice-looking Excel chart, but it updates automatically as you make changes to the
pivot table. The pivot table and the pivot chart are perfectly synchronized.
Try it! Make some changes to the pivot table to see what happens to the chart. This is
almost too good to be true!
Try it! Start over by dragging everything off the pivot table. Now drag Gender to the
row area, Region to the column area, and any variable to the Values area.
If you drag a text variable to the Values area, you get counts by default. But if you
drag a numeric variable to the Values area, you will have to right-click in the pivot
table and select Count from the Summarize Values By list. (It's also a good idea to
change the title right above the pivot table to Count, rather than Count of Total Cost,
for example. The reason is that Total Cost, or whichever variable is in the Values
area, has nothing to do with the counts, so the default label is misleading.)
Each count shows the number of customers in the category. For example, you should
Try it! Start over by dragging everything off the pivot table. Now drag Gender to the
row area, Region to the column area, and any variable to the Values area.
If you drag a text variable to the Values area, you get counts by default. But if you
drag a numeric variable to the Values area, you will have to right-click in the pivot
table and select Count from the Summarize Values By list. (It's also a good idea to
change the title right above the pivot table to Count, rather than Count of Total Cost,
for example. The reason is that Total Cost, or whichever variable is in the Values
area, has nothing to do with the counts, so the default label is misleading.)
Each count shows the number of customers in the category. For example, you should
see that there are 43 females from the Midwest. (Examples appear in the
screenshots to the right).
Sometimes it is more informative to display the counts as percentages. To do so,
right-click in the pivot table and select % of Row Total from the Show Values As list.
You should see, for example, that 26.50% of all female customers are from the
NorthEast. Do it again, but now select % of Column Total. Now you should see, for
example, that 32.26% of all South orders were placed by males.
You can experiment with the other Show Values As options. It all depends on how
you want to "tell the story."
Grouping
Another useful feature is grouping. When you drag a field to the Rows area, for
example, you get a row for each distinct value of the field. If there are many distinct
values, the pivot table becomes unwieldy and probably not very informative. In this
case, it is a good idea to group on the field.
Try it! Start over by dragging all of the fields off the pivot table. Then drag Date to the
Rows area and Total Cost to the Values area.
Note that there is already some summarizing at this point because multiple sales were
made on some of the dates, but there are so many dates that it is difficult to see any
interesting trends through time. So it is useful to group on dates.
Try it! Right-click any date, select Group, and then select Month. Now you see total
sales in each of the four months.
If this data set were over a multi-year period and you grouped by Month, you would
see all of the Januaries lumped together, and similarly for the other months. To see
them broken down by year, the trick is to select Month and Year in the Group dialog
box.
There is a distinct advantage to building a pivot table from a table as opposed to a fixed
range. The advantage is that if you decide to add rows and/or columns to the table, the
Creating a Pivot Table from a Table
There is a distinct advantage to building a pivot table from a table as opposed to a fixed
range. The advantage is that if you decide to add rows and/or columns to the table, the
table expands automatically, and the pivot table can then be refreshed with the click of
a button to accommodate the new data. You do not need to build a new pivot table.
Try it! Designate the data set starting in column AA as a table. It will have a default table
name, such as Table1, which you can change if you like. Then build a pivot table from
the table. You will notice that the Table/Range box shown to the right contains the
name of the table, not a range address. This is what you want. Once you have created
the pivot table, go back and add a new column to the right of the table and/or add
some extra data to the bottom of the table. Go back to the pivot table and click the
Refresh button on the PivotTable Tools Analyze (or Options) ribbon. The pivot table will
automatically be populated with the new data. This is a feature business managers will
love!
Excel 2010 introduced a new feature for pivot tables called a slicer. See the Slicer topic in
this tutorial for more information about this feature. Then add one or more slicers to your
pivot table.
Note: Starting in Excel 2016, there is a multi-select button at the top of a slicer. This is for
touch devices. When you click it, you can then select multiple items using touch input.
Excel 2013 introduced a new Recommended PivotTables button on the Insert ribbon. If you
select a cell in your data set and then click this button, Excel recommends the pivot tables
you might want. If nothing else, this at least gets you started.
Starting in Excel 2016, if you drag a date field to the Rows or Columns area, it is
automatically grouped, say, by month and year. You can then modify the grouping, or
ungroup, if you like.
ungroup, if you like.
List of Topics sheet
Note: Several of the screenshots on this worksheet are to the right of the data,
so scroll across to see them.
It is very common to work with "data sets" in Excel, where a data set is typically a
rectangular range with "observations" in the rows, "variables" in the columns,
and variable names in the top row. (Observations are also called cases or records,
and variables are also called fields or attributes.) A typical data set appears to the
right. Each row is an observation on some person, and each column lists an
attribute about the person.
Excel users have worked with data sets for years, and for a long time, they were
known somewhat informally as lists. But in Excel 2007, they gained much more
prominence
Designating and became
a Data known
Set as as tables. This was a much needed change. You
a Table
can perform many useful tasks with tables that you either couldn't perform
before or could
It is not enoughperform
to haveonly with extra range
a rectangular work. of
Now these
data tasksthe
to apply aretable
easy.tools.
You must designate the range as a table. There are three ways to do this, and
all are easy. For each, make sure any cell in the table is selected. Then (see
screenshots to the right):
1. Click the Table button near the left of the Insert ribbon, or
2. Click the Format as Table dropdown arrow on the Home ribbon and choose
any of the color styles.
3. Press Ctrl+t.
Excel guesses that the range "surrounding" the active cell is the table range in
the Create Table dialog box (see screenshot to the right), but you can override
this if necessary.
Try it! Designate the data set to the right as a table. You will see that the
formatting changes, and you will see two other important changes (see blue
screenshot to the right). First, there is a dropdown arrow next to each
variable name. These are used for sorting and filtering, as discussed below.
Second, if the cursor is inside the table, there is a new Table Tools Design tab
and corresponding ribbon. It contains the tools for manipulating the table.
If you no longer want the range to be designated as a table, you can click
Convert to Range on the Table Tools Design ribbon. The dropdown arrows will
disappear. Only the cell formatting will remain, and you can restore it to
"plain" if you like. Try this on the table you just created.
Filtering in Tables
One of the main uses of tables is filtering, that is, hiding (but not deleting)
rows that don't match various conditions. Filtering is done through the
dropdown arrows next to the column headings. This tutorial won't explain
all of the options because there are so many, but with a little bit of
experimenting, you should be able to master them in no time. Just
remember that they build upon one another. For example, if you filter on
Gender so that only males are showing, and you then filter on Children so
that only people with at least two children are showing, you will see only
males with at least two children.
The screenshots to the right shows filter dialog box for a numeric variable,
Salary. It shows all distinct values of Salary, which you could check or
uncheck, but more importantly, the Number Filters group contains many
useful possibilities, such as Greater Than. Similarly, if you filter on a text
variable such as State or a Date variable such as Birthdate, there are many
Text Filters and Date Filters you can choose from.
Try it! If you haven't already done so, designate the data set to the right as a
that only people with at least two children are showing, you will see only
males with at least two children.
The screenshots to the right shows filter dialog box for a numeric variable,
Salary. It shows all distinct values of Salary, which you could check or
uncheck, but more importantly, the Number Filters group contains many
useful possibilities, such as Greater Than. Similarly, if you filter on a text
variable such as State or a Date variable such as Birthdate, there are many
Text Filters and Date Filters you can choose from.
Try it! If you haven't already done so, designate the data set to the right as a
table, and then experiment with the filters.
To clear a filter, click the column's dropdown arrow and select Clear Filter. To
clear all filters, click the Clear button in the Sort & Filter group on the Home
ribbon. You can also do it from the Data ribbon. (See to the right.)
Sorting in Tables
You probably noticed that when you click a column dropdown arrow, there are
sorting options. This provides one more way to sort in Excel. It is not clear that
sorting in tables provides any advantages over sorting in regular (non-table) data
sets, but it is certainly possible and easy.
One important advantage of a table is that you can summarize filtered data
easily. To do so, check the Total Row box on the Table Tools Design ribbon. This
generates a "total" row below the table. By default, it shows the sum of the
values in the rightmost column, as shown to the right. But it gives you many
more options. If you select any cell in the total row, you will see a dropdown list
of summarizing options for that column (count, sum, average, and others). And
if you then filter the data, the summary measures will be only for the filtered
data. (This couldn't be done, at least not easily, before Excel 2007.)
Try it! Create a total row for the table of people, and show summary measures
that seem appropriate. Then filter in some way and watch how the summary
measures change.
Expanding Tables
A feature of tables that business people will love is that they expand
automatically as new data are added. For example, suppose you designate the
data set to the right as a table. Later you add new products to the right and/or
new months at the bottom. These will automatically be part of the table.
Better yet, if you build a chart from the table, the chart will update
automatically to include new data. The same is true of pivot tables if they are
built from tables.
Try it! Designate the data set to the right as a table. Next, select the entire
Expanding Tables
A feature of tables that business people will love is that they expand
automatically as new data are added. For example, suppose you designate the
data set to the right as a table. Later you add new products to the right and/or
new months at the bottom. These will automatically be part of the table.
Better yet, if you build a chart from the table, the chart will update
automatically to include new data. The same is true of pivot tables if they are
built from tables.
Try it! Designate the data set to the right as a table. Next, select the entire
table and insert a line chart. By default, you should see a line for each product,
with month on the horizontal axis. Now add a couple more months of data at
the bottom of the table and add a new product with some data at the right of
the table. The chart should update automatically!
List of Topics sheet
Filtering on a numeric variable Clear all filters on Home ribbon Clear all filters button on Data rib
Total Row button on Table Tools Design ribbon
$4,000
$3,500
Chart Title
$5,000
3 13 13 13 13 14 14 14 14 14 14 14 14 14 14
p- ct- ov- ec- an- eb- ar- pr- ay- un- Jul- ug- ep- ct-
Se O N D J F M A M J A S O
Data tables, also called what-if tables, allow you to see very quickly how one
or more outputs change as one or two key inputs change. This is often called
sensitivity analysis, or simply what-if analysis, and it is a key part of most
business models.
Business models are all about what-if questions. What would happen to
profit if our unit cost increased by x%? What would happen to our sales if
our competitor's price decreased by y%? And so on. Data tables are perfect
for answering these types of questions in a systematic way, and they are
quite easy to create. Therefore, it is surprising that so few Excel users are
aware of data tables. This is a very valuable tool, so you should definitely
learn it!
There are two types of data tables: one-way data tables and two-way data
tables. A one-way data table has one input and any number of outputs. A
two-way data table has two inputs but only one output. Both of these are
discussed here.
You find the Data Table option (for one-way or two-way data tables) under
the What-If Analysis dropdown on the Data ribbon, as shown to the right.
To illustrate, suppose you buy a new car for $20,000, make a $5,000 down
payment, and finance the remaining amount over the next 36 months at a
6.5% annual interest rate. There are at least two outputs that might be of
interest: the monthly payment and the total interest paid on the loan.
These are affected by the four inputs in blue to the right.
Let’s first look at a simple one-way data table, which illustrates how a single
output, monthly payment, varies as the annual interest rate varies. This is
shown in the example to the right.
Enter a link to the output in cell L39. Specifically, because the monthly
payment was calculated with the PMT function in cell L34, enter the
formula =L34 in cell L39. Then, starting in cell K40, enter any sequence of
interest rates. Next, select the entire table—the range K39:L44. Then select
Data Table from the What-If Analysis dropdown on the Data ribbon. Finally,
enter L31, the interest rate cell, as the column input cell in the resulting
Data Table dialog box shown to the right. There is no row input cell, so leave
it blank.
If one of the input values along the side of the data table equals the original
value of this input, this provides an internal check of your data table. In this
example, the original annual interest rate, 6.50%, is one of the values in the
formula =L34 in cell L39. Then, starting in cell K40, enter any sequence of
interest rates. Next, select the entire table—the range K39:L44. Then select
Data Table from the What-If Analysis dropdown on the Data ribbon. Finally,
enter L31, the interest rate cell, as the column input cell in the resulting
Data Table dialog box shown to the right. There is no row input cell, so leave
it blank.
If one of the input values along the side of the data table equals the original
value of this input, this provides an internal check of your data table. In this
example, the original annual interest rate, 6.50%, is one of the values in the
data table, and the corresponding monthly payments, in cells L34 and L42,
are both equal to $459.74, as they should be.
You can tell that you have a data table by looking at any of the "answer"
cells, such as cell L40. It contains a formula =TABLE(,L31), surrounded by
curly brackets. The part inside the parentheses shows the row and column
input cells, the first of which is blank in this example. The curly brackets
indicate that this is an array formula. Essentially, this means that it is
entered in all of the answer cells of the data table at once, as a group. You
never need to enter this formula; you should create the table as explained
above. However, the formula documents what the answer range contains.
Try it! Create a one-way data table to the right, where the monthly payment
is calculated for each price of car from $18,000 to $25,000 in increments of
$1000 (with the down payment fixed at $5000). (Scroll to the right for the
answer.)
An example appears to the right, where the single input is still the interest rate,
but there are two outputs: monthly payment and total interest paid. This table
is formed exactly as before, using the same column input cell, except that the
data table range now includes column M, and there are links to both outputs in
the gray cells.
Try it! Create a one-way data table to the right that shows the monthly
payments and the total interest paid for each value of the number of payments
from 12 to 48, in increments of 12. (Scroll to the right for the answer.)
data table is structured exactly as before.
An example appears to the right, where the single input is still the interest rate,
but there are two outputs: monthly payment and total interest paid. This table
is formed exactly as before, using the same column input cell, except that the
data table range now includes column M, and there are links to both outputs in
the gray cells.
Try it! Create a one-way data table to the right that shows the monthly
payments and the total interest paid for each value of the number of payments
from 12 to 48, in increments of 12. (Scroll to the right for the answer.)
Two-way tables allow you to vary two inputs, one along a row and one
along a column, and capture a single output in the body of the table. The
example to the right illustrates this, where the annual interest rate and the
amount of the down payment both vary, and the single output is the
monthly payment.
Enter the formula =L34 for the single output in the upper left corner, cell
K102, of the data table. (Again, this cell has been colored gray for
emphasis.) Enter any sequence of down payments to the right of this and
any sequence of interest rates below this. Next, select Data Table from the
What-If Analysis dropdown, and enter L29 as the row input cell and L31 as
the column input cell as shown to the right.
As with one-way tables, you can tell you have a data table by looking at any
of the "answer" cells, such as cell L103. Each contains the formula
=TABLE(L29,L31), surrounded by curly brackets. This formula indicates that
cell L29 is the row input cell and cell L31 is the column input cell. In words,
the values for down payment go across the top row of the table, and the
values for interest rate go down the left column of the table.
Remember that a two-way data table allows only one output. If you want to
analyze multiple outputs, you have to create multiple two-way data tables,
one for each output.
Try it! Create a two-way data table to the right that calculates the total
interest paid for each value of the number of payments from 12 to 60 in
increments of 12, and each down payment from $4000 to $6000 in
increments of $1000. Put the down payments along the top and the
numbers of payments along the side. (Scroll to the right for the answer.)
Some data tables are very long (many rows), and each value might require the
recalculation of a complex business model. Therefore, the recalculation of the
Recalculation and Data Tables
Some data tables are very long (many rows), and each value might require the
recalculation of a complex business model. Therefore, the recalculation of the
entire data table can take a while, several seconds or even minutes. For this
reason, Excel allows you to select the Automatic Except for Data Tables
calculation option from the Formulas ribbon, as shown to the right. In this
case, the data tables won't recalculate until you force them to by pressing the
F9 key.
Try it again! Check that the calculation setting is Automatic (the default
setting), and create any data table to the right. Next, change the calculation
setting from Automatic to Automatic Except for Data Tables and create the
data table again. You should see the same value throughout the table, which is
disconcerting. But you can press the F9 key to get the correct answers. Then
change the calculation setting back to Automatic.
List of Topics sheet
Payment model
Price of car $20,000
Down payment $5,000
Amount financed $15,000
Annual interest rate 6.50%
Number of payments 36
Data table
Interest rate Monthly payment
$459.74
6.00%
6.25%
6.50%
6.75%
7.00%
Data Table dialog box
Data table
Interest Monthly payment Total interest
$459.74 $1,550.46
6.00%
6.25%
6.50%
6.75%
7.00%
Data table for exercise
Number of payments Monthly payment Total interest
Do you remember your high school algebra class where you had to solve a
single equation for a single unknown value? You can do this in Excel with
the Goal Seek tool. The unknown is called a changing cell. Essentially, you
want to change the value in this cell to force a formula in some other cell to
equal a specified value.
A simple example of this appears below and to the right. Demand for a
company's product is determined by a linear demand curve: the higher the
price, the lower the demand. The company produces exactly enough to
meet demand, with the given fixed and variable costs of production. The
company wants to find the breakeven price, that is, the price that makes
profit equal to 0. This breakeven price can be found with Goal Seek. Here
are the steps. (Before you do this, you might see if you can find the
breakeven price by trial and error, by entering different values in cell L32. If
nothing else, this will help you understand the model better, and it will give
you a better appreciation of Goal Seek.)
1. Choose Goal Seek from the What-If Analysis dropdown on the Data
ribbon (see to the right)
2. Fill in the Goal Seek dialog box as shown to the right. Specifically, the
price in cell L32 should be changed so that the profit in cell L39 is driven to
0.
If you try this, you will see the Goal Seek Status dialog box to the right, and
you will see that the the price should be set to $22.57. This price makes
demand equal to 3900, so the company sells 3900 units and makes $2.57
on each of them, which is just enough to offset the $10,000 fixed cost. The
calculations with this unit price are shown in column N.
Try it! Use Goal Seek to find the price that makes profit equal to $30,000.
Note: For numerical reasons, Goal Seek doesn't force profit to exactly the
value you specify; it sometimes only gets close. If this isn't close enough,
you can change an Excel setting to make it closer. Go to Excel Options and
choose the Formulas group. (See below and to the right.) Then change the
"Maximum Change" to a smaller value (more zeros to the right of the
decimal).
List of Topics sheet
Profit model
Fixed cost $10,000 $10,000
Variable cost $20.00 $20.00
Unit price $25.00 $22.57
Profit $9,375 $0
Solver is an add-in that ships with Excel but is developed by Frontline Systems,
not Microsoft. It is used for constrained optimization models. There is much
more about Solver models than can possibly be covered here, but basically,
you must first develop a spreadsheet model that starts with numerical inputs
and values of decision variables (called changing cells), and then uses formulas
that capture the business logic and eventually lead to an objective, such as
profit or total cost, that you want to maximize or minimize. Then you fill out a
Solver dialog box to indicate the objective, the changing cells, constraints that
must be satisfied, and appropriate options. When you click the Solve button,
the add-in uses powerful algorithms to find the optimal solution.
A simple optimization model appears to the far right. The objective is to find
the minimum-cost way to send units of some product from manufacturing
plants to customer regions so that plant capacities are not exceeded and
regional demands are met. The blue ranges contain given inputs (the unit cost
of transportation from plant sites to regions, the demands in the regions, and
the capacities of the plants), the red cells are the changing cells, and the gray
cell is the objective to minimize. You can check the formulas in the yellow and
gray cells that capture the business logic. The formulas are very simple for this
model, but the logic can be much more complex in other models.
You then invoke Solver from the Data ribbon and fill out its main dialog box as
shown to the right for Excel 2010 or later versions. (Scroll down for equivalent
screenshots in pre-2010 versions of Solver. There you have to go to an Options
dialog box to complete the settings.) When you click the Solve button, you will
see the Solver Results dialog box shown to the right, and the solution in the
red changing cells to the right will be found, regardless of the original values in
the red cells. This solution minimizes total cost, while satisfying capacity and
demand constraints.
Note: If Solver is not on your Data ribbon, you will need to add it in. Click the
File menu and Options in Excel 2010 or later (or the Office button and then
Excel options in Excel 2007), then Add-ins, and then the Go button. Check the
Solver item to add it in. If Solver isn't in the list below, you will need to run the
Office installer to install it.
Solver was upgraded in Excel 2010. If you have used earlier versions of Solver, you will
see two basic changes.
First, the user interface has been streamlined, as shown to the right. In particular, for
most optimization models, you no longer need to go to the Options dialog box. You
can now check the nonnegativity option and choose an appropriate Solver algorithm
from this initial screen.
Units shipped
From
Total cost
To
Units shipped Region 1 Region 2 Region 3 Region 4 Total shipped Capacity
Plant 1 150 0 0 300 450 <= 450
Plant 2 100 200 0 0 300 <= 600
Plant 3 200 0 300 0 500 <= 500
Total received 450 200 300 300
>= >= >= >=
Demand 450 200 300 300
$176,050
Solver Options dialog box in pre-2010 versions
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Power BI
Data Model
The Data Model introduced in Excel 2013 is a technology that lets you work with
multiple-table data sets, all within Excel. The tables can be from a variety of sources,
including text files, Web pages, relational databases, and others. Also, because of the
special way the data are stored in a Data Model, the tables can be huge, even multi-
million row tables. Excel tools can then be used to relate the tables (assuming they are
relatable through key fields). Finally, pivot tables or reports can be created from the
underlying Data Model. Similar functionality has been possible in Excel for years, but it
always required you to create a relational database first, with Access or another
database system, or relate Excel tables with multiple VLOOKUPS. Now you can do it
much more easily, entirely with Excel tools.
Once you have a Data Model in an Excel workbook, you will probably use Power Pivot
to create pivot tables based on the data. In fact, it is easy to confuse Data Model with
Power Pivot, and many users believe that they are the same thing. They are not.
Actually, your version of Office, such as Office 365 Home, might contain the Data
Model but not Power Pivot. (You get Power Pivot only with a higher version of Office,
such as Professional Plus.) In this case, the Data Model allows you to store and relate
tables from various sources, and to build pivot tables (or reports) from the data.
However, without Power Pivot, you don't get a user interface for working with the Data
Model, and you don't get various advanced tools available with Power Pivot.
If you have Power Pivot, you can learn some of its tools from the Power Pivot topic in
this tutorial. But even if you don't have Power Pivot, you can still use the Data Model to
perform powerful data analysis, as discussed next.
Important note: The following instructions apply to Excel 2013 or later with Power
Pivot installed. (The screenshots come from Excel 2016, and there might be slight
differences in Excel 2013.)
Assume there are three sources of external data: (1) an Access database with five
tables, related as shown above to the right; (2) a Stores file in Excel which will
eventually be related to the Sales table through the StoreKey fields; and (3) a comma-
delimited (csv) Geography file which will eventually be related to the Stores table
through the GeographyKey fields.
1. Click the Manage button on the Power Pivot tab. This takes you to a Power Pivot
window where you can manage, and see, your eventual Data Model. The window has
several tabs and associated ribbons, but only the Home ribbon is used here.
2. Select From Access from the From Database dropdown. Browse to the Access file
and then check all of the tables, all five of them, to be imported. Once you click Finish,
the data will not be loaded into physicial Excel tables; they will be loaded into the Data
Model.
2. Repeat step 1 for the single table in the Stores file. This time you will select Excel File
from the From Other Sources list. The user interface will be slightly different, but the
process is straightforward. (In the second step of the wizard, it is a good idea to change
the Friendly Name from Data to Stores, which shows up in the tab to the right.)
3. Repeat step 2 with obvious modifications to import the data from the Geography
file. This time you will select Text File from the From Other Sources list.
4. The imported data now appear as seven tabs in Data View of the Power Pivot
window, very much like an Excel spreadsheet.
5. You can click the Diagram View button to see the relationships between the tables.
The first five tables are already related because they were related in the Access file.
However, the Stores and Geography tables need to be related. This can be done by
the Friendly Name from Data to Stores, which shows up in the tab to the right.)
3. Repeat step 2 with obvious modifications to import the data from the Geography
file. This time you will select Text File from the From Other Sources list.
4. The imported data now appear as seven tabs in Data View of the Power Pivot
window, very much like an Excel spreadsheet.
5. You can click the Diagram View button to see the relationships between the tables.
The first five tables are already related because they were related in the Access file.
However, the Stores and Geography tables need to be related. This can be done by
dragging from the StoreKey field in the Sales table to the StoreKey field in the Stores
table, and dragging from the GeographyKey field in the Stores table to the
GeographyKey field in the Geography table. The completed diagram view is shown to
the far right.
You have now created a Data Model, which is really just a set of related tables. It is
stored with the Excel file, but it is stored very compactly, and you can see it only in the
Power Pivot window. Then you can click the PivotTable button on the Home ribbon of
the Power Pivot window to create a pivot table in the usual way, based on any or all of
the related tables. Alternatively, you can close the Power Pivot window and create a
pivot table in the usual way from the Insert ribbon, as shown below. Note, however,
that the source for the pivot table is now the Data Model.
The method explained here for creating a Data Model is not the only possible method.
Watch the companion video to see another slightly different method.
Return to List of Topics sheet
work with
ety of sources,
because of the
e, even multi-
suming they are
ated from the
l for years, but it
r another
you can do it
er Pivot topic in
he Data Model to
r with Power
ht be slight
se with five
hich will
nd (3) a comma- Geography data in text file
tores table
Power Pivot
he window has
here.
he Access file
you click Finish,
ed into the Data
Data View in Power Pivot Window
he Geography
.
wer Pivot
he Geography
.
wer Pivot
d tables. It is
see it only in the
Home ribbon of
d on any or all of
w and create a
ote, however,
ossible method.
Power Pivot
The Excel Data Model, described in another topic in this tutorial, lets you
relate tables of data much like relational database software has been doing
for decades, but now it is done entirely inside Excel. The current topic
discusses Power Pivot, arguably the most popular component of the Power BI
suite. Power Pivot, as the name suggests, is related to pivot tables, but Power
Pivot is more flexible and provides more powerful tools than normal pivot
table tools. In part, it is a front end, or user interface, for working with the
Data Model, but it is much more. You can build pivot tables from a Data
Model without using Power Pivot, but Power Pivot makes the process easier
and it provides many advanced options.
Power Pivot does not ship with all versions of Office. At least for Office 2016,
you need the Professional Plus version or higher. And even if you have Power
Pivot, it is an add-in that you need to load. To do so, make sure the Developer
tab is visible. (If it isn't, right-click a ribbon, select Customize the Ribbon, and
check the Developer item in the right pane of the resulting Customize dialog
box.) Then check the Power Pivot item in the COM add-ins list. (If this item is
not in your list, then your version of Office does not include Power Pivot.)
Once Power Pivot is loaded, you will see a Power Pivot tab with the
associated ribbon shown to the right.
Probably your first question is how the Data Model and Power Pivot benefit
you. Here are the main benefits:
1. The Data Model and/or Power Pivot let you merge data from multiple
tables without using database software or VLOOKUPs within Excel. As the
Data Model topic in this tutorial indicates, it is now easy to manage
relationships across tables by using primary and foreign keys, all within Excel.
2. The Data Model and/or Power Pivot enable you to base a pivot table on
huge tables with millions of rows. They are limited only by the 2GB maximum
file size for a workbook and your computer's available memory.
3. With Power Pivot, you can create measures with the DAX (Data Analysis
Expressions) language. This is probably the most difficult part of Power Pivot
to master, but it is worth the effort. Measures with DAX provide many more
possibilities than regular pivot table calculated fields, and they can be
extremely powerful. (Note: Microsoft has gone back and forth on the
terminology. The original term used was "measures." Then in Excel 2013, they
were renamed "calculated fields." Now with Excel 2016, the original term
"measures" is back, and most analysts are glad to see it. In addition, Microsoft
finally had the sense to put a space between Power and Pivot!)
The rest of this explanation assumes that you do have Power Pivot and that it
is loaded. Now you are ready to get started. Because the procedure requires
quite a few steps, only a brief discussion of the procedure is given here.
Power View
Power View is an add-in in the Power BI suite that lets you create quick but
insightful reports based on data in a Data Model.
Power View does not ship with all versions of Office. At least for Office 2016,
you need the Professional Plus version or higher. And even if you have Power
View, it is an add-in that you need to load. To do so, make sure the Developer
tab is visible. (If it isn't, right-click a ribbon, select Customize the Ribbon, and
check the Developer item in the right pane of the resulting Customize dialog
box.) Then check the Power View item in the COM add-ins list. (If this item is
not in your list, then your version of Office does not include Power View.)
Once Power View is loaded, you should see a Power View item on one of the
ribbons -- but you don't. For some reason, Microsoft deleted the Power View
button that was on the Insert ribbon in Excel 2013. However, it is still available
by customizing the ribbon. To do so, right-click any ribbon, select Customize
the Ribbon, select Insert a Power View Report from the All Commands list on
the left, and drag it to a ribbon (and a position on the ribbon) of your choice. I
did this, adding the Power View button to the Insert ribbon (as it was in Excel
2013), as shown to the right.
The rest of this explanation assumes that you do have Power View and that it
is loaded and available. Now you are ready to get started. Because Power
View provides so many options, only a brief discussion is given here.
The 3D Map option, available on the Insert ribbon, implements the Power
Map tool in the Power BI suite. It lets you create maps of geographical
information with a few clicks. The example to the right is typical. The data set
lists the numbers of customers for some product in various states and cities.
To get the map on the right, just select any cell in the data range and click
Open 3D Maps. A 3D map opens in a new window, and from there, it is just a
matter of adding elements to the map. You could probably read a long
explanation of the various options, but it's better to simply experiment. The
map shown, with a bubble for each city with size proportional to the number
of customers, required only a couple mouse clicks.
The map to the right is a static map. To make it dynamic, you could change
the data set to have a date column, with the number of customers in each
city and state listed for each date. Then you could "play" the resulting map to
show the changes in time.
Try it! Do exactly what the preceding paragraph suggests. You can make up
the dates and the customer data.
List of Topics sheet
As discussed in the Importing External Data section of this tutorial, Excel has
long contained a number of tools for importing data, and these "old" tools
continue to work fine. However, Microsoft has recently been developing
newer and better tools for importing data, and these newer tools are
collectively referred to as Power Query. Starting in Excel 2016, they are built
into Excel, and you can find them on the Data ribbon in the Get & Transform
group, as shown to the right.
1. For tables from a relational source such as Access, you can join the tables
inside Access and save the result as an Access query. Then you can use
Power Query to import this saved query as a table.
2. You can use Power Query multiple times, each time importing a single
table. Then you can use its Merge option to join the queries, resulting in a
single joined table.
3. You can use Power Query multiple times, each time importing a single
table. Then you can use its Load To option to load each table to an Excel
Data Model. Then you can use Excel's Relationships tool to create
relationships between the tables. Power Query Navigato
Note that any queries you create with Power Query are saved with the Excel
workbook. Then to see and possibly edit any of them, you can click Show
Queries on the Data ribbon. This opens a Workbook Queries pane at the
right of the worksheet.
If you are used to the older tools for importing data into Excel, you might
question whether it is worth your time to learn a new set of tools. There are
several good reasons for doing so.
1. You can connect to more data sources, including Facebook, OData feeds,
and others, and the list will almost certainly grow in the future.
2. Even when the Power Query sources are the same as with Get External
Data, Power Query improves on the native functionality. For example,
Power Query is able to extract from far more Web pages than the "From
Web" option in Get External Data.
3. Queries with Power Query are saved as a series of steps, so they can be
automated with a single click at a later time. This saves a lot of repetitive
work if you perform the same types of queries on a regular basis.
4. Power Query provides tools in its user interface for filtering, aggregating,
sorting, and other operations. In short, it provides a simpler and friendlier
environment for managing queries.
5. Assuming you have the right version of SharePoint, you can share queries
Web" option in Get External Data.
3. Queries with Power Query are saved as a series of steps, so they can be
automated with a single click at a later time. This saves a lot of repetitive
work if you perform the same types of queries on a regular basis.
4. Power Query provides tools in its user interface for filtering, aggregating,
sorting, and other operations. In short, it provides a simpler and friendlier
environment for managing queries.
5. Assuming you have the right version of SharePoint, you can share queries
from Power Query with other users.
Queries options
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Excel's strength lies in its ability to analyze data. However, the data you want
to analyze will not always reside in an Excel worksheet. The data might be on
a Web site, in a text file, in a database, or in some other source. The
question, then, is how you can import the required data into Excel.
Fortunately, Excel has some very powerful tools for importing data, both
"old" and "new." The older tools, discussed in this section of the tutorial,
have been part of Excel for years, and they still work fine. You can find them
in the Get External Data group on the Data ribbon, shown to the right.
(Depending on the size of the Excel window, the Get External Data group
might appear as a single Get External Data dropdown.)
The newer tools comprise Power Query, part of the Power BI suite that is
discussed in another section of this tutorial. These tools are in the Get &
Transform group to the right of the Get External Data group.
Many Excel users are comfortable using the older tools and will probably
continue to use them (assuming that Microsoft continues to support them).
However, if you are new to importing external data, we highly recommend
the newer Power Query tools.
Get External Data on Data ribbon
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Data sets are often stored in "plain vanilla" text files, usually with a .txt, .dat, or
.prn extension, simply because everyone can view text files. All you need is a
text editor, such as Notepad. Fortunately, Excel has a wizard for importing data
from a text file into Excel. It is easy to use, but you have to be careful that
everything lines up properly in the import.
Text files come in two varieties: fixed width and delimited. In a fixed width data
set, each variable starts in the same column. For example, First Name might be
in columns 1-15, Last Name might be in columns 16-30, and so on. This is a
carryover from the old days of IBM punched cards, but fixed width text files are
still fairly common. In contrast, in a delimited text file, pieces of data are
separated by a delimiter character, the most common being a space, a tab, a
common, and a semicolon. You can tell that a data set is delimited when you
open it in a text editor and see that the columns don't line up; they are
"ragged."
Once you understand this distinction, importing text data is easy. To do so, click
the From Text button in the Get External Data group on the Data ribbon (see to
the right), and then browse to find your text file. This launches a three-step
wizard, shown in the three dialog boxes to the right.
In the first dialog box, you can see from the data in the first few rows that the
data are not fixed width, so Delimited is the correct choice. You also have the
option to start the import at a row other than the first row. Text files often
have data you don't want to import in the first few rows.
In the second dialog box, you can choose the delimiter, in this case, a comma.
In the third dialog box, you can fine-tune the import, but it usually suffices to
click the Finish button. If any fine-tuning is necessary, you can do it in Excel.
There is a final dialog box, not shown here, where you can select the location
of the imported data. For this example, the imported data are listed below.
Always look carefully at the imported data to make sure everything lines up
correctly. If it doesn't, you have to fix the imported data or fix something in the
original text file. One "small" error, such as when some of the Salary values
end up in the Age column, can completely mess up the data to be analyzed.
Note: Starting in Excel 2016, another option is to use Power Query, which is
discussed in another topic in this tutorial. (You select From File and then From
Text from the New Query dropdown.
Faculty Support StaSupply Budget
Credit HourResearch Pubs
Business
150 70 5
15 225
Education
60 20 3
5.4 70
Arts & Sciences
800 140 20
56 1300
HPER
30 15 1
2.1 40
No. 2
List of Topics sheet
The other topics in this section of the tutorial explain how to import data
from the Web or from a text file. Although these operations are common,
they probably aren't as common as the importing method described here:
importing data from a database. This is a huge topic, and this tutorial only
scratches the surface.
There are many database packages available for storing data, including
Microsoft Access (part of the Office suite) and many server-based systems
such as Microsoft's SQL Server, Oracle's RDBMS, IBM's DB2, and others.
Fortunately, all of these store data in essentially the same way: as related
tables, where each table stores information about a particular entity such as
a product, a customer, or a vendor. Also, they all use essentially the same
query language, Structured Query Language, or SQL, to retrieve specific
subsets of the data. Because of this commonality across database packages,
technologies have been developed over the past two decades that allow
users, often programmers, to import database data into applications,
including Excel.
The simplest way to import database data into Excel, and the only one
described in detail here, is to use the From Access button in the Get Named queries (top ic
External Data group on the Data ribbon, shown above and to the right. After
you then browse for an Access database file, you have two options. The first
is to import one or more tables. (The option to select multiple tables was
introduced in Excel 2013.)
The second possibility is more flexible. You can import data from a named
query in an Access file. For example, the list to the right includes several
named queries from the famous Northwind database provided by
Microsoft. This means that you should first create queries of interest in
Access, and save them, before importing the data into Excel. Of course, this
assumes that you know how to create queries through Access's user
interface. This is not difficult, but it takes some practice.
Other import options appear under the From Other Sources dropdown list
shown to the right. The most common of these is From Microsoft Query.
Only the outline of the procedure is given here. Basically, it is a three-step
process.
1. You identify the data source and the type of database you have: Access,
SQL Server, Oracle, or whatever. In case of a server-based system, you must
identify the server and probably provide a valid username and password. Microsoft Query in the
2. You create a query for the data you want. You can do this through a user
interface that is very similar to the one in Access, or you can enter an SQL
statement directly.
3. You tell Microsoft Query to return the data to Excel, in a location of your
choice, either as a table or a pivot table.
Note: Starting in Excel 2016, another option is to use Power Query, which is
discussed in another topic in this tutorial. (You select From Database and
then From Microsoft Access Database from the New Query dropdown.
This procedure creates a link to the underlying database source, so that if
there are changes to the database, you can do a refresh in Excel to get the
latest data.
Note: Starting in Excel 2016, another option is to use Power Query, which is
discussed in another topic in this tutorial. (You select From Database and
then From Microsoft Access Database from the New Query dropdown.
From Access button on Data ribbon
Named queries (top icons) and tables (bottom icons) in Northwind database
Microsoft Query in the From Other Sources list on the Data ribbon
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Web Queries
To say the least, there is an abundance of interesting data on the Web. Because
Web authors can design their sites in a variety of ways, there is no guarantee that
the Web data can be imported easily into Excel, but it is worth trying with a Web
query, a simple and powerful tool.
To understand how Web queries work, you need to understand a little about
Web pages. They are all written in HTML, a markup language that has "tags" to
identify different parts of a page. One such tag is the Table tag. It often indicates
a rectangular array of data, but it is also used for all sorts of things that aren't
really tables. In any case, a Web query can import anything that is surrounded by
table tags. You can then decide which "tables" are of interest to you.
Try it! First open your browser, locate a website that has data you want to
import, and copy its URL. For this example, you could use the URL for monthly
IBM stock prices from November 2013 back to 2000:
http://finance.yahoo.com/q/hp?
s=IBM&a=0&b=1&c=2000&d=10&e=1&f=2013&g=m
Then, starting in a blank workbook, click From Web in the Get External Data
dropdown on the Data ribbon, as shown above and to the right. This opens the
New Web Query dialog box to the right. Paste your URL into the Address box and
click Go. The Web page will open, hopefully with one or more yellow arrows
corresponding to the table tags on the page. Find the one(s) you want and click
them, which changes them to green check marks. Then click Import.
The Import Data dialog box to the right lets you choose where to start the
import. Just make sure there is plenty of blank space below and to the right of
the selected cell. Note that not all of the data are imported. This particular
website sends back only a certain number of data items per query.
Excel remembers the source of this data and keeps a link to it. The connection in
the current workbook was removed, but to see it in your own workbook, you can
click the Connections button on the Data ribbon. You will see the Workbook
Connections dialog box to the right. (The connection has the generic name
Connection, but it can be renamed as shown. ) From here, you can do several
things. First, in case the Web data change through time, you can click Refresh to
get the newest data. Second, you can click Properties, then the Definition tab,
and then the Edit Query button to return to the New Web Query dialog box.
Finally, if you don't want a live link to the website, you can click Remove, as was
done here.
Note: Unfortunately, the Web query method described above doesn't work on a
lot of promising websites. The good news, however, is that, starting with Excel
2016, you can import Web data with Power Query, described in another topic in
this tutorial. (You select From Other Sources and then From Web from the New
Query dropdown.) Our experience is that the Power Query method works on
many websites where the "old" method described above does not work.
List of Topics sheet
General Documentation
Insert comment
Cell Comments
To insert a cell comment in a cell, right-click the cell. If there is no existing cell
comment, you will see an Insert Comment item. If there is an existing cell
comment, you will see Edit Comment and Delete Comment items. (See the
screenshots to the right.)
Try it! Add the following cell comment to the gray cell to the right: Sales are
in $1000s. Then change the comment to: Monthly sales in $1000s. Then
delete the cell comment.
For more on cell comments, visit the Comments group on the Review ribbon.
You might not ever use all of these buttons, but they could be handy if
someone gives you a spreadsheet with a lot of cell comments, and you want
to browse through them quickly.
When you add explanations to your worksheets, do you tend to start typing
in a cell, and when it gets long enough, you continue typing on the next
line, etc.? Many people do this, but it is not a good habit, mostly because of
the difficulty of editing. It is much better to use text boxes, as you see
throughout this tutorial. Text boxes are much better for explanations than
cells because they have word wrap. They are essentially mini-word
processors that can be edited (and moved or resized) easily. You should use
them in virtually every spreadsheet you create!
To insert a text box, click the Text Box button on the Insert ribbon, as shown
to the right, and drag a text box in some area of the worksheet. Then start
typing. It's as easy as that.
line, etc.? Many people do this, but it is not a good habit, mostly because of
the difficulty of editing. It is much better to use text boxes, as you see
throughout this tutorial. Text boxes are much better for explanations than
cells because they have word wrap. They are essentially mini-word
processors that can be edited (and moved or resized) easily. You should use
them in virtually every spreadsheet you create!
To insert a text box, click the Text Box button on the Insert ribbon, as shown
to the right, and drag a text box in some area of the worksheet. Then start
typing. It's as easy as that.
You might also want to change the appearance of the text box. To do so,
click it twice so that the border becomes a solid line. (It's a dashed line after
the first click). Then you will see a Drawing Tools Format tab and associated
ribbon where you can make all sorts of changes. For example, in this tutorial
all text boxes are rounded in two corners and have a blue border. If you like
the appearance, you can right-click the text box and choose the Set as
Default Text Box item. Then every other text box you create in that
workbook will automatically have the same appearance.
Try it! Create a text box to the right and enter some text. Then see if you
format it like the text boxes in this tutorial.
Note again that if you click a text box once, its border becomes a dashed
line. If you then click it again, it becomes a solid line. The options available
are slightly different in these two cases. For example, if you want to delete a
text box, you should make the border a solid line and then press the Delete
key. In contrast, if you press the Delete key when the border is dashed, you
will delete some text.
When you add text boxes (or other shapes such as circles, rectangles, and
arrows) to a worksheet, they essentially "float" above the worksheet cells. If
you then insert rows or columns under these shapes, or if you change row
heights or column widths under them, the shapes might move or expand. You
might want this behavior, or you might not. In either case, you can control the
behavior. To do so, right-click a shape, such as a text box, and select Size and
Properties. The dialog box to the right appears. (This is for Excel 2013, where
the user interface changed noticably.) You can then select the "Object
positioning" option you want under Properties. For example, if you want the
shape to stay fixed in the same size and position, select the "Don't move or
size with cells" option, as shown here.
By default, a shape such as an oval is opaque, with a blue fill and a darker blue
border. But if you select it, you get the Drawing Tools Format tab and
associated ribbon, where you can format the shape in an endless number of
ways.
Insert comment Edit or Delete comment Sales
15.3
14.7
9.6
12.1
14.2
Conditional Formatting
Background on Conditional Formatting
There are also three options at the bottom of the main Conditional
Formatting list: New Rule, Clear Rules, and Manage Rules. The New
Formatting Rule dialog box shown to the right lets you build a new rule, and
the possibilities are almost unlimited. The Clear Rules option (dialog box not
shown) lets you delete rules for the selected range or for the entire
workbook. Finally, the Manage Rules dialog box shown to the right lets you New Formatting Rule d
see and edit the rules, if any, for the current selection or any of the
worksheets in the current workbook.
Exam score
Applying Some Simple Conditional Formatting 62
A typical use of conditional formatting is to color all "high" values one color
and all "low" values another color. In the exam scores to the right, suppose
you want to color all high scores green and all low scores red, where a high
score is greater than the value in the green cell and a low score is less than
Applying Some Simple Conditional Formatting
88
A typical use of conditional formatting is to color all "high" values one color 77
and all "low" values another color. In the exam scores to the right, suppose
you want to color all high scores green and all low scores red, where a high 62
score is greater than the value in the green cell and a low score is less than 94
the value in the red cell. To do so: 68
1. Select all exam scores in column K. 73
61
2. Click the Conditional Formatting dropdown, then Highlight Cell Rules, and 99
then Greater Than.
94
3. In the Greater Than dialog box, enter a cell reference to the green cell 88
and select a green format of your choice.
82
4. Repeat steps 2 and 3 in the obvious way for the low values. 87
65
Try it! Perform the above steps. Then change the values in the green and
red cells in column N to see how the formatting changes automatically. 82
70
To delete the formatting, click Conditional Formatting and then Clear Rules. 94
To change the formatting rules, click Conditional Formatting and then 80
Manage Rules. You can experiment with the possible options. 96
Person
Other Built-in Conditional Formatting Possibilities 1
2
As you can see when you click the Conditional Formatting dropdown, there
are a lot of built-in choices that are very easy to apply. Try out some of the 3
following: 4
5
The Highlight Cell rules let you format numbers that satisfy inequalities, as in
the example above, and they also let you format text or dates that satisfy 6
natural conditions. 7
8
The Top/Bottom rules let you format the top (or bottom) x items (or x
percent of items), where you can choose x. For example, you can format the 9
maximum number in a list by specifying the top 1 item. 10
11
The Data Bars, Color Scales, and Icon Sets are amazing -- and they can be
overdone. The point of all of them is to differentiate levels of values, such as 12
salaries or sales values. 13
Try it! Use any interesting formats you like to format the dates, text, or 14
numbers to the right. Remember that you can always modify the formats or 15
clear them. 16
17
Try it! Use any interesting formats you like to format the dates, text, or
numbers to the right. Remember that you can always modify the formats or
clear them.
18
19
20
21
22
Scroll down for more below… 23
24
25
26
27
28
29
30
Month
Building Your Own Conditional Formatting Rules with Formulas Jan-13
Feb-13
You can get even more control by building your own rules. You do this by Mar-13
clicking Conditional Formatting and then New Rule. The resulting dialog box
has more options than can be explained here, but the following explains Apr-13
one typical and useful possibility. May-13
Jun-13
The data set to the right contains monthly sales data for six regions.
Actually, they have been entered as random numbers with the Jul-13
RANDBETWEEN function, so if you press the F9 key, they will all change in a Aug-13
random way. (This makes the example even more impressive!) Suppose you Sep-13
want to color the maximum sales value in each column green. One way is to
do it separately for each column, formatting the top 1 item as explained Oct-13
above. However, this would take too much time, especially if there were Nov-13
many more columns. Here is a better way.
Dec-13
1. Select all the dollar values, dragging from the top left cell. This makes the
top left cell the active cell, the one in white.
2. Choose New Rule from Conditional Formatting, and select "Use a formula
to determine which cells to format".
3. In the "Format values where this formula is true:" box, enter the formula
=(L107=MAX(L$107:L$118)). Make sure you get the dollar signs right. Then
select a green format of your choice.
Try it! Apply the above steps to the sales data. Apply a similar formula to
format the minimum value in each column red. Then press the F9 key a few
times and watch how the green and red cells bounce around.
Once you understand how this formula works, you can do some amazing
conditional formatting. Remember that you selected the entire sales range,
but L107 is the active cell because you started the dragging from it. The
formula as written applies to cell L107. Specifically, if its value is the
maximum value in column L, it is formatted green. But because the entire
sales range is selected, the formula is applied, in a relative/absolute sense,
to each cell in the range. The rows in the MAX function are absolute
because the maximum is always over these rows, but the columns in the
MAX function are relative because you want this formula to apply to all cells
in all columns. And L107 is totally relative because you want this rule to be
applied to every cell in the range.
maximum value in column L, it is formatted green. But because the entire
sales range is selected, the formula is applied, in a relative/absolute sense,
to each cell in the range. The rows in the MAX function are absolute
because the maximum is always over these rows, but the columns in the
MAX function are relative because you want this formula to apply to all cells
in all columns. And L107 is totally relative because you want this rule to be
applied to every cell in the range.
Conditional Formatting button on Home ribbon
Conditional Formatting options Higlight Cell Rules options Top/Bottom Rules options
At some point, you might be developing spreadsheets for others to use, and you
might want to force them to use certain values in certain cells because other
values wouldn't make sense or wouldn't satisfy business rules. You can do this
fairly easily with data validation. There are actually many possibilities, but only
the most common are illustrated here. All of the options are found from the
Data Validation item on the Data ribbon shown to the right. This leads to the
fairly self-explanatory Data Validation dialog box also shown to the right. All of
the examples below assume you have selected the cell you want to validate, and
they assume that you have opened this dialog box and have chosen the Settings
tab.
The Data Validation dialog box has two other tabs, Input Message and Error
Alert. The first allows you to create a message that the user sees when the
cell is selected. The second allows you to create a message that appears if an
incorrect value is entered in the cell.
Try it! Force the values in the gray cells in column K to have values indicated
by the labels to their right. Add your own input messages and error alerts.
Then try entering appropriate and inappropriate values in the gray cells.
Probably the easiest data validation is to allow the user to choose from a
dropdown list of values. To do this, first create the list in some column, usually
out of sight to the far right. Then from the Allow dropdown in the Data
Validation dialog box, select List, and in the Source box, provide a cell
reference to the list. That's all you need to do. When the user selects the cell
to be validated, a dropdown arrow automatically appears, with the values in
the list to choose from.
Try it! The example to the right lets a user enter an amount to be financed, an
annual interest rate, and a term (number of months to pay), and it returns the
monthly payment (using the PMT function that has already been entered).
Create a list in a column out to the right that contains the possible terms: 12,
24, 36, 48, and 60, and then create a data validation for the term cell that lets
out of sight to the far right. Then from the Allow dropdown in the Data
Validation dialog box, select List, and in the Source box, provide a cell
reference to the list. That's all you need to do. When the user selects the cell
to be validated, a dropdown arrow automatically appears, with the values in
the list to choose from.
Try it! The example to the right lets a user enter an amount to be financed, an
annual interest rate, and a term (number of months to pay), and it returns the
monthly payment (using the PMT function that has already been entered).
Create a list in a column out to the right that contains the possible terms: 12,
24, 36, 48, and 60, and then create a data validation for the term cell that lets
the user choose from these values. Check that it works.
Validating a Date
Suppose you want to make sure the person enters a valid date in a cell. This is
a great place for data validation. By choosing the Date option from the Allow
dropdown list, you can force users to enter only values that are recognized as
dates. This is no small achievement!
In addition, you can put limits on the dates. For example, suppose you want
the person to enter the date she took out a loan. This must not only be a date,
but it can't be in the future. To allow only such dates, you can select "less than
or equal to" from the Data dropdown and then enter the following formula in
the End date box: =TODAY(). The effect is that the user will not be allowed to
enter a future date, regardless of today's date.
Try it! Create the date validation just described in the gray cell to the right.
Then enter incorrect and correct entries to see how it works. (Can you change
it so that only dates that are at least a week ago are allowed? Just change the
formula slightly.)
List of Topics sheet
Date of loan
or these values)
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
If you create an Excel file for others to use, you probably don't want them to
mess up the formulas you entered so carefully. In fact, you might not even
want them to see the formulas. Maybe they are company secrets. Excel
gives you plenty of options for protecting, or unprotecting, your work. Only
a few of them are explained here. You can then experiment with others.
The key idea is locking cells. Right-click any cell on this worksheet, select
Format Cells, and click the Protection tab. You will see that the Locked
option is checked. By default, all cells are locked until you unlock them.
However, this locking has no effect until you protect the worksheet (or the
workbook). Therefore, protecting is a two-step process.
1. Unlock all cells you want users to have access to. These are typically input
cells where a user can enter data like unit cost, amount ordered, and so on.
2. Protect the worksheet (or workbook). To do this, select Protect Sheet (or
Protect Workbook) from the Review ribbon, as shown to the right. For
example, when you select Protect Sheet, you see the Protect Sheet dialog
box to the right. You clearly have a lot of options for what you want to allow
users to do. With the settings shown, users will be allowed to select locked
cells but not modify them. If the "Select locked cells" were unchecked, users
wouldn't even be allowed to select locked cells, so any formulas in these
cells would be hidden. Note that you can also add a password when you
protect a worksheet or workbook. Just be careful to remember it.
Otherwise, you won't be able to unprotect (and then modify) your own
work!
List of Topics sheet
Developer Ribbon
Developer Ribbon
There is one built-in tab in Excel 2007 and later versions, the Developer tab,
that is not visible by default. It is primarily for developers, those who create
applications for others to use, usually with macros, but it has other uses as
well, so it is a good idea to make its tab visible.
To make the Developer tab visible (in Excel 2010 and later versions):
Checking the Develope
Right-click any ribbon and select Customize the Ribbon to display the dialog
box to the right. In the right pane, check the Developer option. If there is no
Developer item in the right pane, go to the left pane, select All Tabs from the
"Choose commands from" dropdown list, select the Developer tab, and click
the Add>> button to move it to the right pane.
One advantage of showing the Developer ribbon is that you can get to the list
of add-ins (either "regular" add-ins or COM add-ins) with a click of a button.
Without these buttons, the ones circled to the right, it takes four clicks to get
to either add-ins list.
Developer Ribbon
Checking the Developer tab in Customize view (in Excel 2010 and later)
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
When you fill out an online questionnaire, or when you work with almost
any Windows program, you continually see "controls" such as radio buttons,
check boxes, text boxes, buttons, dropdown lists, and others. You probably
don't even think about how these work because you see them so often.
The good news it is that you can add these controls to Excel worksheets,
and it is remarkably easy, with no programming required. The first thing you
should do is make the Developer ribbon visible. To do so, right-click any
ribbon, select Customize the Ribbon, and check the Developer item in the
right pane of the resulting dialog box. Once the Developer ribbon is visible,
click the Insert dropdown to see the list of controls shown to the right.
There are two groups, the "easy" Form Controls and the "advanced" ActiveX
Controls. The latter require some programming, so only the Form Controls
are discussed here.
To insert any of these controls on a worksheet, click the control and then
drag it where you want it. The control comes alive knowing the behavior it
ought to have. For example, option buttons (also called radio buttons) know
that only one of them can be checked, whereas check boxes know that any
number of them can be checked.
An invoice application has already been created to the right, using the
following steps.
1. Create the frame at the top by clicking the Group Box form control and
dragging it to a desired location. Then change its label to Product
purchased.
2. Insert three option buttons inside the frame by clicking the Option Button
form control and then dragging them inside the frame. Then change their
labels to the product names.
3. Insert a check box (outside of the frame) for preferred customers, and
change its label.
4. At this point, the option buttons and the check box aren't yet functional.
To make them functional, right-click any one of the option buttons and
select Format Control. In the Cell link box under the Control tab shown to
the right, select a cell out of view, such as AA1. Then depending on which
option button is selected, cell AA1 will contain 1, 2, or 3. Fortunately, you
need to do this for only one of the radio buttons. The others will
automatically have the same cell link. Similarly, create a cell link for the
check box to a cell such as AA2. Depending on whether the checkbox is
checked, cell AA2 will contain TRUE or FALSE.
5. Create formulas in the gray cells. You can check that the first three of
these use the INDEX function and references to the cell links that act as
lookups.
Try it! Create your own version of this application, using the steps above.
Try it! Create your own version of this application, using the steps above.
Here is another nice application. It uses the very handy Combo Box form
control circled to the right. Suppose you have a very large table that has the
driving distances between 75 locations. (See the large table to the right,
starting in column P.) You would like to look up the distance between any
given pair of "From" and "To" locations. To accomplish this, you can add
two combo box controls, one for the "From" location and one for the "To"
location.
The application has already been created to the right, using the following
steps.
1. Create the combo box for the "From" location by clicking the Combo Box
form control and dragging it so that it covers cell K68.
2. Right-click this combo box and select Format Control. For the Input
Range, select the gray column range to the right, and for the cell link, select
cell K68. This gives you a dropdown list where you can select from Location
1 to Location 75, and the index of the one you select (1 to 75) is stored out
of sight under the combo box. (You could also store this index way to the
right on the worksheet, but letting it be covered up by the combo box itself
is a nice alternative.)
3. Create a similar combo box over cell L68 for the "To" location, this time
entering L68 as the cell link. Surprisingly, the Input Range for this combo
box should still be the gray column range, not the gray row range to the
right. Excel always wants the list to be a column, not a row.
4. You can now find the distance between the two selected locations with
the INDEX function in cell M68. For the example shown, it finds the
distance at the intersection of row 12, column 29 of the distance table. (The
INDEX function, a very handy function for exactly this type of application, is
described in the INDEX topic of this tutorial.)
Lining Up Controls
When you use controls, it is important to line them up so that they have a
professional look. If your controls are slightly out of alignment, this is
probably the first thing your users will notice, and because of it, they might
Lining Up Controls
When you use controls, it is important to line them up so that they have a
professional look. If your controls are slightly out of alignment, this is
probably the first thing your users will notice, and because of it, they might
lose all faith in you.
For example, the left sides of the three option buttons in the first example
above should be left-aligned. This can be tricky (and time-consuming) to do,
but there is a nice "nudge" trick you can use. Right-click any control to select
it, and then press the Ctrl key and any of the Arrow keys to move the control
slightly in the direction of the arrow. More specifically, here are Microsoft's
own suggestions for moving any shape, including controls, text boxes, lines,
rectangles, and so on. (You can use any or all of these.)
Product purchased
Flat-screen TV
Laptop computer
✘ Preferred customer
Invoice
Format Control dialog box Product Laptop computer
Price $650
Discount $33
Net price $618
Location 1
Location 2
Location 3
Location 4
Location 5
Location 6
Combo Box control Location 7
Location 8
Location 9
Location 10
Location 11
Location 12
Location 13
Location 14
Location 15
Location 16
Location 17
Location 18
From To Distance Location 19
12 29 78 Location 20
Location 21
Format Control dialog box Location 22
Location 23
Location 24
Location 25
Location 26
Location 27
Location 28
Location 29
Location 30
Location 31
Location 32
Location 33
Location 34
Location 35
Location 36
Location 37
Location 38
Location 39
Location 40
Location 41
Location 42
Location 43
Location 44
Location 45
Location 46
Location 47
Location 48
Location 49
Location 50
Location 51
Location 52
Location 53
Location 54
Location 55
Location 56
Location 57
Location 58
Location 59
Location 60
Location 61
Location 62
Location 63
Location 64
Location 65
Location 66
Location 67
Location 68
Location 69
Location 70
Location 71
Location 72
Location 73
Location 74
Location 75
Inputs
Prices
Flat-screen TV $2,500
Blu-ray disc player $450
Laptop computer $650
Preferred discount 5%
Location 1 Location 2 Location 3 Location 4 Location 5 Location 6 Location 7
0 55 13 50 16 49 85
39 0 38 40 21 32 62
57 49 0 80 62 40 51
25 49 87 0 61 14 67
71 63 48 83 0 89 44
61 34 78 62 40 0 77
42 21 26 15 29 90 0
35 10 88 28 71 79 12
53 16 51 68 97 36 10
23 69 14 75 10 18 44
18 78 67 78 100 86 15
11 44 21 23 18 20 13
95 15 33 54 44 46 97
41 60 16 58 82 19 42
81 17 46 96 87 48 27
72 98 97 92 33 35 22
20 85 28 97 91 94 100
91 65 30 28 65 74 29
24 82 21 43 100 82 38
12 68 16 77 31 57 54
86 58 13 40 92 36 19
39 78 60 39 99 39 34
99 53 56 13 93 81 64
47 53 60 29 75 93 39
52 91 96 95 45 21 24
83 29 88 19 27 98 10
76 57 31 96 76 95 57
12 13 32 64 83 100 60
38 16 29 59 11 51 70
78 38 57 79 79 98 17
82 63 35 48 39 14 74
68 96 20 49 80 21 22
87 43 97 99 73 33 92
73 47 68 27 60 36 23
41 62 22 75 20 83 15
86 86 98 62 90 99 84
10 34 96 94 42 21 12
98 21 58 60 61 41 67
67 74 50 38 54 72 85
18 25 12 21 29 11 94
75 44 26 19 83 56 45
100 91 21 85 87 16 57
44 87 52 86 47 35 47
62 69 11 33 68 24 90
37 55 11 66 62 91 91
53 76 17 39 18 41 81
98 75 100 67 54 63 36
26 37 74 22 73 36 94
30 86 62 18 62 83 57
33 65 56 84 13 33 30
53 26 84 65 14 48 38
43 63 10 52 61 86 88
43 37 49 97 45 86 13
83 94 83 84 48 61 35
21 70 82 49 13 62 22
86 25 37 53 42 74 32
86 32 64 64 52 69 60
14 58 75 48 87 50 71
87 78 90 16 80 22 15
98 97 52 70 82 57 61
82 36 94 60 70 72 49
93 26 88 92 30 20 23
95 24 26 23 14 22 82
51 63 57 75 66 12 76
15 58 52 27 57 14 67
99 48 35 50 44 76 84
81 96 88 44 53 95 77
12 54 15 44 54 45 90
62 34 90 29 74 50 33
37 24 86 46 71 92 40
40 47 80 47 61 16 25
57 69 56 17 54 10 79
37 71 37 56 80 100 75
31 13 21 81 88 56 29
50 54 65 74 16 97 65
3
TRUE
Location 8 Location 9 Location 10 Location 11 Location 12 Location 13 Location 14 Location 15
57 71 60 81 17 85 61 83
79 88 68 53 10 49 18 25
93 97 42 25 67 46 16 11
76 59 47 58 17 30 100 23
58 51 84 74 29 66 74 61
73 11 90 48 68 42 47 30
41 69 52 45 51 87 27 81
0 48 70 12 75 12 52 15
23 0 80 18 58 100 74 67
72 34 0 88 61 72 18 62
73 59 71 0 21 99 88 85
79 27 37 50 0 84 90 54
26 38 72 33 34 0 38 73
39 98 68 10 60 95 0 67
100 65 64 19 70 55 63 0
93 35 17 13 53 70 15 89
60 74 27 59 44 27 14 74
97 53 11 32 87 71 91 18
42 22 31 51 94 47 75 93
93 35 34 96 77 84 38 21
64 68 65 16 30 43 84 77
18 23 60 23 64 77 31 19
70 48 91 43 47 41 76 45
28 15 93 19 64 98 97 64
61 17 49 75 82 27 95 78
97 36 86 24 13 38 41 29
28 53 40 24 18 98 58 21
99 77 36 85 38 100 30 37
50 37 85 88 66 58 43 79
93 91 50 87 44 32 26 31
84 74 47 51 80 51 99 69
82 82 46 48 14 58 71 73
52 26 49 54 79 82 16 13
34 22 47 88 87 63 55 94
30 28 99 59 50 46 59 16
18 87 29 96 43 96 47 24
91 12 65 51 51 73 87 14
25 46 47 79 50 43 92 52
53 37 96 70 88 62 93 38
43 95 44 64 57 87 35 78
14 22 75 90 80 55 64 51
100 80 28 23 57 35 79 62
100 94 76 14 99 16 33 53
14 50 30 78 43 12 98 87
62 69 84 99 72 20 59 36
90 89 87 100 15 82 53 97
68 86 16 30 53 87 92 66
66 43 65 30 34 23 40 62
71 23 12 31 31 70 95 34
36 43 91 99 93 11 99 28
34 39 46 47 66 36 56 51
68 76 86 43 17 42 98 74
39 55 61 81 49 29 84 24
32 36 67 65 16 29 42 56
53 54 10 90 81 38 49 85
86 35 17 71 43 85 57 47
92 89 42 46 27 19 76 45
49 49 63 51 43 72 61 73
32 14 86 65 83 18 47 65
16 74 13 11 82 10 38 78
88 90 42 94 98 69 24 82
98 31 28 96 31 50 25 43
52 36 97 18 80 54 42 39
58 66 36 42 46 17 44 62
87 90 24 23 37 26 96 83
11 43 43 94 55 84 36 55
34 100 38 74 38 69 95 66
44 29 29 20 69 44 14 57
84 28 48 53 62 34 99 77
83 40 63 22 30 75 86 85
37 71 85 71 69 16 83 81
93 46 72 49 33 12 34 56
58 85 72 90 30 60 24 65
66 30 19 39 75 32 18 31
52 76 38 41 75 65 72 44
Location 16 Location 17 Location 18 Location 19 Location 20 Location 21 Location 22 Location 23
88 18 98 95 92 18 13 60
74 31 58 68 42 56 55 40
61 32 79 92 12 34 88 12
94 86 19 87 28 11 69 93
30 56 70 96 47 84 67 53
69 91 42 96 66 44 83 15
76 23 100 62 87 97 71 73
38 75 14 68 98 76 19 44
36 69 16 60 71 39 68 44
64 31 90 81 89 43 33 93
17 47 61 46 72 65 69 59
78 65 65 39 15 52 88 54
69 19 53 61 22 58 95 67
43 49 10 87 55 13 32 10
36 48 15 24 35 57 42 49
0 51 44 78 59 27 74 30
99 0 100 81 25 89 59 38
30 11 0 37 34 26 78 39
78 95 39 0 19 37 30 69
30 49 59 78 0 65 16 82
23 91 25 42 65 0 14 37
44 36 45 86 87 86 0 49
72 84 16 15 65 14 63 0
90 70 56 62 12 92 33 99
21 80 80 57 38 55 72 56
55 65 39 53 77 83 62 33
94 48 93 95 97 63 93 26
12 15 32 99 63 26 70 96
75 50 87 53 29 69 77 17
14 56 32 69 36 45 60 89
57 64 39 84 65 81 55 72
85 59 71 62 29 78 61 15
85 14 17 31 63 18 54 24
60 52 59 74 55 55 17 34
31 36 74 92 89 29 64 97
28 58 34 73 30 78 12 53
32 45 80 42 92 15 14 100
21 53 65 100 21 94 27 93
37 42 32 97 12 74 52 80
22 87 96 82 13 52 69 70
48 17 25 76 62 15 22 89
63 54 64 36 77 72 31 26
51 25 84 31 54 29 100 62
67 29 23 46 39 16 12 11
77 64 15 17 38 52 42 95
11 10 24 98 83 57 64 36
90 70 94 32 59 93 92 53
79 83 13 64 47 14 56 80
34 54 58 73 10 41 44 76
29 68 62 45 73 44 96 62
64 33 39 83 56 47 27 29
17 93 35 60 41 37 38 97
17 91 31 85 52 70 85 62
53 15 83 80 66 84 38 29
86 83 31 97 18 95 28 72
54 75 99 30 72 68 94 73
14 99 35 83 70 65 23 75
39 58 53 64 91 99 45 69
48 71 60 62 66 94 38 21
87 25 93 81 32 79 50 18
22 45 26 39 94 17 85 69
42 76 56 13 70 23 100 35
57 70 80 66 35 99 99 43
20 83 57 57 12 15 37 13
64 70 78 68 99 67 33 22
72 54 100 84 62 27 25 53
28 51 95 58 77 66 25 15
81 59 54 77 72 36 30 98
52 10 62 64 51 58 90 22
34 73 32 84 47 71 97 93
68 19 64 47 59 90 82 62
84 80 15 83 78 82 15 15
46 62 50 22 37 98 58 42
73 18 31 59 79 42 81 47
63 61 22 59 24 35 69 34
Location 24 Location 25 Location 26 Location 27 Location 28 Location 29 Location 30 Location 31
37 42 59 59 40 14 56 20
40 27 71 11 80 17 58 36
93 38 36 40 17 75 27 42
82 99 77 50 50 75 81 68
77 75 45 27 56 35 49 26
87 57 82 84 37 74 23 65
64 97 84 29 81 97 26 84
42 63 75 53 95 61 84 97
20 79 82 48 88 22 30 42
88 32 95 46 32 22 17 92
71 53 51 12 27 83 77 45
53 76 28 99 67 78 88 45
47 69 63 55 37 80 69 97
43 73 90 15 71 24 13 10
89 88 20 77 63 63 26 41
90 71 39 70 45 85 62 61
34 65 20 67 64 80 93 72
91 47 88 95 85 24 28 86
41 35 94 96 30 42 90 59
59 44 75 29 17 53 53 64
25 37 97 87 65 17 24 63
63 10 80 13 48 48 51 54
98 63 29 27 89 54 83 58
0 66 93 12 87 50 31 42
21 0 15 27 78 69 92 78
61 74 0 38 29 49 47 19
13 56 27 0 75 89 40 69
65 28 38 61 0 90 23 98
81 34 39 85 44 0 81 22
54 79 38 82 98 97 0 53
14 74 41 37 96 49 89 0
46 77 63 89 49 24 90 33
53 28 12 71 16 44 99 55
41 98 58 40 31 64 78 28
71 57 78 36 91 81 94 75
90 35 60 60 19 92 26 49
19 56 94 14 29 70 79 10
72 100 68 76 62 65 51 56
68 63 41 91 63 28 57 34
56 86 33 43 87 65 96 42
59 79 91 70 79 67 34 25
77 31 80 72 90 82 87 34
85 60 16 75 85 48 89 45
27 46 75 92 45 65 65 51
86 77 30 88 14 99 51 11
85 86 46 93 71 46 60 35
75 89 80 53 46 68 83 26
58 40 97 34 15 70 59 96
95 26 89 82 41 18 48 87
100 73 14 12 15 17 25 54
12 14 50 22 89 32 14 11
83 55 31 61 39 26 70 53
46 15 60 19 18 71 77 18
77 75 23 73 72 93 29 66
20 34 82 28 77 80 63 73
49 16 49 94 41 91 58 25
10 71 56 60 98 36 43 100
48 21 58 51 36 60 46 55
13 15 24 74 48 46 48 61
80 88 98 19 86 77 59 80
48 66 39 64 53 40 45 66
97 60 87 88 87 47 29 58
24 54 49 18 33 79 80 65
36 96 43 28 70 21 60 61
41 65 18 70 21 74 12 62
38 15 25 51 79 64 38 10
82 38 26 53 69 63 33 41
20 91 67 36 89 93 49 73
79 60 20 48 21 19 23 92
100 43 90 19 89 25 13 59
84 74 78 100 26 72 66 76
73 39 53 50 100 27 63 52
38 90 86 65 50 92 30 91
33 73 19 27 46 34 15 93
29 62 87 76 13 88 30 88
Location 32 Location 33 Location 34 Location 35 Location 36 Location 37 Location 38 Location 39
98 88 36 32 94 76 44 34
83 94 91 98 100 34 48 71
41 29 99 71 85 34 91 45
19 78 80 10 72 72 91 46
62 64 75 18 86 67 98 60
16 20 41 28 68 38 23 71
100 75 40 58 36 29 46 58
85 97 93 90 51 66 20 100
49 66 94 69 36 35 59 11
51 52 93 62 13 72 100 54
68 49 24 42 67 26 19 69
70 35 46 15 18 28 45 59
44 60 83 27 100 49 45 39
87 66 84 45 18 53 39 11
60 71 22 21 19 94 16 31
95 28 92 78 29 21 47 75
60 89 64 37 88 58 94 37
74 38 99 81 36 22 56 57
81 82 31 99 79 10 38 82
32 54 71 37 90 65 82 15
88 22 25 22 12 65 34 59
59 80 99 38 67 78 83 15
22 68 12 15 73 45 88 83
90 42 62 79 49 89 97 58
19 39 87 18 18 33 83 13
10 34 16 73 20 40 62 87
19 15 21 10 67 27 54 74
78 82 63 76 39 93 21 73
64 32 35 72 84 40 56 26
40 82 49 40 60 84 37 35
15 98 73 36 31 76 99 63
0 57 80 65 40 93 91 39
73 0 91 97 91 54 10 77
13 14 0 87 78 20 27 30
95 18 59 0 22 88 24 80
90 15 56 18 0 49 11 55
54 88 43 33 95 0 56 29
29 90 88 88 41 65 0 95
49 72 67 17 20 42 96 0
85 30 87 90 71 59 83 15
63 38 40 21 74 91 92 76
26 97 57 89 75 93 42 100
98 74 90 73 99 44 95 19
97 19 84 53 77 28 65 28
45 96 79 86 60 98 54 27
25 100 53 24 37 85 83 74
78 99 40 27 86 80 54 10
76 10 49 96 23 35 92 65
83 98 97 44 80 39 60 73
14 20 83 96 20 45 95 72
54 85 92 97 55 30 11 72
99 62 14 47 17 10 55 87
73 93 54 50 52 83 24 26
34 83 88 58 10 21 28 93
21 50 38 88 87 68 85 67
95 81 97 53 76 40 93 10
91 58 99 62 21 64 42 94
93 50 66 12 51 83 60 26
40 12 95 35 65 67 15 29
81 55 44 17 94 57 56 67
46 61 50 61 71 94 31 61
38 68 68 90 78 89 92 38
92 33 35 61 56 50 42 17
51 15 82 82 84 53 90 31
52 53 52 51 33 76 22 68
50 71 38 66 37 75 57 14
33 23 50 99 91 16 17 83
98 18 16 12 18 65 71 42
34 55 12 62 81 72 55 19
40 10 73 16 67 25 64 98
48 12 73 62 26 100 81 43
50 84 21 68 78 27 79 39
32 78 68 91 44 86 47 44
86 11 10 50 92 78 70 84
88 41 92 74 96 10 80 84
Location 40 Location 41 Location 42 Location 43 Location 44 Location 45 Location 46 Location 47
79 13 34 27 53 53 99 21
100 58 92 59 70 13 15 36
100 30 19 80 80 51 94 30
39 23 31 34 98 89 36 49
67 33 51 98 53 58 100 90
48 15 24 65 88 65 99 44
71 31 52 59 53 99 54 50
54 27 60 30 31 77 48 100
53 65 30 35 43 49 86 66
52 70 16 41 38 100 39 74
11 10 81 34 11 68 62 54
94 86 17 19 13 90 47 40
13 11 23 41 12 23 57 71
42 85 18 100 15 59 34 82
46 78 85 22 85 69 61 35
84 65 76 76 47 73 18 88
42 81 41 64 54 63 53 52
14 91 32 70 70 25 23 27
72 33 68 64 43 31 36 45
27 100 15 89 97 17 77 15
16 66 82 38 46 43 13 61
30 89 54 50 77 47 54 99
85 55 19 79 17 63 46 51
87 19 40 82 64 92 31 21
45 34 42 58 40 59 64 48
13 32 40 49 25 34 18 11
84 60 63 50 96 19 90 62
60 58 94 40 42 78 33 56
65 97 46 37 82 75 10 70
85 75 78 43 78 12 60 78
45 47 83 55 26 94 26 28
41 83 33 57 30 65 69 17
40 72 31 87 84 91 93 86
15 61 38 74 72 82 16 94
38 56 99 90 69 17 84 22
18 22 84 80 61 61 78 47
89 90 17 84 42 85 49 27
23 88 60 65 84 48 67 68
40 84 66 90 57 68 56 49
0 56 79 76 78 90 53 53
26 0 60 54 23 91 10 72
51 33 0 31 75 25 53 37
55 59 53 0 55 80 22 33
44 81 78 58 0 22 85 51
11 28 82 46 96 0 38 61
19 99 11 34 97 74 0 89
30 53 31 90 14 50 90 0
44 80 95 58 36 79 99 64
89 42 23 79 86 85 85 23
49 11 25 32 48 62 59 87
13 15 76 26 19 90 100 36
35 43 63 93 69 35 49 98
29 21 37 34 14 77 35 76
17 81 31 100 89 67 30 33
94 24 36 41 82 78 59 87
68 69 84 41 12 40 58 67
94 93 89 25 30 66 43 18
19 86 31 81 76 13 56 76
78 90 65 37 85 64 43 52
90 41 86 29 35 84 21 76
79 71 60 38 36 57 27 39
46 39 77 27 70 70 92 10
31 39 54 84 75 69 26 50
100 53 96 57 51 20 80 93
48 48 48 12 43 73 93 30
100 64 90 45 69 78 44 65
89 59 32 60 46 47 43 79
67 20 50 71 42 53 48 15
20 25 19 79 43 86 18 35
13 60 74 79 83 58 33 80
19 30 16 26 64 88 25 64
17 58 59 43 54 37 29 24
87 82 32 17 53 55 70 90
47 29 27 83 42 60 54 50
82 94 41 89 24 70 78 82
Location 48 Location 49 Location 50 Location 51 Location 52 Location 53 Location 54 Location 55
21 78 83 20 49 75 76 54
68 94 42 84 70 86 88 77
22 74 64 50 54 31 71 96
99 78 36 96 45 97 57 48
86 42 67 75 88 57 45 35
86 85 53 17 72 25 60 41
40 40 34 27 26 43 45 56
73 92 40 54 29 90 98 29
74 84 100 59 59 71 18 31
48 86 50 66 73 99 51 22
62 28 69 59 80 59 51 26
20 23 85 83 28 98 82 60
70 78 69 93 58 21 48 94
49 35 98 30 85 52 93 22
25 68 26 83 21 69 57 32
57 46 92 67 60 46 38 14
42 52 58 67 38 74 10 23
23 70 18 65 89 76 47 45
84 23 83 93 87 64 58 54
18 91 42 74 74 53 68 85
29 67 20 17 20 38 38 42
92 48 78 88 77 70 27 25
54 18 86 96 50 45 91 31
71 96 35 65 26 27 45 85
53 33 94 99 65 45 28 33
87 89 48 30 75 89 47 70
30 41 75 20 67 78 35 62
32 46 100 98 39 74 38 10
65 65 56 94 24 92 91 12
16 64 94 51 53 19 92 18
32 98 63 92 34 99 96 58
38 24 89 35 98 97 27 92
16 56 28 92 16 39 88 96
15 24 58 72 11 69 50 40
88 72 16 16 71 54 33 70
50 83 22 98 40 51 70 86
38 18 28 16 42 51 31 97
54 54 30 55 36 95 36 50
13 34 75 53 30 73 26 26
63 44 52 81 21 56 40 61
26 48 31 83 100 14 72 36
54 17 92 84 56 93 44 58
70 25 57 48 81 59 35 27
58 48 68 13 56 25 21 59
73 99 100 19 38 25 32 47
29 98 84 94 98 26 20 66
52 28 24 50 66 94 74 84
0 55 89 72 60 84 55 73
13 0 81 10 63 13 70 14
65 93 0 48 66 54 11 86
100 20 11 0 37 30 37 32
92 13 54 76 0 68 64 49
72 51 28 73 62 0 21 62
76 69 71 97 91 97 0 12
10 23 37 10 77 12 71 0
79 38 68 38 70 10 14 52
22 28 53 79 81 49 85 90
27 94 18 75 38 30 86 97
56 34 15 86 79 10 48 46
80 28 56 12 62 60 73 87
46 58 36 77 85 79 38 36
67 89 24 50 84 16 85 25
87 47 84 64 99 27 94 88
60 57 18 65 72 22 17 37
85 44 54 62 50 95 37 26
85 84 42 59 96 56 62 78
57 33 33 90 45 54 67 95
85 54 70 50 84 37 86 76
38 82 46 38 56 49 14 60
48 27 27 65 91 51 57 37
58 56 17 83 97 81 23 52
70 14 58 49 24 81 13 94
57 74 51 76 34 87 99 59
24 34 20 10 59 24 87 80
34 21 83 35 58 82 30 47
Location 56 Location 57 Location 58 Location 59 Location 60 Location 61 Location 62 Location 63
66 17 58 12 42 36 62 89
22 77 98 11 17 11 25 49
99 38 54 15 28 15 36 90
87 45 30 37 49 66 59 86
34 88 68 74 10 74 44 58
78 95 47 75 98 18 87 74
37 78 83 43 72 55 81 54
91 48 19 72 19 67 97 53
28 45 20 22 17 80 36 32
52 46 92 59 28 17 49 13
69 85 10 59 66 34 43 30
69 69 93 40 66 46 88 14
57 77 75 61 89 68 15 62
75 74 63 98 11 64 45 10
11 47 54 50 81 75 62 43
79 81 41 16 88 94 56 13
23 39 28 65 55 94 74 27
57 95 16 62 47 98 26 79
39 97 15 43 83 66 34 59
37 40 45 85 56 98 42 54
64 11 21 50 28 65 88 50
56 100 44 68 12 48 24 95
27 15 67 60 38 93 79 98
65 27 83 92 43 25 72 70
87 27 27 58 27 96 37 96
34 16 33 65 24 96 45 76
50 80 74 84 90 24 62 92
31 59 82 60 21 67 65 78
76 47 43 56 52 39 48 52
69 96 58 40 18 95 58 57
83 39 32 12 40 82 95 33
39 89 17 24 90 29 99 79
11 45 24 52 19 86 92 71
83 83 97 72 51 43 12 76
74 75 96 94 95 25 20 16
82 51 19 18 27 88 52 52
45 67 89 91 79 55 13 15
40 20 55 69 45 63 91 91
53 99 88 39 17 62 85 38
32 73 85 77 33 35 43 85
71 30 34 45 11 83 30 43
49 75 45 28 19 16 89 33
82 27 38 79 66 10 65 90
37 56 13 50 55 74 90 60
59 16 88 32 97 65 93 36
64 31 58 81 48 39 55 54
98 44 98 36 66 72 74 68
21 95 24 84 46 39 66 71
87 69 70 34 46 46 51 53
58 37 74 31 21 91 53 47
68 24 15 89 87 29 45 54
49 72 68 23 82 36 20 10
60 39 33 95 100 70 78 11
16 15 91 58 87 82 67 70
16 49 26 25 90 100 65 45
0 37 63 50 60 13 87 55
27 0 64 24 15 71 22 79
52 97 0 89 33 78 29 15
61 88 44 0 59 45 69 43
12 95 77 79 0 91 22 43
50 39 19 78 85 0 27 22
34 49 27 92 55 50 0 72
88 36 38 78 39 99 15 0
69 88 100 53 77 49 16 100
88 18 35 17 15 16 94 23
13 52 17 61 63 55 17 90
95 87 47 29 58 98 46 42
30 22 12 50 62 10 100 20
75 49 55 95 70 41 53 64
99 52 62 54 34 32 95 25
15 31 19 37 92 33 50 97
95 87 30 97 14 97 35 39
39 56 84 97 73 28 67 87
65 53 11 53 58 99 17 70
16 33 11 34 55 10 83 44
Location 64 Location 65 Location 66 Location 67 Location 68 Location 69 Location 70 Location 71
58 32 62 78 24 67 10 94
84 68 59 36 86 49 34 67
78 51 41 45 91 70 92 12
95 62 91 18 70 40 23 91
68 19 82 59 47 77 97 13
10 60 95 86 40 20 99 64
45 15 30 93 36 56 84 89
53 28 82 42 48 18 63 71
53 16 11 82 87 54 14 25
72 71 86 81 60 39 100 87
33 11 10 98 11 46 100 59
85 34 91 67 37 96 30 63
59 68 82 86 28 41 98 78
65 96 79 72 40 95 45 88
91 54 73 75 99 57 34 22
35 87 43 54 85 78 96 39
79 41 94 32 88 86 53 92
42 19 95 21 74 14 83 21
42 27 14 43 78 39 79 74
78 95 33 20 92 78 89 60
25 32 55 53 50 23 12 24
57 17 12 59 51 85 39 94
94 78 35 51 32 76 84 91
26 73 92 17 57 97 90 20
39 90 81 21 62 40 13 55
78 66 31 89 81 62 41 67
37 29 62 88 91 30 23 37
50 83 28 32 98 78 36 46
74 44 24 41 29 29 78 73
67 54 41 76 38 60 87 37
89 43 75 83 97 34 70 96
56 10 39 82 77 40 93 94
94 17 89 74 96 86 36 85
49 75 87 80 48 67 34 30
15 72 23 66 100 91 56 100
11 58 55 16 60 15 66 88
91 47 44 64 83 57 31 69
14 11 30 83 39 85 12 35
60 28 56 23 32 61 65 37
66 38 78 71 19 90 68 53
74 12 34 49 31 16 49 94
23 57 90 16 27 92 44 48
23 11 91 17 22 46 55 64
48 54 90 15 45 70 79 76
33 17 41 15 43 62 83 71
69 29 56 11 46 39 23 18
93 80 37 50 49 66 45 25
40 73 56 91 69 46 28 12
73 72 35 38 24 36 76 84
74 50 18 75 39 51 55 15
31 17 35 41 68 16 23 46
41 56 36 55 18 86 53 92
92 69 79 51 32 87 68 79
43 84 81 93 57 93 25 32
78 62 53 28 26 54 58 49
31 96 57 33 41 32 19 91
43 19 15 62 24 92 98 16
74 22 40 54 39 48 13 66
95 10 60 29 41 68 90 68
39 80 37 26 37 75 96 44
39 26 100 53 46 44 18 54
26 56 97 20 89 12 56 23
67 91 18 60 97 11 46 69
0 91 66 42 31 23 11 42
80 0 27 20 93 46 22 97
39 53 0 87 41 24 58 11
97 12 40 0 27 34 49 54
46 71 49 44 0 90 55 98
19 67 87 10 57 0 88 38
61 76 25 22 16 64 0 31
41 61 92 50 38 22 95 0
34 20 44 37 43 63 30 69
58 13 56 51 20 30 88 41
27 34 36 25 84 81 26 55
52 27 61 77 95 68 28 18
Location 72 Location 73 Location 74 Location 75
31 90 35 70
72 32 30 92
13 100 71 24
59 92 49 59
34 59 89 21
20 99 83 89
90 12 89 89
45 22 68 22
93 86 40 11
100 10 80 31
49 30 54 25
28 21 51 44
71 37 69 46
91 87 100 60
71 46 10 58
11 52 100 19
73 44 86 71
77 75 93 69
97 17 50 86
48 89 69 91
65 47 26 51
37 58 68 25
25 15 53 27
59 49 25 88
10 51 73 56
71 15 67 70
62 62 94 95
59 26 98 75
61 10 87 54
18 91 84 45
89 36 66 91
47 44 30 81
57 40 22 94
95 95 45 26
83 83 69 11
38 78 60 48
38 76 91 19
61 66 67 36
66 46 30 35
54 47 65 47
29 88 97 38
47 40 66 24
91 96 77 84
26 79 83 37
19 45 66 91
12 11 87 71
12 40 54 52
50 23 11 50
51 57 33 49
33 87 24 30
87 19 75 85
40 58 54 48
27 27 53 36
58 25 82 47
11 63 69 29
34 36 27 30
90 27 56 72
20 89 33 67
38 79 50 86
80 50 85 70
35 71 72 16
95 34 60 77
58 25 94 65
16 78 14 86
86 91 23 27
72 70 43 17
11 87 20 37
36 92 19 18
21 59 96 87
67 25 66 56
22 41 97 38
0 68 31 99
28 0 40 86
26 28 0 57
54 77 73 0
© S. Christian Albright, 2011-2023, All Rights Reserved Return to List of Topics sheet
Developer ribbon
Background for Macros and VBA Programming in Excel
If you want even more power in Excel, you can automate just about any
task with a macro. Macros are written in the programming language for
Excel and the rest of Office, called Visual Basic for Applications (VBA). VBA is
a relatively easy programming language to learn, but it does take some
study and a lot of practice. (If you are interested, check out the VBA for
Modelers book at http://www.kelley.iu.edu/albrightbooks.)
Even if you know nothing about programming, you can still record macros
to perform some simple tasks. You can then create buttons to run these
macros and place them on you Quick Access Toolbar (QAT) so that they are
always available to you. There are several things you should know before
you start working with macros:
1. There is a Developer tab and ribbon, shown to the right, that you should
make visible. This has various buttons for working with macros. If the
Developer tab isn't visible, right-click any ribbon, select Customize the
Ribbon, and check the Developer item in the right pane of the resulting
dialog box.
2. Starting in Excel 2007, files that contain macros must have the .xlsm
extension ("m" for macro). You aren't allowed to save such a file as an .xlsx
file.
3. There is a special file, Personal.xlsb. This is called your Personal Macro
Workbook. This is where you will probably want to store your recorded
macros. This file opens automatically as a hidden file whenever you open
Excel. Therefore, all of its macros are always available, regardless of what
other Excel files are open.
4. If you want to write your own macros, or if you want to look at recorded
macros, you need to go to the Visual Basic Editor. You can do this from the
Visual Basic button on the Developer tab, or more easily, with the Alt+F11
keyboard shortcut.
Try it now. Press Alt+F11. This opens a new window. When you are finished
looking around, you can close this window. Excel will still be open.
Now let's record a macro and then try it out. This will be a very simple Record Macro dialog b
macro that formats the selected cell(s) as integers, that is, as Number with
zero decimals.
1. Make the Developer ribbon visible, if necessary. Select any range such as
the numbers in the gray range to the right, and click the Record Macro
button on the Developer ribbon. This turns the recorder on. It will record
Recording a Macro
Now let's record a macro and then try it out. This will be a very simple
macro that formats the selected cell(s) as integers, that is, as Number with
zero decimals.
1. Make the Developer ribbon visible, if necessary. Select any range such as
the numbers in the gray range to the right, and click the Record Macro
button on the Developer ribbon. This turns the recorder on. It will record
everything you do until you turn the recorder off. Note: There is also a
handy Record Macro/Stop Recording button at the left side of the Status
Bar. See the screenshot above to the right.
2. When you click the Record Macro button, you will see the dialog box to
the right. Fill it out as shown and click OK. You can give the macro a
meaningful name (no spaces), and you can specify where it should be
stored. The choice shown here is the Personal Macro Workbook, which is
the same as the Personal.xlsb file mentioned above. This will make the
macro available at all times.
3. Now perform the task you want to record. In this case, format the
selected range as Number with zero decimals.
4. From the Developer ribbon (or the button on the Status Bar), click the
Stop Recording button. Macros list for QAT cu
5. If you want to see the recorded mcaro, press Alt+F11 and look at the
module(s) under Personal on the left side of the Visual Basic Editor.
(Modules are where macros are stored.) Even if you know nothing about
programming or VBA, the recorded code probably makes sense. With some
experience, you can modify this code to suit your exact needs. For now,
though, you can leave it as is.
6. Now you have a nice macro, but you need a button to run it. To create
such a button, click the dropdown arrow next to the QAT, and then More
Commands to bring up the Customize dialog box shown to the right. Under
the "Choose commands from" dropdown, choose Macros. Select your
recorded macro from the resulting list, and click the Add>> button to create
a button for it on your QAT. The button will have a generic icon, but if you
click the Modify button near the bottom, you can choose a more appealing
icon.
7. Now that you have a nice button on your QAT, try it out. Select the
numeric cells in the red range to the right and click your button. They
should be reformatted.
Note that you were instructed to select a range before recording the macro.
The reason is that the macro will then apply to whatever range is selected.
If you began recording and then selected a range to format, your macro
would work only for that specific range.
Try it! Think of a simple task you perform frequently, like coloring the
background of a range green, changing the number format to currency with
zero decimals, or changing the print settings to your favorite settings.
Record a macro to perform any of these tasks, store it in your Personal
Macro Workbook, and assign it to a button on your QAT. You will then be a
click away from instant productivity!
Developer ribbon