0% found this document useful (0 votes)
119 views128 pages

Microsoft+Excel+Comprehensive+ +Course+Outline+ +Todd+McLeod

Uploaded by

GAURAV UPADHYAY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views128 pages

Microsoft+Excel+Comprehensive+ +Course+Outline+ +Todd+McLeod

Uploaded by

GAURAV UPADHYAY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 128

The Comprehensive Microsoft Excel Course

Excel Made Easy - From Beginner to Expert - Microsoft Certified


Master Instructor - MOS Expert - Master Microsoft Excel

Getting started 9
Introduction 9
Exercise files 9
Getting your certificate 9
Course orientation 10
Understanding spreadsheets 10
Understanding versions 10
Personalization 11
Accessibility 11
Course outline 12
File extensions and open with 12
Course files 13
Hands-on exercises #1 13
#1 - Quiz 13
Quiz review 13
#2 - Your computer's word size 14
Writing formulas 14
Introduction 14
Workbooks and worksheets 15
Useful keyboard shortcuts 15
Working with Excel files 15
Autosave and autorecover 16
Finding your way around Excel 16
Mouse pointer awareness 17
Writing formulas 17
Relative, absolute, & mixed references 18
Ranges & names 18
Hands-on exercises #2 18
#3 - Quiz 18
Quiz review 18
#4 - Data entry 27
#5 - Adjusting views 27
#6 - Quick average, count, sum 28
#7 - Relative references 28
#8 - Absolute references 28
#9 - Mixed references 28

Todd McLeod,1
#10 - Gradebook equal weighting 28
#11 - Gradebook weighted 29
#12 - Gradebook points method 29
#13 - Trip budget 29
#14 - Cookie recipe 29
Functions 29
Sum & average 29
Max, min, documentation 30
Count, countif 30
Round, roundup, rounddown 30
Rand & randbetween 30
Concat & textjoin 30
Days & now 30
If 31
Hands-on exercises #3 31
#15 - Quiz 31
Quiz review 31
#16 - Basic functions - part 1 32
#16 - Basic functions - part 2 33
#16 - Basic functions - part 3 33
#17 - Random names - part 1 33
#17 - Random names - part 2 34
#18 - If 35
#19 - Documentation examples 35
Popular Excel functions 35
Top 10 35
Striping rows 38
Drop down menu 38
Xlookup 38
Vlookup 39
Gradebook with xlookup, vlookup, & curve 39
Xmatch 39
Choose 40
Date, year, month, day, left, mid, right, edate, datedif 40
Find & findb 41
Index 42
Hands-on exercises #4 42
#20 - Quiz 42
Quiz review 42
#21 - Secret message 43
#22 - Date exercises 44

Todd McLeod,2
#23 - Time exercises 44
#24 - Conditional formatting - stripe rows 44
#25 - Conditional formatting - sandbox 44
#26 - Data validation - number and text 44
#27 - Data validation - drop-down menu 44
#28 - Xlookup - life expectancy 45
#29 - Xlookup gradebook 45
#30 - Find peace 45
#31 - Gapminder 45
Introduction to formatting 45
Introduction 45
Font 46
Clear formats 46
Format painter 46
Cut, copy, paste 46
Alignment 47
Inserting & deleting cells, rows, and columns 47
Format cells dialog box 47
Number formats 47
Custom fonts 48
Hands-on exercises #5 48
#32 - Quiz 48
Quiz review 48
#33 - Copy data from wikipedia 50
#34 - Get data from gapminder 50
#35 - Number formatting 50
#36 - Alignment 51
#37 - Font formatting 51
#38 - Fill and border 51
#39 - Clearing formatting 51
#40 - Spreadsheet formatting 51
#41 - Transpose data 52
#42 - Adjust height & width 52
#43 - Link, text box, note, comment, indent 52
#44 - congrats, reviewing keyboard shortcuts, & some new stuff 52
#44 - review continued 55
*** *** *** INTERMEDIATE EXCEL *** *** *** 55
Working with Data 55
Acquiring data 55
Previewing data generators 55
Generating data - Hawaii Shoe Company - step #1 55

Todd McLeod,3
Generating data - Hawaii Shoe Company - step #2 56
Generating data - Hawaii Shoe Company - step #3 56
Generating data - Hawaii Shoe Company - step #4 56
Generating data - Outdoor Gear Coop - exploration #1 56
Generating data - Outdoor Gear Coop - exploration #2 56
Generating data - names - exploration #1 56
Freeze panes 56
Sort 57
Filter 57
Advanced filter 57
Filter function 57
Find & replace 57
Hands-on exercises #6 57
#45 - Hawaii shoe company generator 57
#46 - Outdoor gear generator 58
#47 - Name generator 58
#48 - Birth name data 58
#49 - Birth name data #2 58
#50 - jeopardy questions filter 59
#51 - jeopardy questions advanced filter 59
#52 - outdoor gear advanced filter 59
#53 - filter & freeze panes data 60
#54 - copy data from web, freeze frame, sort, filter 60
#55 - replace data 60
#56 - filter data using OR 60
Progressing with data 60
Flash fill 60
Remove duplicates 61
Consolidate 61
Trace precedents 61
What if - sensitivity analysis - goal seek 61
What if - sensitivity analysis - data table 61
What if - sensitivity analysis - scenario 62
Forecasts 62
Hands-on exercises #7 62
#57 - consolidate 62
#58 - goal seek 62
#59 - remove duplicates 63
#60 - scenarios 63
#61 - data table 63
#62 - relative, absolute, mixed references 63

Todd McLeod,4
#63 - forecast 63
Displaying data 64
Group 64
Visually representing data 64
Chart creation 65
Chart creation II 65
Chart formatting 65
Chart formatting II 66
Chart sparklines 66
Combo chart 66
Chart trendlines 66
Hands-on exercises #8 67
#64 - Line chart and trendline 67
#65 - sparklines 67
#66 - combo charts 67
#67 - subtotal 67
#68 - graph data 67
Viewing & printing 68
Split, hide, and unhide a worksheet window 68
Multiple windows 68
Printing your worksheet 68
Custom views 69
Insert pictures, illustrations, equations, symbols 69
Selection pane 69
Translating 70
Proofing 70
Protecting (locking) workbooks, sheets, and cells 70
Object linking & embedding (OLE) 70
Hands-on exercises #9 71
#69 - custom views 71
#70 - conditional formatting 71
#71 - selection pane and stacking order 72
#72 - protect a workbook and worksheets 72
#73 - Arrange windows 72
#74 - print a worksheet to a pdf 73
*** *** *** ADVANCED EXCEL *** *** *** 73
Pivot tables 73
Pivoting your data 73
Grouping in pivot tables 74
Refreshing pivot tables 74
Slicers and timeline - filtering pivot tables 75

Todd McLeod,5
Pivot charts 75
Hands-on exercises #10 76
#75 - create pivot tables 76
#76 - manually group fields 76
#77 - slicers and timeline 76
#78 - pivot chart, slicer, and timeline 77
Odds and ends 78
Styles and themes 78
Word art, align, rotate, group, and signatures 78
Working with names 78
Different error types 79
Working with errors 79
Watch and calculation options 79
Stats, accessibility, smart lookup, hide ink 80
Help ribbon odds and ends 80
Get and transform data with power query 80
Introduction 80
Get & transform steps 81
Power query editor example 1 82
Power query editor example 2 82
Split by delimiter 85
Replace 85
Extract 85
Format 86
Pivot & unpivot with power query 86
Data from the web and data types 86
Creating our own data type & refresh 87
Power query editor - home ribbon 87
Power query editor - transform ribbon 87
Data generator 88
Hands-on exercises #11 88
#79 - separating data 88
#80 - get and transform surfer first names 88
#81 - get and transform surfer last names 88
#82 - pivot & unpivot 89
#83 - transform data 89
#84 - conditional column 89
#85 - explore documentation 89
Data model 90
Understanding relational data 90
An overview of the data model 90

Todd McLeod,6
Add tables to the data model 90
Creating relationships 91
Pivot tables and pivot charts 91
Using functions in the data model's power pivot 91
Writing a measure 91
Hands-on exercises #12 92
#86 - data model #1 92
#87 - data model #2 93
Working with 1,048,576+ records 93
Excel's limitations 93
Connecting to data and appending data 93
Data model operations 94
Data joins - append & join / merge 94
Append data 94
Data joins - Left outer join 94
Data joins - right outer join 95
Data joins - full outer join 96
Data joins - inner join 97
Data joins - left anti join 97
Data joins - right anti join 98
Hands-on exercises #13 98
#88 - append data 98
#89 - append data update 99
#90 - outer joins and inner join 99
#91 - anti-joins 99
3-D maps 99
Introduction 99
3D maps and America's energy story 100
Creating scenes with 3D maps 100
Hands-on exercises #14 100
#92 - 3-D map Europe's population 100
#93 - 3-D map America's energy story 101
Creating macros 101
Understanding macros 101
Recording a macro 102
Recording a prank 102
Relative vs absolute reference macros 102
Hands-on exercises #15 103
#94 - remove data with a macro 103
#95 - clean up data 103
*** *** PROGRAMMING EXCEL WITH VBA *** *** 104

Todd McLeod,7
VBA basics 104
Introduction 104
Orientation to VBA 104
Playing in the immediate window 105
Recording a macro 106
Deleting a macro from the personal workbook 106
The benefits of editing code 107
Debugging code 107
Hands-on exercises #16 107
#96 - record two macros 107
#97 - record a formatting macro 108
Getting started with coding 108
Coding concepts 108
Selecting objects 109
Adjusting object properties 109
With statement 110
Documentation #1 - embarking on an adventure 111
Documentation #2 - getting started with vba 111
Documentation #3 - the object model 112
Documentation #4 - exploring excel's object model 112
Hands-on exercises #17 113
#98 - modify worksheet name 113
#99 - modify a region 113
#100 - documentation 114
Coding fundamentals 114
Variables 114
Working with variables 114
Calling code 116
For loops 116
Conditional statements - if, select 117
Hands-on exercises #18 119
#101 - coding math 119
#102 - using a for loop 120
#103 - using conditional logic 120
#104 - calling code 121
Useful tools 121
Message box 121
Input box 122
Types of message boxes 122
Hands-on exercises #19 123
#105 - message box 123

Todd McLeod,8
#106 - input box 123
#107 - yes no cancel box 125
User defined functions 125
Easy steps 125
Hands-on exercises #20 127
#108 - user defined function 127
Congratulations 127
Great work! 127
Bonus lecture 128

Getting started

Introduction
Here is a brief overview of what we will cover in this section:
● Introduction
● Exercise files
● Getting your certificate
● Course orientation
● Understanding spreadsheets
● Understanding versions
● Personalization
● Accessibility
● Course files
video: 001 preview

Exercise files
Any file, or files, that I use in a video can be found in the "COURSE CONTENT" panel of the
video in which those files are used. You can also access ALL of the files used in the course by
going to the COURSE FILES area of the GETTING STARTED section.
● If you try to download more than one file at a time, your web browser might ask you if
you want to "download multiple files from this website." Click "yes" to download the files.
video: 002 preview

Getting your certificate


Here is how you get your Microsoft Excel certificate of completion.
video: 003

Todd McLeod,9
Course orientation
● Learning pace
○ change video speed
● This is your course
○ do what you need
○ use it in the way that is best for you
○ quizzes and hands-on exercises are optional
● Course goal
○ a great teacher will teach the student not to need the teacher
○ parable: give a person a fish, or teach them to fish
● Be an adventurer
○ spirit of exploration
● Practice
○ practice leads to progress
● Have fun
○ personal anecdotes
video: 004 preview

Understanding spreadsheets
● Spreadsheets allow us to work with numbers. Spreadsheets are like customizable
calculators. Spreadsheets also allow us to organize and manage data.
○ MS Word allows us to work with words.
○ MS Excel allows us to work with numbers & data.
● Dan Bricklin - father of spreadsheets (1979)

video: 005

Understanding versions
● there are two main versions of microsoft excel
○ WEB BASED
■ it runs on the web
■ you use a web browser to access it
○ COMPUTER BASED

Todd McLeod,10
■ you install it on your computer
■ the computer based version has more functionality than than the web
based version
● Historically, every few years, Microsoft would release a new version of Excel. With
Microsoft 365, versions are released continuously.
○ Microsoft 365 vs installed
■ web based app, software-as-servce, SAS vs. installed app, pc
■ Office 365 revenue overtook traditional license sales for Office in 2017.
● "Microsoft 4Q17: Office 365 revenue surpasses traditional licenses". Ars Technica. Condé Nast. July 21,
2017. Archived from the original on February 1, 2019. Retrieved February 6, 2019.
■ Microsoft 365 was formerly called Office 365
● microsoft 365
○ apps
○ benefits
■ one drive
■ editor (like grammarly)
■ stock photos / videos
■ fonts
■ partner benefits
■ live tech support
links:
● purchasing
○ costco
○ amazon
○ microsoft
● google drive
○ google's sas
○ google's apps
video: 006

Personalization
● installing
● starting excel
● customizing excel
○ changing look and feel
● coming soon features
● keyboard shortcuts
○ ctrl+f
■ find
video: 007 preview maybe

Accessibility
● closed captions
● ease of access settings in Windows

Todd McLeod,11
● microsoft store
○ powertoys
○ mouse pointer highlight
■ safety: app certification
anecdote: poem

video: 008

Course outline
● you can download the course outline as a PDF from here
● keyboard shortcuts
○ ctrl+f
■ find
● EDIT IN
● a few more notes that came up as I recorded the course (video: 09a)
○ excel notification: external data connections have been disabled (video: 09b)
○ OPEN WITH and finding EXCEL.EXE (video: 09c)
video: 009

File extensions and open with


● this is good to know!
video: 009d-file extensions

Todd McLeod,12
Course files
● all files for the course can be found here
video: none

Hands-on exercises #1

#1 - Quiz
Quizzes help you learn the material more quickly. By taking this quiz, you are engaging your
mind. By working to recall the material, the material is more deeply integrated. Take this quiz to
more quickly learn!
video: none

Quiz review
● Any exercise files used in a video lecture are associated with that video lecture and can
be downloaded while you're watching that video lecture.
● You can find all of the files used in this course under the "course files" portion of the
"getting started" section.
● You can change the speed of the lecture videos.
● Who was the creator of spreadsheets:
○ Bill Gates
○ Bill The Cat
○ Dan Bricklin
○ Elon Musk
● When were spreadsheets created?
○ 1962
○ 1972
○ 1979
○ 1989
● Practice leads to progress.
● A good general description of spreadsheets is that they allow us to work with numbers
and data.
● The web version of Microsoft Excel is part of "Microsoft 365"
● When you subscribe to Microsoft 365, you can download a version of Microsoft Excel
that can be installed on your computer.
● At the time of recording, as talked about in the video lecture, who offered the best pricing
for Microsoft 365:
○ Microsoft
○ Amazon

Todd McLeod,13
○ Costco
○ Some guy named "Mikapalooza" on Reddit
● Microsoft Excel is
○ word processing software
○ spreadsheet software
○ database software
○ image editing software
● Microsoft word is to words, as Microsoft Excel is to numbers.
● To have his mouse highlighted, Todd is using:
○ graphic files installed on his machine
○ a piece of software from Microsoft store called "mouse pointer highlight"
○ some "autohotkey" software
○ computer magic

● To make Excel more readable, you can change it to a high-contrast black and white
theme.
video: 11

#2 - Your computer's word size


● Is your computer a 32-bit or 64-bit machine?
○ computer properties
● keyboard shortcuts
○ right clicking
■ context sensitive menu
○ ctrl + t
■ new tab in chrome
○ ctrl + c
■ copy
○ ctrl + v
■ paste
video: 12

Writing formulas

Introduction
video 13

Todd McLeod,14
Workbooks and worksheets
A workbook has worksheets. When you open a Microsoft Excel file you are opening a
workbook. Inside that workbook you will find worksheets. You can add and delete
worksheets as needed. Here is what we will learn:
● Starting Excel
○ workbook
○ worksheet
■ columns
■ rows
■ cells
■ active cell
● keyboard shortcuts
○ ctrl + scroll wheel
■ zoom
file: 14-books-sheets.xlsx
video: 14

Useful keyboard shortcuts


These are some useful keyboard shortcuts:
● keyboard shortcuts
○ alt + tab
■ cycle through open apps
○ ctrl + t
■ new tab in chrome
○ ctrl + c
■ copy
○ ctrl + v
■ paste
○ ctrl + f
■ find
file: 15-books-sheets.xlsx
video: 15

Working with Excel files


● Saving a file
○ before you close an Excel file, if it has yet to be saved, MS Excel will ask you to
save it
○ the filename area reflects whether or not a file has been saved
● Closing Excel
● Opening a file
○ xlsx file extension
■ how to see file extensions

Todd McLeod,15
○ associate "xlsx" files with Excel
● keyboard shortcuts
○ ctrl + s
■ save
○ ctrl + w
■ closing
○ ctrl + n
■ new
○ ctrl + o
■ open
file: 16-books-sheets.xlsx
video: 16

Autosave and autorecover


● microsoft
○ cloud
■ aka, servers
■ aka, computers
○ consumer retention & switching costs
● autosave
○ microsoft: what is AutoSave?
● autorecover
○ Help protect your files in case of a crash
○ crashing an excel file
● keyboard shortcuts
○ ctrl + alt + del
■ task manager
file: 17-books-sheets.xlsx
video: 17

Finding your way around Excel


● TOUR
○ Every Excel file is known as a workbook.
■ Each workbook has worksheets.
○ Spreadsheets are made up of columns and rows.
■ The intersection of a column and row is a cell.
● The active cell has a BOX around it.
● Each cell has a cell address: column row, eg, B2.
● ADDING A SHEET
○ naming it
○ changing its color
● ADDING DATA
○ to enter data into a cell, click on the cell and start typing

Todd McLeod,16
■ you can edit data in a cell by
● double-clicking the cell
● or up in the formula bar
■ cells overflow if there is no data in the adjacent cell
■ #######
● shows that there is data in that cell
○ widen the column to see it
● double-click the divider to perfectly adjust
○ you can make columns wider
○ you can make rows taller
● RIBBON MENUS
○ showing / hiding
● VIEW / SHOW
○ gridlines
○ headings
○ formula bar
● VIEW / WORKBOOK VIEWS
○ normal
○ page break preview
○ page layout
● PAGE LAYOUT / PAGE SETUP
○ print
■ gridlines
■ headings
● STATUS BAR
○ average
○ count
○ sum
file: 18-Finding-Your-Way-Around-Excel.xlsx
video: 18

Mouse pointer awareness


While using Excel, your mouse pointer will change depending upon the context. Paying
attention to the way your mouse pointer looks, and knowing what the different looking
mouse pointers mean, will help you use Excel more effectively.
file: 19-Mouse-Pointer-Awareness
video: 19

Writing formulas
Learn the basics of writing formulas in Excel including the point-and-click method for writing
formulas.
● writing formulas
○ =

Todd McLeod,17
○ ‘=
● point-and-click method
● order of operations
● relative references
● formula ribbon
○ show formulas
● shortcut
○ ctrl + `
■ show formulas
file: 20-Writing-Formulas
video: 20

Relative, absolute, & mixed references


Learn how to use relative, absolute, and mixed references when writing formulas in Excel.
● relative
● ab$olute
● mixed
file: 21-references-rel-absolute
video: 21

Ranges & names


● range
○ a selection of 2+ cells
● colon notation
○ B9:F9
● names
○ named cell & named ranges
file: 22-ranges-colon-notation
video: 22

Hands-on exercises #2

#3 - Quiz
Quizzes help you learn the material more quickly. By taking this quiz, you are engaging your
mind. By working to recall the material, the material is more deeply integrated. Take this quiz to
more quickly learn!
video: none

Quiz review
The area highlighted in red is known as a …

Todd McLeod,18
● row
● column
● cell
● formula

The area highlighted in red is known as a ...


● row
● column
● cell
● quark

Todd McLeod,19
The intersection of a row and a column is a ...
● row
● column
● cell
● rare event

Todd McLeod,20
The address of the highlighted cell is ...
● D6
● C6
● B6
● E6

Todd McLeod,21
This area is known as the ...
● control center
● options arena
● ribbon
● choice panel

This shows you the ADDRESS of the selected cell.


● true
● false

Todd McLeod,22
The area highlighted in red is known as the ...
● data entry box
● login field
● formula bar

Todd McLeod,23
The area highlighted in red is known as a ...
● workbook tab
● worksheet tab
● thumbnail

The area highlighted in red allows you to ...


● add a column of figures together
● add a new spreadsheet tab
● create a new Excel workbook

Todd McLeod,24
The area highlighted in red allows you to ...
● scroll left & right through a single spreadsheet
● scroll left & right through spreadsheet tabs
● move the active cell over one cell

The area highlighted in red allows you to ...


● increase / decrease a calculated result
● add / subtract two numbers
● zoom-in / zoom-out on the spreadsheet
● increase / decrease bank account balances

Todd McLeod,25
All formulas in Excel begin with which operator
● -->
● =
● /
● formulas are enclosed in {}

To use the "point-and-click" method to write a formula, just click on whichever cell you want to
enter for a reference.
● True
● False

You can see all of the formulas on a worksheet by going to the "formula" ribbon and then
choose "show formulas"
● True
● False

This formula "=B9+B10" uses


● only relative references
● has an absolute reference
● has a mixed reference

This formula "=(B9+B10)*$F$14" uses


● only relative references
● has an absolute reference
● has a mixed reference

Todd McLeod,26
This formula "=(B9+B10)*$F14" uses
● only relative references
● has an absolute reference
● has a mixed reference

A range is an area of 2 or more cells.


● True
● False
video: 23

#4 - Data entry
Create a new excel spreadsheet. Do the following:
● create a new worksheet
○ name it “Happy items”
○ give the worksheet tab a color
○ move the worksheet tab to the front of the tabs
● starting in cell B2
○ list five items that make you happy
■ one item in each cell: B2, B3, B4, B5, B6
● Delete the other worksheets
○ right-click the worksheets
● edit the entry in cell B3
○ use the double-click method
● edit the entry in cell B4
○ use the formula bar
file: 24-mcleod-five-happy-things
video: 24

#5 - Adjusting views
Create a new workbook. Do the following:
● view ribbon
○ make sure you are using normal view
■ cycle between
● normal view
● page layout
● page break preview
○ toggle gridlines & headings
● page layout ribbon / page setup dialogue box
○ for printing
■ show gridlines
■ show row and column headings
● collapse the ribbon menu
○ pin the ribbon menu back into place

Todd McLeod,27
file: 25-view-gridlines
video: 25

#6 - Quick average, count, sum


Using the “sales data” worksheet:
● For items F4:F21, what is the
○ count
○ average
○ sum
file: 26-quick-count-avg-sum
video: 26

#7 - Relative references
Open the workbook attached to this lecture. Write a formula which adds up B4:B7. Use relative
references in your formula. Use the autofill handle to copy that formula across B8:M8
file: 27-relative-references
video: 27

#8 - Absolute references
Open the workbook attached to this lecture. Write a formula which calculates the tax. Use an
absolute reference. Use autofill to copy the formula over as applicable.
file: 28-absolute-references
video: 28

#9 - Mixed references
Open the workbook attached to this lecture. Write a formula to fill in each table. Use mixed
references. Use autofill to copy the formula.
file: 29-mixed-references
video: 29

#10 - Gradebook equal weighting


● Calculate the grade for each student. Assume each graded item carries equal weight.
To calculate the grade for each student, just calculate the average score of all scores
for that student.
● Calculate the class average for each graded item.
file: 30-gradebook-equal-weight
video: 30

Todd McLeod,28
#11 - Gradebook weighted
● Calculate the grade for each student. Each graded item does not carry equal weight.
To calculate the grade for each student, you will need to do a weight average
calculation.
● Calculate the class average for each graded item.
file: 31-gradebook-weighted
video: 31

#12 - Gradebook points method


● Calculate the grade for each student. This gradebook is using the points method. To
calculate the grade for each student, just add up a student’s points then divide that
by total points possible.
● Calculate the class average for each graded item.
file: 32-gradebook-points-method
video: 32

#13 - Trip budget


Calculate the costs for a trip to Disneyland for yourself and three others. Have your trip last 5
days.
● ticket price
● airfare
● hotel
● food & incidentals
file: 33-disneyland
video: 33

#14 - Cookie recipe


Create a spreadsheet that has the recipe for oatmeal peanut butter chocolate chip cookies.
● include the quantities
● include the ability for the quantities to multiply by the number of batches desired.
file: 34-choc-chip-cookies
video: 34

Functions

Sum & average


Functions are formulas that are already written for us. Functions allow us to quickly calculate
computations. The sum & average functions are covered in this video.

Todd McLeod,29
file: 35-func-sum
video: 35-func-sum

Max, min, documentation


These functions allow you to find the max value in a series of numbers, and find the min value
in a series of numbers.
file: 36-func-average-max-min
video: 36-func-average-max-min

Count, countif
The count function allows you to count how many items are in a series.
● count
● countif
file: 37-func-count
video: 37-func-count

Round, roundup, rounddown


The rounding functions allow you to round numbers. These functions are covered:
● round
● roundup
● rounddown
Documentation is also covered in this video. Also included is how to copy examples out of
documentation and get them into Excel.
file: 38-func-roundup
video: 38-func-roundup

Rand & randbetween


You can generate random numbers using rand and randbetween.
file: 39-func-rand
video: 39-func-rand

Concat & textjoin


The concat & textjoin functions allow you to join text together.
file: 40-func-concat-textjoin
video: 40-func-concat-textjoin

Days & now


The days function allows you to count the number of days between two dates.
● days

Todd McLeod,30
● now
file: 41-func-days
video: 41-func-days

If
The if function allows you to make a decision based upon the value in a cell.
file: 42-func-if
video: 42-func-if

Hands-on exercises #3

#15 - Quiz
Quizzes help you learn the material more quickly. By taking this quiz, you are engaging your
mind. By working to recall the material, the material is more deeply integrated. Take this quiz to
more quickly learn!
video: none

Quiz review
● Concatenate is a deprecated function.
● Textjoin allows you to specify a delimiter.
● On the data ribbon, "text to columns" allows you to break text apart either by a delimiter
or by a fixed width.
● Examples of how to use a function can be found in the documentation for Excel
functions.
● What is the keyboard shortcut for moving the ACTIVE CELL to the end of contiguous
entries?
○ ctrl + shift + e
○ ctrl + arrow (down, up, left, or right)
○ ctrl + shift + y
○ ctrl + shift + end
● What is the keyboard shortcut for selecting data from the ACTIVE CELL to other cells?
○ ctrl + shift + e
○ ctrl + shift + arrow (down, up, left, or right) OR shift + arrow (down, up, left, or
right)
○ ctrl + shift + y
○ ctrl + shift + end
● What keyboard technique do we use to select non-contiguous data like in the picture?
○ hold down the CTRL key and select data
○ hold down the FN key and select data
○ hold down FN + TAB and select data

Todd McLeod,31
○ use the scroll wheel and meow like a cat

● Using only the keyboard, from the active cell, how do you select the active cell and the
two cells to the right?
○ shift + right-arrow key
○ ctrl + right-arrow key
○ fn + shift + right-arrow key
○ fn + shift + ctrl + windows key + f12 + f1 + right-arrow key
video: 43-quiz-review

#16 - Basic functions - part 1


Use the following functions in the spreadsheet "44-basic":
● sum
● average
● max
● min
● count
● counta
● countif
● roundup
● rounddown
file: 44-basic
video: 44-basic

Todd McLeod,32
#16 - Basic functions - part 2
Use the following functions in the spreadsheet "44-basic":
● sum
● average
● max
● min
● count
● counta
● countif
● roundup
● rounddown
file: 44-basic
video: 45-basic

#16 - Basic functions - part 3


Use the following functions in the spreadsheet "44-basic":
● sum
● average
● max
● min
● count
● counta
● countif
● roundup
● rounddown
file: 44-basic
video: 46-basic

#17 - Random names - part 1


In this hands-on exercise, we will randomly generate names:
1. DOUBLE CHALLENGE - random name generator
○ google:
■ most popular first names
● https://www.ssa.gov/oact/babynames/
■ most popular last names
● https://www.thoughtco.com/most-common-us-surnames-1422656
○ COPY / PASTE **or/and** PASTE SPECIAL / VALUES **or/and** PASTE /
TEXT **or/and** PASTE / MATCH DESTINATION FORMATTING
■ hint: new sheet for each "paste special"
■ hint: DATA / SORT A→Z to get rid of empty spaces
○ arrange names
■ 1 column first names

Todd McLeod,33
■ 1 column last names
○ use these functions
■ COUNTA
■ RANDBETWEEN
■ INDEX
2. REGULAR CHALLENGE
○ into new spreadsheet
■ select the names
■ COPY / PASTE / VALUES
○ split the names
■ DATA / TEXT TO COLUMNS
○ combine the names
■ TEXTJOIN
file: 47-random-names
video: 47-random-names

#17 - Random names - part 2


In this hands-on exercise, we will randomly generate names:
3. DOUBLE CHALLENGE - random name generator
○ google:
■ most popular first names
● https://www.ssa.gov/oact/babynames/
■ most popular last names
● https://www.thoughtco.com/most-common-us-surnames-1422656
○ COPY / PASTE **or/and** PASTE SPECIAL / VALUES **or/and** PASTE /
TEXT
■ hint: new sheet for each "paste special"
■ hint: DATA / SORT A→Z to get rid of empty spaces
○ arrange names
■ 1 column first names
■ 1 column last names
○ use these functions
■ COUNTA
■ RANDBETWEEN
■ INDEX
4. REGULAR CHALLENGE
○ into new spreadsheet
■ select the names
■ COPY / PASTE / VALUES
○ split the names
■ DATA / TEXT TO COLUMNS
○ combine the names
■ TEXTJOIN

Todd McLeod,34
file: 47-random-names
video: 48-random-names

#18 - If
Using the if function, display whether or not an individual is OVER or UNDER budget
file: 49-random-IF
video: 49-random-IF

#19 - Documentation examples


Copy documentation examples for the round function into Excel.
file: 50-round
video: 50-round

Popular Excel functions

Top 10
● SUM function
○ Use this function to add the values in cells.
● IF function
○ Use this function to return one value if a condition is true and another value if it's
false. Here's a video about using the IF function.
● LOOKUP function
○ Use this function when you need to look in a single row or column and find a
value from the same position in a second row or column.
○ AVOID using this one!

Todd McLeod,35

Todd McLeod,36
● VLOOKUP function
○ Use this function when you need to find things in a table or a range by row. For
example, look up an employee's last name by her employee number, or find her
phone number by looking up her last name (just like a telephone book).
● MATCH function
○ DON'T USE THIS ONE - USE XMATCH

○ The XMATCH function searches for a specified item in an array or range of cells,
and then returns the item's relative position.
● CHOOSE function
○ Use this function to select one of up to 254 values based on the index number.
For example, if value1 through value7 are the days of the week, CHOOSE
returns one of the days when a number between 1 and 7 is used as index_num.
○ interesting examples in documentation of combining functions
● DATE function
○ Use Excel's DATE function when you need to take three separate values and
combine them to form a date.
■ For example, you might have a worksheet that contains dates in a format
that Excel does not recognize, such as YYYYMMDD.
● DAYS function
○ Returns the number of days between two dates.
● FIND, FINDB functions
○ FIND and FINDB locate one text string within a second text string. They return
the number of the starting position of the first text string from the first character of
the second text string.
● INDEX function
○ Use this function to return a value from within a range / table / array.
video: 51-top-10

Todd McLeod,37
Striping rows

file: 52-XLOOKUP-STRIPES
video: 52-XLOOKUP-STRIPES

Drop down menu

● https://support.microsoft.com/en-us/office/create-a-drop-down-list-7693307a-59ef-400a-
b769-c5402dce407b
file: 53-XLOOKUP-DROP-DOWN-MENU
video: 53-XLOOKUP-DROP-DOWN-MENU

Xlookup
Use the XLOOKUP function to find things in a table or range by row. For example, look up the
price of an automotive part by the part number, or find an employee name based on their
employee ID. With XLOOKUP, you can look in one column for a search term and return a result
from the same row in another column, regardless of which side the return column is on.
● Note: XLOOKUP is not available in Excel 2016 and Excel 2019, however, you may come
across a situation of using a workbook in Excel 2016 or Excel 2019 with the XLOOKUP
function in it created by someone else using a newer version of Excel.

Todd McLeod,38
● The XLOOKUP function searches a range or an array, and then returns the item
corresponding to the first match it finds. If no match exists, then XLOOKUP can return
the closest (approximate) match.
● =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode],
[search_mode])

file: 54-XLOOKUP
video: 54-XLOOKUP

Vlookup
Vlookup allows us to look a value up in a table of values, then return an associated value.
For instance, in a gradebook a student might have a score of 84%. I could use vlookup to then
insert “B” next to the student’s grade.
file: 55-VLOOKUP
video: 55-VLOOKUP

Gradebook with xlookup, vlookup, & curve


Looking up a letter grade based upon a percentage score using xlookup and vlookup.
file: 56-gradebook
video: 56-gradebook

Xmatch
The XMATCH function searches for a specified item in an array or range of cells, and then
returns the item's relative position.

Todd McLeod,39

file: 57-xmatch
video: 57-xmatch

Choose
Use this function to select one of up to 254 values based on the index number.
file: 58-choose
video: 58-choose

Date, year, month, day, left, mid, right, edate, datedif


● date
○ takes three separate values and combines them to form a date.
■ returns the sequential serial number that represents a particular date.
○ useful in situations where year, month, and day are supplied

Todd McLeod,40
■ For example, you might have a worksheet that contains dates in a format
that Excel does not recognize, such as YYYYMMDD.

● year, month, day


○ extract the corresponding value from a date
● left, mid, right
○ extract a specified number of characters from a text string
● edate
○ adds/subtracts months from a date
● datedif - don't use!
○ calculates the number of days, months, or years between two dates.

file: 59-DATE
video: 59-DATE

Find & findb


● FIND and FINDB locate one text string within a second text string.
○ They return the number of the starting position of the first text string from the first
character of the second text string.
● FIND is for languages that use the single-byte character set (SBCS),
● FINDB is for languages that use the double-byte character set (DBCS).

Todd McLeod,41
file: 60-find
video: 60-find

Index
● returns a value from a table / range / array.
● returns a reference from a table / range / array.
file: 61-index
video: 61-index

Hands-on exercises #4

#20 - Quiz
Quizzes help you learn the material more quickly. By taking this quiz, you are engaging your
mind. By working to recall the material, the material is more deeply integrated. Take this quiz to
more quickly learn!
video: none

Quiz review
● To use Excel effectively, you must look up functions in documentation and read
about them.
● The function DATEDIF will accurately calculate the difference between dates.
● You should never use the DATEDIF function.
● You should strongly avoid using the LOOKUP function.
● When doing a "lookup," you should avoid using the LOOKUP function and instead use
the XLOOKUP function.
● If you're not familiar with the function you are going to use, you should read the
documentation for that function.
● If it has been awhile since you have skimmed the documentation on a function you
regularly use, it would be a good idea to look at it.

Todd McLeod,42
● To get to this dialog box:

○ RIGHT CLICK and choose FORMAT


○ press CONTROL + F10
○ do the hokey-pokey and turn yourself around
● You can RIGHT CLICK a cell and then choose FORMAT to format the cell as a
specific type of data such as general, text, currency, or number.
● Functions are like building blocks, or legos. We can find creative ways to combine
functions together into one formula.
● The INDEX function has two different argument lists. All you really need to remember,
however, is that the first three arguments for both are INDEX(array_reference, row_num,
[column_num])
● You can add stripes, also known as "row striping," to a spreadsheet by using conditional
formatting, choose new rule, and then using the formula =ISEVEN(ROW())
● You can add a drop-down menu to a spreadsheet by using DATA VALIDATION on the
data ribbon.
● The YEAR, MONTH, and DAY functions can extract the year, month, and day from
a DATE.
● The LEFT, MID, and RIGHT functions can extract a portion of text from a text value.
● the EDATE function is used to add, or subtract, months from a DATE.
● You should never use the DATEDIF function.
● The INDEX function is great for randomly generating data from a list.
● The RAND and RANDBETWEEN functions are also great at helping generate random
data from a list.
● If you want to count any non-blank cell, regardless of whether or not text or numbers
are stored in the cell, which is the best function for this job:
○ COUNT
○ COUNTA
video: 62

#21 - Secret message


Use the workbook associated with this exercise to find the secret message.

Todd McLeod,43
file: 63-secret-message
video: 63-secret-message

#22 - Date exercises


Use the workbook associated with this exercise to do the date hands-on exercises.
file: 64-date-exercise
video: 64-date-exercise

#23 - Time exercises


Use the workbook associated with this exercise to do the time hands-on exercises.
● https://support.microsoft.com/en-us/office/calculate-the-difference-between-two-times-e1
c78778-749b-49a3-b13e-737715505ff6
file: 65-TIME
video: 65-TIME

#24 - Conditional formatting - stripe rows


Use the workbook associated with this exercise to do the hands-on exercises.
file: 66-conditional-formatting
video: 66-conditional-formatting

#25 - Conditional formatting - sandbox


Play with conditional formatting to see what effects you can realize.
● also covered:
○ =ADDRESS(ROW(),COLUMN(),4)
○ ROW()
○ COLUMN()
file: 67-conditional-formatting-sandbox
video: 67-conditional-formatting-sandbox

#26 - Data validation - number and text


Only allow people to enter text for their name, and a whole number from 0 to 130 for their age.
file: 68-data-validation-num-text
video: 68-data-validation-num-text

#27 - Data validation - drop-down menu


Use the workbook associated with this exercise to do the hands-on exercises.
● also covered
○ opening a CSV file
files:
● 69-data-validation-drow-down-menu

Todd McLeod,44
● 69-life_expectancy_years.csv
video: 69-data-validation-drow-down-menu

#28 - Xlookup - life expectancy


Use the workbook associated with this exercise to do the date hands-on exercises.
● also covered in this video:
○ SORT
■ sorting data
file: 70-xlookup-life-expectancy
video: 70-xlookup-life-expectancy

#29 - Xlookup gradebook


Use the workbook associated with this exercise to do the date hands-on exercises.
file: 71-xlookup-gradebook
video: 71-xlookup-gradebook

#30 - Find peace


Use the workbook associated with this exercise to find peace.
file: 72-find-peace
video: 72-find-peace

#31 - Gapminder
Play with gapminder - very cool data and data visualization!
● https://www.gapminder.org/tools/
And check out the data:
● https://www.gapminder.org/data/
video: 73-gapminder

Introduction to formatting

Introduction
Formatting your worksheets is important.
● content and form
○ It is not only what you say that matters (the content) but also how you say it (the
form). When studied, the greatest impact upon others isn’t the content, but the
form. The 7 38 55 study from UCLA says that what impacts people in public
speaking is:
■ 7% the content

Todd McLeod,45
■ 38% how it’s said
■ 55% body language
○ This is true in public speaking, this is true in art, this is true in job interviews, and
this is true in your Excel spreadsheets. Take your content and give it good form
(make it look good).
● game plan
○ HOME ribbon
■ except "styles" and "format as table" - cover that later
video: 74-intro-content-form

Font
● HOME / FONT

Font is feeling
file: 75-formatting-fonts
video: 75-formatting-fonts

Clear formats
● HOME / EDITING / CLEAR
○ clear all
○ clear formats
○ clear contents
○ clear comments and notes
○ clear hyperlinks
● how to insert
○ comment
○ note
○ hyperlink
file: 76-formatting-clear
video: 76-formatting-clear

Format painter
● HOME / CLIPBOARD
file: 77-formatting-painter
video: 77-formatting-painter

Cut, copy, paste


● HOME / CLIPBOARD
○ cut

Todd McLeod,46
○ copy
■ copy as picture
○ paste
■ keep source formatting
■ match destination formatting
■ paste special
● many options
○ transpose (already saw this)
○ paste as values (already saw this)
file: 78-cut-copy-paste
video: 78-cut-copy-paste

Alignment
● HOME / ALIGNMENT
○ horizontal alignment
○ vertical alignment
○ merge and center
○ wrap text
file: 79-alignment
video: 79-alignment

Inserting & deleting cells, rows, and columns


● HOME / CELLS
file: 80-cells-rows-columns
video: 80-cells-rows-columns

Format cells dialog box


More options are found in the format cells dialog box.
file: 81-format-cells-dialog-box
video: 81-format-cells-dialog-box

Number formats
Formatting numbers
● general
● number
● currency
● accounting
● date
● time
● percentage
● fraction

Todd McLeod,47
● scientific
● text
● special
● custom
file: 82-format-numbers
video: 82-format-numbers

Custom fonts
In graphic design, font determines feeling. There are two broad categories of fonts: serif and
sans-serif. A serif font has feet; a sans-serif font does not. For text on computer screens,
sans-serif is the most popular and, perhaps by consensus, best choice. You can find the most
popular fonts in the world on Google Fonts. Once the fonts are installed on your computer, you
can use them in your spreadsheets. Take-aways:
● use a sans-serif font
● use Google Fonts to get the most popular fonts
file: 83-custom-fonts
video: 83-custom-fonts

Hands-on exercises #5

#32 - Quiz
Quizzes help you learn the material more quickly. By taking this quiz, you are engaging your
mind. By working to recall the material, the material is more deeply integrated. Take this quiz to
more quickly learn!
video: none

Quiz review
● When conveying information to someone, what is more important
○ content
○ form
● Obviously content matters, but when studied, what has a greater impact on people:
○ what you say
○ how you say it
● You can install new fonts on your computer by going to Google Fonts.
● If you double-click the format painter, you can paint formatting from one cell to many
cells.
● You can copy a portion of a spreadsheet as a picture.
● When you copy something from the web, when you paste it in Excel, you can choose to
"match destination formatting."

Todd McLeod,48
● There are many options for pasting which you can explore, but primarily Todd uses
paste, paste as values, or match destination formatting.
● To format your spreadsheet, adjusting the horizontal and vertical alignment can produce
a nice effect.
● Looking at this picture, you can quickly increase or decrease the size of a font by
pressing the large or small A.

● Looking at this picture, the arrow in the bottom right corner tells you that there are
more options available.

● In graphic design, font creates feeling.


● In this section, using the spirit of adventure and exploration, we discovered how to use a
comment and a note.
● In this section, using the spirit of adventure and exploration, we discovered how to insert
a hyperlink to a website.
● In the format cells dialog box, there is an option to "shrink to fit" which shrinks the
contents of a cell to fit the cell.

Todd McLeod,49
● According to Todd, going on vacation to Hawaii sounds great, but everything is so pricey
now!
video: 84

#33 - Copy data from wikipedia


Copy data from wikipedia and paste it into Excel so that it doesn't have any of the formatting
from the web.
file:
● create own file
● my-file-85-copy-from-web
video: 85-copy-from-web_1

#34 - Get data from gapminder


Download data from gapminder as a "csv" file, then open it in Excel and save it as an Excel
"xlsx" workbook.
● Gapminder data
○ https://www.gapminder.org/data/
file:
● create own file
● my-file-86-data-from-gapminder-literacy_rate_adult_total_percent_of_people_ages
_15_and_above.csv
● my-file-86-data-from-gapminder.xlsx
video: 86-data-from-gapminder

#35 - Number formatting


Using the format cells dialog box, format various data as different numbers.

Todd McLeod,50
● insert comment
● insert text box
● insert shape
● change stacking order
○ move to back
● group
○ group graphic items together
● delete a textbox
file: 87-number-formatting
video: 87-number-formatting

#36 - Alignment
Use the "format cells" dialog box "alignment" tab to align cell contents.
file: 88-alignment
video: 88-alignment

#37 - Font formatting


Using the "format cells" dialog box "font" tab:
● Use "Parisienne Designed by Astigmatic" from Google Fonts for all text.
● Also make sure to "superscript" the 42 in cell V27.
file: 89-font-formatting
video: 89-font-formatting

#38 - Fill and border


Using the "format cells" dialog box, work with the "fill" & "border" tabs for format your
spreadsheet.
file: 90-fill-border
video: 90-fill-border

#39 - Clearing formatting


Use the “clear” button on the home ribbon to clear the formatting on a spreadsheet.
file: 91-clear-formatting
video: 91-clear-formatting

#40 - Spreadsheet formatting


Format this spreadsheet and make it look pretty.
● hint:
○ unhide a column
○ unhide a row
file: 92-spreadsheet-formatting
video: 92-spreadsheet-formatting

Todd McLeod,51
#41 - Transpose data
Transpose the data from a column to a row. Important: only select the data, do not select the
entire column. If you select the entire column, you will not be able to paste transpose.
file: 93-transpose
video: 93-transpose

#42 - Adjust height & width


Adjust the row and column height to look good. Hide columns B & C.
● BONUS - do some formatting also
file: 94-height-width
video: 94-height-width

#43 - Link, text box, note, comment, indent


Create a new spreadsheet and do the following:
● link
○ create a link
○ https://www.thesunmagazine.org/issues/418/in-my-good-death
● text box
○ insert a text box
● note
○ insert a note
● comment
○ insert a comment
● indent
○ indent the text under TODO
■ link
■ text box
■ note
■ comment
file: 95-link-textbox–note-comment-indent
video: 95-link-textbox–note-comment-indent

#44 - congrats, reviewing keyboard shortcuts, & some new stuff


This is the end of the beginner section.
● this is a milestone!
● congratulations!
● look at everything you've learned!
○ shortcuts
■ right clicking
● context sensitive menu
■ ctrl + c
● copy

Todd McLeod,52
■ ctrl + v
● paste
■ ctrl + shift + v
● paste without formatting in google chrome
The Second Coming
BY WILLIAM BUTLER YEATS
Turning and turning in the widening gyre
The falcon cannot hear the falconer;
Things fall apart; the centre cannot hold;
Mere anarchy is loosed upon the world,
The blood-dimmed tide is loosed, and everywhere
The ceremony of innocence is drowned;
The best lack all conviction, while the worst
Are full of passionate intensity.

Surely some revelation is at hand;


Surely the Second Coming is at hand.
The Second Coming! Hardly are those words out
When a vast image out of Spiritus Mundi
Troubles my sight: somewhere in sands of the desert
A shape with lion body and the head of a man,
A gaze blank and pitiless as the sun,
Is moving its slow thighs, while all about it
Reel shadows of the indignant desert birds.
The darkness drops again; but now I know
That twenty centuries of stony sleep
Were vexed to nightmare by a rocking cradle,
And what rough beast, its hour come round at last,
Slouches towards Bethlehem to be born?

■ paste in URL window to remove formatting


● The Second Coming BY WILLIAM BUTLER YEATS Turning and
turning in the widening gyre The falcon cannot hear the falconer;
Things fall apart; the centre cannot hold; Mere anarchy is loosed
upon the world, The blood-dimmed tide is loosed, and everywhere
The ceremony of innocence is drowned; The best lack all
conviction, while the worst Are full of passionate intensity. Surely
some revelation is at hand; Surely the Second Coming is at hand.
The Second Coming! Hardly are those words out When a vast
image out of Spiritus Mundi Troubles my sight: somewhere in
sands of the desert A shape with lion body and the head of a man,
A gaze blank and pitiless as the sun, Is moving its slow thighs,
while all about it Reel shadows of the indignant desert birds. The
darkness drops again; but now I know That twenty centuries of

Todd McLeod,53
stony sleep Were vexed to nightmare by a rocking cradle, And
what rough beast, its hour come round at last, Slouches towards
Bethlehem to be born?
■ ctrl + x
● cut
■ ctrl + z
● undo
■ ctrl + y
● redo
■ alt + tab
● cycle through open applications
■ ctrl + scroll wheel
● zoom in, zoom out
■ ctrl + backtick
● show / hide formulas
■ ctrl + f
● find
● REPLACE
■ ctrl + t
● new tab in google chrome
■ escape
● escape from some condition
■ F4
● add $s
● cycle through ab$olute, mixed, relative references
■ click → then → shift + click
● select first item, last item, and every item inbetween
■ ctrl + click
● select non-contiguous data
■ ctrl + arrow (down, up, left, or right)
● moves the ACTIVE CELL to the end of contiguous entries
■ shift + arrow (down, up, left, or right)
● OR ctrl + shift + arrow (down, up, left, or right)
● selects data from the ACTIVE CELL to other cells
■ ctrl + w
● close a workbook
■ ctrl + o
● open a workbook
■ ctrl + n
● new workbook
■ ctrl + s
● save a workbook
■ alt

Todd McLeod,54
● in excel, shows letters and gives you options to go to
different areas by pressing a key on your keyboard
■ ctrl + alt + del
● task manager
file: 96-review-congrats-milestone
video: 96-review-congrats-milestone

#44 - review continued


file: 97-review-congrats-milestone
video: 97-review-congrats-milestone

*** *** *** INTERMEDIATE EXCEL *** *** ***

Working with Data

Acquiring data
Excel is made for working with numbers; for taking data and turning it into information. In this
section, we are going to dive into the data ribbon. To work with data, we will need to get some
data. A few sources we can use to acquire data with which to work:
● Gapminder - https://www.gapminder.org/data/
● Yahoo finance - market history
● https://www.census.gov/
○ US Census quickfacts
● ctrl + shift + t
○ in google chrome, this opens browser tabs you have closed
file: 98-acquire-data
video: 98-acquire-data

Previewing data generators


file: 99-previewing-data-generators
video: 99-previewing-data-generators

Generating data - Hawaii Shoe Company - step #1


● referencing data in the same workbook on different worksheets
● randomly generating the name of a store location
file: 100-generating-data-HI-shoes-step-1
video: 100-generating-data-HI-shoes-step-1

Todd McLeod,55
Generating data - Hawaii Shoe Company - step #2
● randomly generating the product sold
● randomly generating the quantity sold
file: 101-generating-data-HI-shoes-step-2
video: 101-generating-data-HI-shoes-step-2

Generating data - Hawaii Shoe Company - step #3


● making sure every store sells every product
● making sure every product is in every store
● randomly generating the store product sold
file: 102-generating-data-HI-shoes-step-3
video: 102-generating-data-HI-shoes-step-3

Generating data - Hawaii Shoe Company - step #4


● static data
● copy / past values
● pivot tables
file: 103-generating-data-HI-shoes-step-4
video: 103-generating-data-HI-shoes-step-4

Generating data - Outdoor Gear Coop - exploration #1


file: 104-generating-data-outdoor-gear-1
video: 104-generating-data-outdoor-gear-1

Generating data - Outdoor Gear Coop - exploration #2


file: 105-generating-data-outdoor-gear-2
video: 105-generating-data-outdoor-gear-2

Generating data - names - exploration #1


file: 106-generating-data-names-1
video: 106-generating-data-names-1

Freeze panes
Freeze frames allows us to freeze certain columns or rows in your worksheet. This is helpful so
that you can see headers associated with data as you scroll through the data.
file: 107-freeze-panes
video: 107-freeze-panes

Todd McLeod,56
Sort
Sort allows us to quickly sort data. This is a powerful tool.
file: 108-sort
video: 108-sort

Filter
Filter allows us to filter our data by criteria we specify. When we filter data, we tell Excel to only
show certain data based upon certain criteria.
file: 109-filter
video: 109-filter

Advanced filter
Advanced filter allows you to do the following:
● see your filter criteria
● do "AND" & "OR" filtering
● use wildcards such as "*"
● use other operators such as not equal "<>"
● show unique records
● multiple criteria in one column
file: 110-advanced-filter
video: 110-advanced-filter

Filter function
This is the filter function.
file: 111-filter-func
video: 111-filter-func

Find & replace


Find and replace are great. Find helps you find data quickly. Replace helps you find and replace
certain data. You can also use “find” in many other applications.
file: 112-find-replace
video: 112-find-replace

Hands-on exercises #6

#45 - Hawaii shoe company generator


Open the workbook associated with this hands-on exercise. Complete the worksheets with their
tabs labeled "complete this" and "pivot table."

Todd McLeod,57
● xlookup
● textjoin
● insert / recommended pivot tables
● randbetween
file: 113-HOE-45-generating-data-HI-shoes
video: 113-HOE-45-generating-data-HI-shoes

#46 - Outdoor gear generator


Open the workbook associated with this hands-on exercise. Complete the worksheets with their
tabs labeled "complete this."
file: 114-HOE-46-generating-outdoor-gear
video: 114-HOE-46-generating-outdoor-gear

#47 - Name generator


Open the workbook associated with this hands-on exercise. Complete the worksheets with their
tabs labeled "complete this."
file: 115-HOE-47-name-generator
video: 115-HOE-47-name-generator

#48 - Birth name data


How popular is your first name? How popular is your last name? The Social Security
administration in the United States keeps lists of the names given to children at birth. Go to
● first name
○ https://www.ssa.gov/oact/babynames/
Find the data for your year of birth. Copy this data into Excel. Next, find info about your last
file: 116-birth-name-data
video: 116-birth-name-data

#49 - Birth name data #2


Download "national data" on names either from this lecture, or from here:
● https://www.ssa.gov/oact/babynames/limits.html
You will have a ZIP file. Inside this zip file are a bunch of txt files. We will want to associate "txt"
files with Excel. To do this, we will need to locate the excel program.
Follow these steps:
1. unzip the data
2. open the data in excel
a. either use "open with" or
b. copy / paste
3. use DATA / TEXT TO COLUMNS
4. save as an excel workbook
● Pinned EXCEL to taskbar

Todd McLeod,58
● Created shortcut to Excel on the desktop
file: 117-names.zip
file: 117-birth-name-data-2
video: 117-birth-name-data-2

#50 - jeopardy questions filter


The csv file has 200,000+ Jeopardy questions.
1. Filter the records to display only those records where the QUESTION mentions "Wilde."
You may need to use the "CONTAINS" text filter search option.
2. Filter the records to display only those records where the ANSWER mentions "Wilde."
You may need to use the "CONTAINS" text filter search option.
kaggle - a subsidiary of Google LLC, is an online community of data scientists and machine
learning practitioners.
● jeopardy questions
○ https://www.kaggle.com/datasets/tunguz/200000-jeopardy-questions?resource=d
ownload
● rumi poems
○ https://www.kaggle.com/datasets/hskhawaja/poems-by-rumi
file: 118-jeopardy-questions
file: 118-jeopardy-questions.csv
video: 118-jeopardy-questions

#51 - jeopardy questions advanced filter


1. Use advanced filter to display only those records that have "Copernicus" as an answer
to a question worth $200
2. Use advanced filter to display only those records that have "Copernicus" as an answer
to a question worth $200 OR have a question ">=" $2000
3. Clear all filters, then sort the records by value from greatest to smallest, then use a filter
to remove all values equal to "None" - YOU MIGHT USE THIS "<>" NOTATION
file: 119-jeopardy-questions
video: 119-jeopardy-questions

#52 - outdoor gear advanced filter


Use advanced filter to filter the data so that
● salesperson is Brown, Ruth AND price is >499
OR
● salesperson is Berger, Sunanna AND total is >1000 AND manufacturer is Big Agnes
file: 120-advanced-filter
video: 120-advanced-filter

Todd McLeod,59
#53 - filter & freeze panes data
Using the “121-filter-freeze-frame.xlsx” spreadsheet,
● display countries which have a life expectancy greater than age 75 in 2016
● use freeze frames to hold the column and row headings in place
file: 121-filter-freeze-frame
video: 121-filter-freeze-frame

#54 - copy data from web, freeze frame, sort, filter


Using Wikipedia’s List of Languages page,
● bring the table of data showing the languages spoken into Excel
● add freeze frames as appropriate
● sort the list by “percentage of world population” smallest to largest
● filter to display only languages spoken by 70 million or more individuals
file: 122-copy-freeze-sort-filter
video: 122-copy-freeze-sort-filter

#55 - replace data


Open the workbook. Select the range B3-P34. Replace all grades of 100 with 102.
Important: if you didn't highlight the range, you would need to change back the points possible for each assignment to
100.
file: 123-replace-data
video: 123-replace-data

#56 - filter data using OR


Filter the data using advanced filter to display
● avg monthly searches > 100001
OR
● suggested bid < .10
file: 124-filter-data-with-or
video: 124-filter-data-with-or

Progressing with data

Flash fill
Flash fill recognizes patterns and then completes the pattern, filling in empty cells. To
demonstrate this, we will open the spreadsheet used in this video, enter the full name of one
person, then use “flash fill” to enter the rest of the names.
file: 125-flash-fill
video: 125-flash-fill

Todd McLeod,60
Remove duplicates
You can remove duplicate data using the “remove duplicates” tool from the data ribbon.
● download the spreadsheet used in this video then remove the duplicates.
● try changing the data in one row of a duplicate, then “remove duplicates” in such a way
that this row with changed data is not removed.
file: 126-remove-duplicates
video: 126-remove-duplicates

Consolidate
Consolidate will take data in different locations and run calculations on that data.
file: 127-consolidate
video: 127-consolidate

Trace precedents
● formulas / trace precedents
○ remove arrows
● formulas / trace precedents N TIMES
file: 128-trace-precedents
video: 128-trace-precedents

What if - sensitivity analysis - goal seek


What if analysis is the origin of spreadsheets. At Harvard Business School, Dan Bricklin created
the first spreadsheet to do “what if” analysis. What if analysis is simply asking “what if”
questions. What if this happens? What if that happens? For “goal seeking” what if analysis,
we define a certain goal and then Excel figures out how numbers need to change to realize that
goal.
file: 129-goal-seek
video: 129-goal-seek

What if - sensitivity analysis - data table


A data table is a range of cells in which you can change values in some of the cells and come
up with different answers to a problem. Experimenting with different values to observe the
corresponding variation in results is a common task in data analysis. Data tables help you
explore a set of possible outcomes. data tables makes it easy to examine a range of
possibilities at a glance. Because you focus on only one or two variables, results are easy to
read and share in tabular form. A data table cannot accommodate more than two variables. If
you want to analyze more than two variables, you should instead use scenarios. Although it is
limited to only one or two variables (one for the row input cell and one for the column input cell),
a data table can include as many different variable values as you want.
● data table with one variable

Todd McLeod,61
● data table with two variables
file: 130-data-table
video: 130-data-table

What if - sensitivity analysis - scenario


The scenario manager allows you to create and save different scenarios. You can then easily
click between the different scenarios. You can also show a summary of the scenarios.
● data table
○ many possible outcomes based upon one or two changing inputs.
● scenario
○ one possible outcome based upon many changing inputs.
Switch between various sets of values by using scenarios. A Scenario is a set of values that
Excel saves and can substitute automatically on your worksheet. You can create and save
different groups of values as scenarios and then switch between these scenarios to view the
different results. If several people have specific information that you want to use in scenarios,
you can collect the information in separate workbooks, and then merge the scenarios from the
different workbooks into one. After you have all the scenarios you need, you can create a
scenario summary report that incorporates information from all the scenarios. Scenarios are
managed with the Scenario Manager wizard from the What-If Analysis group on the Data tab.
file: 131-scenario
video: 131-scenario

Forecasts
forecast sheet
file: 132-forecasts
video: 132-forecasts

Hands-on exercises #7

#57 - consolidate
Open the spreadsheet with the unemployment data for individuals above the age of 15. There
are two sets of four worksheets. Use consolidate on each of the sets of data.
● What is the difference?
● How did this difference occur?
file: 133-consolidate
video: 133-consolidate

#58 - goal seek


Use goal seek to determine what grade you need to get on the final to earn an “A”.

Todd McLeod,62
video: 134-goal-seek

#59 - remove duplicates


Remove duplicates from your contact list of friends.
file: 135-remove-duplicates
video: 135-remove-duplicates

#60 - scenarios
Create the following scenarios
● one
○ 50% on the final
○ 100% on chapter 1, 2, 3
● two
○ 75% on the final
○ 50% on chapter 1, 2, 3
● three
○ 90% on the final
○ 0% on chapter 1, 2, 3
Show a scenario summary when you are done.
file: 136-scenario
video: 136-scenario

#61 - data table


Create a data table with the two inputs being your final score and your attendance score.
file: 137-data-table
video: 137-data-table

#62 - relative, absolute, mixed references


Build the same solution as in the previous exercise but instead of using a data table, use
relative, absolute, and mixed references.
file: 138-abs-rel-mixed-refs
video: 138-abs-rel-mixed-refs

#63 - forecast
Using the “close” price, what is the forecast for this stock over the next couple of years with
95% confidence?
file: 139-forecast
video: 139-forecast

Todd McLeod,63
Displaying data

Group
We can organize our data into groups. You can group columns or rows together. When you
group data, navigation appears to the left of rows or to the top of columns. You can click on
these navigation elements to expand or contract your data. This allows you to quickly reveal,
or hide, groups of data. Note: compare with “hide” columns / rows.
file: 140-group
video: 140-group

Visually representing data


The representation of data influences the perception of data. Here we once again come
back to content and form: It’s not just what you say, it’s how you say it. Great examples of data
representation:
● Gapminder - https://www.gapminder.org/tools/
● Aaron Koblin - http://www.aaronkoblin.com/
Examples of different charts we can create:
● pie
○ parts of a whole
● line
○ data changing over time
● column
○ comparing quantities
● bar
○ like column but horizontal
● stacked column
○ like a pie chart and a column chart combined
● stacked bar
○ like stacked column but horizontal
○ two different charts convey different impressions
● trendlines
○ trends over time
● sparklines
○ small charts that occupy a single cell
● scatter
○ scattered dots of data
file: 141-visual
video: 141-visual

Todd McLeod,64
Chart creation
When you create a chart, what you select is crucially important. Generally speaking, you will
want to select
● data, without totals
● column headers
● row headers
Sometimes that means selecting non-contiguous regions. To do that
● ctrl + click-&-drag
If you don't like the way a chart looks when you create it, try selecting different data and creating
the chart again. In this video, we will create the following charts:
● pie
● line
● column
● bar
file: 142-chart-creation
video: 142-chart-creation

Chart creation II
Creating the following charts:
● stacked column
● stacked bar
● donut
You can also switch the representation of the data on the x / y axis:
● right click a chart
○ change chart type
■ column, line, pie, bar ….
○ select data
■ switch row / column
● changes the way data is displayed
file: 143-chart-creation-II
video: 143-chart-creation-II

Chart formatting
A lot of creating charts is a trial and error process:
● create different charts until you get one you like
● try formatting options until you get the look you like
You can ROTATE 3-D pie charts.
● click a chart
○ plus ( + ) to the right
■ show/hide different aspects of the chart
● click part of a chart
○ delete it by pressing delete

Todd McLeod,65
file: 144-chart-formatting
video: 144-chart-formatting

Chart formatting II
When formatting charts, embrace a spirit of exploration and experimentation. Pay attention
to what you are left-clicking and right-clicking. Look at the options available. Explore and
experiment until you get the look you want.
● click a chart
○ paintbrush to the right
■ change look
● right click a chart
○ change chart type
■ column, line, pie, bar ….
○ select data
■ switch row / column
● changes the way data is displayed
○ move chart
■ new sheet
● rotating a 3D chart
file: 145-chart-formatting-II
video: 145-chart-formatting-II

Chart sparklines
Sparklines are small charts that occupy a single cell.
file: 146-chart-sparklines
video: 146-chart-sparklines

Combo chart
Combo charts allow you to combine two charts. Creating a combo chart requires a few steps:
● create a chart with one column of data
● copy/paste a second column of data onto the chart
● select the chart, then change the chart type to a combo chart
You can create a secondary axis so that data of different scales can still be graphed together.
● consider including an axis title so that others can easily interpret the data.
file: 147-combo-chart.xlsx
file: 147-secondary-axis.png
video: 147-combo-chart

Chart trendlines
Use a trendline to show the general trend of some data. You can use trendlines with some
charts. To insert a trendline, first click on your chart, then go to:

Todd McLeod,66
file: 148-chart-trendlines
video: 148-chart-trendlines

Hands-on exercises #8

#64 - Line chart and trendline


Use “get external data from text” which will launch the “text import wizard” dialog box and then
import the “142-hands-on-01.csv” data. Chart the data. Add a trendline to it. Choose
"polynomial" as the type of trendline.
file: 149-line-chart-trendline
video: 149-line-chart-trendline

#65 - sparklines
Add sparklines for the data.
file: 150-sparklines
video: 150-sparklines

#66 - combo charts


Create two combo charts:
● one
○ unemployment
○ presidential approval
● two
○ consumer confidence
○ presidential approval
file: 151-combo-president-approval
video: 151-combo-president-approval

#67 - subtotal
Subtotal this data:
● sport
● sales
file: 152-subtotal
video: 152-subtotal

#68 - graph data


Graph the sales data. Show the sales for each sales person by month.
file: 153-graph-sales-data
video: 153-graph-sales-data

Todd McLeod,67
Viewing & printing

Split, hide, and unhide a worksheet window


You can simultaneously view different areas of a spreadsheet by splitting the spreadsheet.
● VIEW ribbon
○ split
○ hide
○ unhide
file: 154-split-hide-unhide-worksheet
video: 154-split-hide-unhide-worksheet

Multiple windows
You can also simultaneously view different areas of a spreadsheet by having multiple
windows.
● new window
○ arrange all
○ switch windows
○ view side-by-side
■ synchronous scrolling
■ reset window position
file: 155-multiple-windows
video: 155-multiple-windows

Printing your worksheet


To print well in Excel, the first and most important thing you need to know is how to look at what
is going to be printed. To do this, we can use the following
● VIEW ribbon
○ page break preview
○ page layout
● PAGE LAYOUT ribbon
○ page setup dialogue box
■ gridlines
■ row and column headings
■ rows to repeat at the top
■ footer / page numbers
○ other page setup items
■ orientation
● landscape
● portrait
■ fit-to
■ paper size

Todd McLeod,68
● letter, legal, etc
■ margin
● center

○ print preview
■ CTRL + P
● print to file
file: 156-printing-worksheets.xlsx
file: 156-printing-worksheets.pdf
video: 156-printing-worksheets

Custom views
You can use a custom view to save specific display settings (such as
● hidden rows and columns
● cell selections
● filter settings
● window settings
● print settings
○ page settings
○ margins
○ headers and footers
○ sheet settings
You can save a custom view of a spreadsheet in custom views. This allows you to easily switch
back to a certain view of your worksheet.
● documentation
● compare this with the "data / what if / scenario manager"
○ A Scenario is a set of values that Excel saves and can substitute automatically
on your worksheet. You can create and save different groups of values as
scenarios and then switch between these scenarios to view the different results.
○ scenario manager
file: 157-custom-views
video: 157-custom-views

Insert pictures, illustrations, equations, symbols


From the insert ribbon, you can insert illustrations, equations, and symbols.
file: 158-pictures-illustrations-equations-symbols
video: 158-pictures-illustrations-equations-symbols

Selection pane
The selection pane will help you select a specific object on a page.
file: 159-selection-pane
video: 159-selection-pane

Todd McLeod,69
Translating
The translate function in Excel doesn’t work all that well, but it does work some of the time.
file: 160-translating
video: 160-translating

Proofing
The proofing tools include a spell checker and thesaurus. It is always good to spell check your
work before sharing it with others.
file: 161-proofing
video: 161-proofing

Protecting (locking) workbooks, sheets, and cells


● FILE LEVEL (file / info)
○ Protect an excel file
■ password needed to open
○ Read only
■ you can make changes, you just can't save
● WORKBOOK LEVEL
○ Protect a workbook structure
○ prevents viewing hidden worksheets, adding, moving, deleting, or hiding
worksheets, and renaming worksheets
● WORKSHEET LEVEL
○ Control how users work within worksheets. Specify exactly what users can
do within a sheet
■ STEP 1: LOCK CELLS / UNLOCKED CELLS
■ STEP 2: protect sheet with password
● notice the checkbox:
○ "protect worksheet and contents of locked cells"
To prevent other users from viewing hidden worksheets, adding, moving, deleting, or
hiding worksheets, and renaming worksheets, you can protect the structure of your
Excel workbook with a password.
file: 162-protect
video: 162-protect

Object linking & embedding (OLE)


Object linking and embedding allows you to either LINK or EMBED content from excel into
ms word. When content is linked the content in word updates when the source data in excel
updates.
file: 163-ole.xlsx
file: 163-ole.docx

Todd McLeod,70
video: 163-ole

Hands-on exercises #9

#69 - custom views


Create the following four custom views:
● AAA
○ default; as the spreadsheet is when you open it
● BBB
○ normal view
○ fix spelling errors (REVIEW / SPELLING)
○ columns C,D,E,F hidden
● CCC
○ all of the above and
○ don’t show gridlines, headings, formula bar
○ when printing: show gridlines, headings, top row, and left column
● DDD
○ all of the above and
○ header
■ left side - your name
■ right side - date
○ footer
■ left side - file name
■ right side - page X of Y
○ background image
■ PAGE LAYOUT / PAGE SETUP / BACKGROUND
file: 164-custom-views
video: 164-custom-views

#70 - conditional formatting


Use conditional formatting to highlight students in the gradebook such that
● any student who has less than 70.00% in the class
○ pink fill
● top 20% of students
○ light green fill
● when you're done, look at the two rules
● tip
○ you will apply two rules
file: 165-conditional-formatting
video: 165-conditional-formatting

Todd McLeod,71
#71 - selection pane and stacking order
Using the selection pane, have the items on the worksheet stacked in this order, FROM TOP
TO BOTTOM:
● heart
● sun
● star
● lightning bolt
file: 166-selection-pane-stack-order
video: 166-selection-pane-stack-order

#72 - protect a workbook and worksheets


Add the following protections to the file:
● FILE LEVEL (file / info)
○ password needed to open
■ password: 123
○ read only - you can make changes, you just can't save
● WORKBOOK LEVEL
○ Protect workbook structure
○ prevent viewing hidden worksheets, adding, moving, deleting, or hiding
worksheets, and renaming worksheets
■ password: abc
● WORKSHEET LEVEL
○ Only allow users to edit B3:M3
■ STEP 1: LOCK CELLS
■ STEP 2: protect sheet with password
■ password: qwerty
file: 167-protect-workbook-worksheets
file: 167-protect-workbook-worksheets-mine
video: 167-protect-workbook-worksheets

#73 - Arrange windows


● create a NEW WINDOW in microsoft excel
○ arrange the windows to be side-by-side
○ close the second window
● open a web browser
○ arrange Microsoft Excel and the web browser to be side-by-side
■ shortcut key: windows + left arrow key OR right arrow key
file: 168-arrange-windows
video: 168-arrange-windows

Todd McLeod,72
#74 - print a worksheet to a pdf
● print this worksheet to a pdf
● make it look pretty!
file: 169-print-pretty-to-pdf
video: 169-print-pretty-to-pdf

*** *** *** ADVANCED EXCEL *** *** ***

Pivot tables

Pivoting your data


Pivot tables are super-powerful. A pivot table allows you to pivot your view on your data. We
use pivot tables to turn data into information. When you have a table of data, it can often be
challenging to know what information we can extract from that data. In this video, we continue
our exploration of taking our data and turning it into information using pivot tables.
● recommended pivot tables (we saw this earlier in the course)
Pivot tables empower us to take data and quickly get information. One of the greatest
challenges with pivot tables is knowing what questions to ask. When you have a table of data,
what kind of information can you extract from that data? Again, embracing the spirit of
exploration and experimentation is the key to discovering information. Here are several
examples of interesting views of our data. If you are anything like me, when I first learned pivot
tables I was like, “Wait a minute! Can you do that again? And again? And again?”
● pivot table analyze ribbon
○ show field list
● drag fields between areas

Todd McLeod,73
file: 170-pivot-tables
video: 170-pivot-tables

Grouping in pivot tables


Learn how to group your data in pivot tables: right click a row or column label in your pivot table,
then choose “group.”
● analyze pivot table / expand field or collapse field
○ data / show detail or hide detail
● Ungroup / Group (show with DATE in rows)
● adding grouping (show with regions in columns, remove field headers)

file: 171-grouping-pivot-tables
video: 171-grouping-pivot-tables

Refreshing pivot tables


When the underlying data of a pivot table changes, the pivot table does not automatically
change. To update a pivot table, you must manually refresh it. This video explains all of this
and shows you what to do: right-click your pivot table and choose “refresh data.”
● pivot table analyze / refresh all (or right click)

Todd McLeod,74
● pivot table analyze / options / data / refresh when opening
file: 172-refreshing-pivot-tables
video: 172-refreshing-pivot-tables

Slicers and timeline - filtering pivot tables


A slicer is a visual interface for filtering data in a table. We can use slicers to visually filter our
data. Slicers can also be applied to regular tables.

● pivot table analyze / insert slicer (salesperson, manufacturer, region, customer)


● pivot table analyze / insert timeline (salesperson, manufacturer, region, customer)
● Table data and slicers
○ insert / slicer (data needs to be a table to work)
○ create table and convert to range
file: 173-slicers
video: 173-slicers

Pivot charts
We can build charts based upon pivot tables. When we do this, the chart is connected to the
pivot table. The chart is known as a pivot chart. When the pivot table is refreshed, the chart will
be refreshed.

file: 174-pivot-charts
video: 174-pivot-charts

Todd McLeod,75
Hands-on exercises #10

#75 - create pivot tables


Create pivot tables with the following configurations:

file: 175-pivot-tables-practice
video: 175-pivot-tables-practice

#76 - manually group fields


Create this pivot table:

● hide the field headers (pivottable analyze / field headers)


● collapse the "customer | state" data (pivottable analyze / collapse field)
● manually group selection "east" and "west"
○ rename this to "EastWest"
○ hint: use "ctrl + click" to select non-contiguous regions
● manually group selection "north" and "south"
○ rename this to "NorthSouth"
● collapse "EastWest" and "NorthSouth"
file: 176-manually-group
video: 176-manually-group

#77 - slicers and timeline


Create this pivot table:

Todd McLeod,76
● create slicers for "Manufacturer" and "Customer"
○ set the manufacturer slicer to filter for "Martmot"
○ set the customer slicer to filter for "Cabela's" and "REI"
● create a timeline filter
○ set the timeline filter to show data from 2030 - 2050
file: 177-slivers-timeline-filters
video: 177-slivers-timeline-filters

#78 - pivot chart, slicer, and timeline


Create this pivot table:

● create a pivot chart choosing the chart type "clustered column"


○ years should be on the x-axis like this

○ if needed, right click the chart, choose "select data" and then choose to "switch
row/column"
● create a slicer for "Customer"
○ set the customer slicer to filter for "Backcountry Edge, Backcountry Gear,
Cabela's, CampBound"
● create a timeline filter
○ set the timeline filter to show data from 2027-2032
file: 178-pivot-chart-slicer-timeline
video: 178-pivot-chart-slicer-timeline

Todd McLeod,77
Odds and ends

Styles and themes


● styles
○ to apply several formats in one step, and to make sure that cells have consistent
formatting, you can use a cell style.
○ A cell style is a defined set of formatting characteristics, such as fonts and font
sizes, number formats, cell borders, and cell shading.
○ To prevent anyone from making changes to specific cells, you can also use a cell
style that locks cells.
○ Important: Cell styles are based on the document theme that is applied to
the whole workbook. When you switch to another document theme, the cell
styles are updated to match the new document theme.
● theme
○ To change the text fonts, colors, or general look of objects in all worksheets of
your workbook quickly, try switching to another theme or customizing a theme
to meet your needs. If you like a specific theme, you can make it the default for
all new workbooks.
file: 179-styles-themes
video: 179-styles-themes

Word art, align, rotate, group, and signatures


The title says it all! In this video, we will cover
● word art
● align
● rotate
● group
● signatures
file: 180-word-art-signatures
video: 180-word-art-signatures

Working with names


The defined names area on the formulas ribbon lets us work with names.
file: 181-working-with-names
video: 181-working-with-names

Todd McLeod,78
Different error types

● #####
● #VALUE!
● #SPILL!
● #NAME?
● #DIV/0!
● #REF!
● #N/A!
● #NULL!
● #NUM!
file: 182-errors
video: 182-errors

Working with errors


● error options
○ OPTIONS > FORMULAS
● noticing the error notation - color in the top right corner

file: 183-working-with-errors
video: 183-working-with-errors

Watch and calculation options


● watch
○ similar functionality:
■ view > new window
■ view > freeze panes
■ view > split
● calculation options
○ F9
file: 184-watch-calc
video: 184-watch-calc

Todd McLeod,79
Stats, accessibility, smart lookup, hide ink
● workbook stats
● check accessibility
● smart lookup
● hide ink
○ The Offspring
○ He may not have a clue and he may not have style But everything he lacks well
he makes up in denial
○ Now he's getting a tattoo yeah, he's getting ink done He asked for a 13, but they
drew a 31
file: 185-review-leftovers
video: 185-review-leftovers

Help ribbon odds and ends


file: 186-help-ribbon-leftovers
video: 186-help-ribbon-leftovers

Get and transform data with power query

Introduction
● something cool
○ moving the task bar
● excel shortcut "save as"
○ F12
● what's next?
○ our diagram of excel ribbons
■ get and transform
■ queries and connections
■ manage data model
● get and transform, aka → , power query
○ GET data
○ TRANSFORM data
○ microsoft power query webpage
○ access data stored in hundreds of sources and reshape it
■ from different file types
■ from different folders
● add data to folder
■ from web
■ as a connection
● new xlsx files
○ 187-LIVE-tom-cruise-filmography

Todd McLeod,80
○ 187-START-tom-cruise-filmography
● example
○ get Tom Cruise's filmography from IMDB into excel
■ use copy / paste
■ just the movie names
● example 2
○ get Tom Cruise's filmography from Wikipedia into excel
■ use data > get & transform data > from web
■ just the movie names

file: 187-START-tom-cruise-filmography
file: 187-LIVE-tom-cruise-filmography
video: 187-tom-cruise-filmography

Get & transform steps


● opening power query editor
○ use get & transform → power query editor opens
■ data > get & transform > get data > launch power query editor
○ query - definition

● steps
○ queries and connections
■ data > queries & connections > queries & connections
■ there's nothing there
○ use get & transform
■ if you want, convert range of data to a table
● insert > table
○ ctrl + t
● if you don't convert your range to a table, it will happen
automatically when you do the next step

Todd McLeod,81
● name your table
■ data > get and transform > from table / range
○ power query editor opens
■ [transform data]
● many ways to transform data
■ close and load OR close and load to
○ queries and connections
■ data > queries & connections > queries & connections
■ your query connection is there now
○ re-open power query editor
■ data > get & transform > get data > launch power query editor
■ open your query
● queries column on the left
● double-click
■ [transform data]
■ close and load
file: 188-START-intro-get-transform-power-query
file: 188-LIVE-intro-get-transform-power-query
video: 188-intro-get-transform-power-query

Power query editor example 1


Use get & transform → power query editor opens
● transform
○ fill down
○ fill up
● undoing steps
○ remove steps from the applied steps
■ home > view > layout > query settings
file: 189-START-power-query-example-1
file: 189-LIVE-power-query-example-1
video: 189-power-query-example-1

Power query editor example 2


Use get & transform → power query editor opens
● create a folder
● put these files in the folder
○ 190-START-2039-power-query-example-2
○ 190-START-2040-power-query-example-2
○ 190-START-2041-power-query-example-2
● open excel
○ create a new workbook
○ get data from folder
■ data > get & transform > get data > from file > from folder

Todd McLeod,82
○ combine > combine & transform data
○ choose a sample file
■ preview
■ ok
● split column 'Customer Id'
○ home > split column > split by delimiter
● rename columns
■ Customer ID
■ Customer Name
● add column 'Profit'
○ select 'Revenue' column then the 'Cost' column
■ the order you select the columns is important
● first select the column to subtract from
● second select the column to subtract
○ add column > from number > standard > subtract
○ rename column
● add column 'Duration'
○ select Departure Date' column then the 'Arrival Date' column
■ the order you select the columns is important
● first select the column to subtract from
● second select the column to subtract
■ add column > from data & time > date > subtract days
■ rename column
● remove column 'Review' & 'Source.Name'
○ right click
○ remove any other columns you don't want
● check columns data type
○ home > transform > data type
○ click on the column and see the data type
○ change data type to currency for
■ revenue
■ cost
■ profit
■ (notice $ symbol at top of column)
● name your query
○ view > layout > query settings
● close and open query settings
○ view > query settings
○ review your query settings
■ like a macro
● close and open queries
● close and load
○ file > close > close & load
● create a pivot table

Todd McLeod,83
○ sort data by 'arrival date'

rows values columns

arrival date profit (sum)


1. a little data from next year b/c of our math ….
● create a line pivot chart
● look at your data
○ all three years are there
● add files to your folder
○ 190-START-2042-power-query-example-2
○ 190-START-2043-power-query-example-2
● refresh your table
○ right click
● look at your data
○ all five years are there
● look at queries & connections
○ data > queries & connections > queries & connections
○ hover over the query and see the data source
● NOTES
○ potential error

■ make sure your tabs are all the same name


file: 190-START-ALL-YEARS-power-query-example-2
file: 190-START-2039-power-query-example-2
file: 190-START-2040-power-query-example-2
file: 190-START-2041-power-query-example-2
file: 190-START-2042-power-query-example-2
file: 190-START-2043-power-query-example-2
file: 190-LIVE-2039-power-query-example-2
file: 190-LIVE-2040-power-query-example-2
file: 190-LIVE-2041-power-query-example-2
file: 190-LIVE-2042-power-query-example-2
file: 190-LIVE-2043-power-query-example-2
video: 190-power-query-example-2

Todd McLeod,84
Split by delimiter
Get and transform has a “split by delimiter” tool. We can use the “split by delimiter” tool to
have more control over splitting data. To do this, we will
● create a table of data
● data → get and transform → from table
● transform
○ split by delimiter
■ left most
■ right most
file: 191-START-split.xlsx
file: 191-LIVE-split.xlsx
video: 191-split-by-delimiter

Replace
Inside the “get & transform” area, once you are in the query editor, you can choose replace.
Replace allows you to replace certain text.
● fill
○ up, down
● replace
○ management with ruling class
○ .edu with .mil
○ 444 with 777
○ 7 in last column with 9
■ note data type: change to text, replace, change back to whole numbers
file: 192-START-replace.xlsx
file: 192-LIVE-replace.xlsx
video: 192-replace

Extract
Inside the “get & transform” area, once you are in the query editor, you can choose extract.
Extract is much like split. Extract allows you to extract text.
● extract the following
○ credentials between **
○ 456 from row of numbers
● between delimiters
○ text before delimiter
○ text after delimiter
● range
○ start at 0
■ zero based indexed
○ 2 characters
● last characters

Todd McLeod,85
○ 3
● first characters
● length
○ see the length of what's in columns
file: 193-START-extract.xlsx
file: 193-LIVE-extract.xlsx
video: 193-extract

Format
Inside the “get & transform” area, once you are in the query editor, you can choose format.
Format allows you to format text, like making text all uppercase or lowercase.
file: 194-START-format.xlsx
file: 194-LIVE-format.xlsx
video: 194-format

Pivot & unpivot with power query


Reminder examples of pivot
row value columns

total (group by 1,000) count of total


average of total

manufacturer count of total region


● power query allows us to unpivot data
○ spirit of adventure and exploration
file: 195-START-pivot-unpivot.xlsx
file: 195-LIVE-pivot-unpivot.xlsx
video: 195-pivot-unpivot

Data from the web and data types


● three examples
○ US States
○ Countries
○ Stocks
● getting the data and using power query to clean it up
○ US States
■ https://en.wikipedia.org/wiki/U.S._state
○ Countries
■ https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_area
file: 196-START-web-data-type.xlsx
file: 196-LIVE-web-data-type.xlsx
video: 196-web-data-type

Todd McLeod,86
Creating our own data type & refresh
The title of this video says it all.
● microsoft documentation
● get data from the web
○ https://en.wikipedia.org/wiki/List_of_presidents_of_the_United_States
● use "dot" notation to extract field data

file: 197-START-creating-data-type-refresh (it's blank)


file: 197-LIVE-creating-data-type-refresh
video: 197-creating-data-type-refresh

Power query editor - home ribbon


Using our spirit of adventure and exploration, let's explore the options on the power query
editor home ribbon.
● close & load
● refresh preview
○ refreshes your data
○ It's always possible to update the preview cache. You can update it for a single query, or
for all queries by using the Refresh Preview command. source
● properties
● manage
● choose columns
● remove columns
● keep rows
● remove rows
● sort
● split column
file: 198-START-2042-2043-power-query-home
file: 198-LIVE-2042-2043-power-query-home
file: 198-LIVE-from-197-creating-data-type-refresh
video: 198-power-query-home

Power query editor - transform ribbon


Using our spirit of adventure and exploration, let's explore the options on the power query
editor home ribbon.
file: 199-START-2042-2043-power-query-transform
file: 199-LIVE-2042-2043-power-query-transform

Todd McLeod,87
video: 199-power-query-transform

Data generator
file: 200-START-data-generator
file: 200-LIVE-data-generator
file: 200-TA-REVIEWS.zip
video: 200-data-generator

Hands-on exercises #11

#79 - separating data


Using the data in this exercises file, get the following pieces of data into their own columns:
● honorific
● first name
● last name
● post-nominal letters
● email address
● email provider domain
file: 201-LIVE-separating-data
file: 201-START-separating-data
video: 201-START-separating-data

#80 - get and transform surfer first names


Use this webpage or a similar webpage to get the names of surfers:
● https://www.momjunction.com/articles/surfer-baby-names_00406437/
Transform the data so that you just have the surfer names.
file: 202-LIVE-get-transform-first-names
file: 202-START-get-transform-first-names
video: 202-get-transform-first-names

#81 - get and transform surfer last names


Use these webpages, or similar webpages, to get the surnames (last names) of surfers:
● https://www.lapointcamps.com/blog/31-surf-slangs-friendly-list-of-surfer-lingo-and-terms/
● https://www.cnn.com/travel/article/50-surf-spots/index.html
Transform the data so that you just have the surfer names.
file: 203-LIVE-get-transform-surnames
file: 203-START-get-transform-surnames
video: 203-get-transform-surnames

Todd McLeod,88
#82 - pivot & unpivot
Using the workbook associated with this exercise, pivot the data using these guidelines:
row value columns

manufacturer sum of total region


Once you have done this, use the power query editor to unpivot the data. Hints:
● you will need to copy / paste as values the pivot table and then use get and transform.
● for a nice result, select the regions (east, west, north, south) and then click unpivot
● try also using paste / transpose
file: 204-LIVE-pivot-unpivot
file: 204-START-pivot-unpivot
video: 204-pivot-unpivot

#83 - transform data


Using the workbook associated with this exercise, transform the data in the following ways:
● replace “protonmail.com” with “protonmail.org”
● fill down “east” “west” “south” “north”
● fill up “management” “production” “finance” “marketing”
● replace 444 with 777 in column 4
● replace 76477 with 77777 in column 5
● replace all 7’s in column “5” with 9’s
○ remember: switch the type to text, then switch the type back to whole number
file: 205-LIVE-transform
file: 205-START-transform
video: 205-transform

#84 - conditional column


Experiment with a conditional column.
● power query editor > add column > conditional column
See if you can achieve the following using a conditional column. Extract the following:
● honorific
● first name
● last name
● Make the names all uppercase.
Also, use the index column and duplicate column features.
file: 206-LIVE-conditional-column
file: 206-START-conditional-column
video: 206-conditional-column

#85 - explore documentation


● Power Query documentation

Todd McLeod,89
○ https://docs.microsoft.com/en-us/power-query/
● Power Query M formula language
○ https://docs.microsoft.com/en-us/powerquery-m/
file: 207-documentation.xlsx
video: 207-explore-documentation

Data model

Understanding relational data


relational data model
file: 208-relational-data.xlsx
video: 208-relational-data

An overview of the data model


Enable advanced data capabilities
● file > options > data > enable data analysis add-ins ….
There are a few new pieces to learn about:
● get & transform → power query
○ get data into excel
○ transform (clean) data
■ ETL - extract, transform, load
● data model → power pivot
○ create relationships between tables of data
■ like a database
■ create a data model in Excel
file: 209-LIVE-overview
file: 209-START-overview
video: 209-overview

Add tables to the data model


To use data in a spreadsheet in power pivot, that data must:
● one way
○ be a table
■ NAME YOUR TABLE; prefix with “t” for table
○ be added to the data model
■ power pivot ribbon → add to data model
● another way
○ We've also seen the "add to data model" checkbox a few times.
file: 210-LIVE-add-to-data-model
file: 210-START-add-to-data-model
video: 210-add-to-data-model

Todd McLeod,90
Creating relationships
We need to tell power pivot how are data is related. We do this through drag and drop.
file: 211-LIVE-create-relationships
FILE: 211-START-create-relationships
video: 211-create-relationships

Pivot tables and pivot charts


From the power pivot area, choose “pivot table” to create a pivot table. Once you have a pivot
table, you can also create a pivot chart.
file: 212-LIVE-pivot-tables-charts
file: 212-START-pivot-tables-charts
video: file: 212-pivot-tables-charts

Using functions in the data model's power pivot


● use a calculated column
○ The formulas in calculated columns are much like the formulas that you create in
Excel.
● in the formula bar area
○ fx > filter > related
■ =related(ColumnName)
● go click the column name in the related table
○ =round(<other code>, 2)
○ format as currency with “$” button
■ no right-click format
● Microsoft documentation on “DAX Excel” data analysis expression
○ Data Analysis Expressions (DAX) sounds a little intimidating at first, but don’t let
the name fool you. DAX basics are really quite easy to understand. First things
first - DAX is NOT a programming language. DAX is a formula language. You can
use DAX to define custom calculations for Calculated Columns and for Measures
(also known as calculated fields). DAX includes some of the functions used in
Excel formulas, and additional functions designed to work with relational data and
perform dynamic aggregation.
file: 213-LIVE-functions-power-pivot
file: 213-START-functions-power-pivot
video: 213-functions-power-pivot

Writing a measure
Measures in Power Pivot are calculations used in data analysis. Examples commonly found in
business reports include sums, averages, minimum or maximum values, counts, or more
advanced calculations that you create using a Data Analysis Expressions (DAX) formula. You
write measures in the bottom area of power pivot.
● Any Name You Want:=Sum(rColumnName)

Todd McLeod,91
○ format as currency with “$” button
■ hawaiian $ - cool!
■ right-click format is available
● documentation
○ https://support.microsoft.com/en-us/office/measures-in-power-pivot-86484821-a3
24-4da3-803b-82fd2e5033f4
file: 214-LIVE-measure
file: 214-START-measure
video: 214-measure

Hands-on exercises #12

#86 - data model #1


Using the worksheet associated with this exercise,
● turn your sheets of data into tables
○ name your tables
○ prefix with “t”
● add all of the tables to the data model
● create relationships between the tables
○ diagram view
● on the transactions table, add calculated columns
○ sales revenue with discount
■ round to 2 decimal places
■ format as currency
○ manufacturer's phone number
■ verify one of the manufacturer's phone numbers
● add a measure
○ average sales revenue
■ format as currency
● create this pivot table
row value columns

manufacturer sales revenue sum region

● add a slicer
○ make sure to insert the slicer from
■ PivotTable Analyze > filter > insert slicer
○ slicer: salesperson
file: 215-LIVE-data-model-01
file: 215-START-data-model-01
video: 215-data-model-01

Todd McLeod,92
#87 - data model #2
Using the worksheet associated with this exercise,
● turn your sheets of data into tables
○ name your tables
○ prefix with “t”
● add all of the tables to the data model
● create relationships between the tables
○ diagram view
● add a measure to the transactions table
○ total revenue
■ format as currency
● create this pivot table
row value columns

date sum of amount manager


(just year and quarter)
○ slicer: manager
■ slicer > buttons > columns
● set to 8
● create a pivot chart from this pivot table
file: 216-LIVE-data-model-02
file: 216-START-data-model-02
video: 216-data-model-02

Working with 1,048,576+ records

Excel's limitations
● we can't add more than 1,048,576 records to a spreadsheet
file: 217-DATA-customers-01.csv
file: 217-DATA-customers-02.csv
video: 217-excel-limitations

Connecting to data and appending data


● exploring the data
● creating a connection to the data
● we could then transform data in power query editor if we wanted to do this
● we can now append queries into one query
○ customers
○ rentals
● close and load to
○ create a connection

Todd McLeod,93
○ load to data model
file: 218-LIVE
file: 218-START
file: 218-PREP-data-generator.xlsx
video: 218-connecting-to-data

Data model operations


● go into the data model
● create relationships
● create a pivot table
row value columns

date sum of rental amount


(just year and quarter)
○ slicer: film name
■ three columns
file: 219-LIVE
file: 219-START
video: 219-data-model-ops

Data joins - append & join / merge

Append data
● We have already seen append in action. For thoroughness, however, this entire video is
devoted to showing how to append two queries.
● Once you have queries appended to each other, you can add data to one of the original
tables from which a query was created, and everything updates.
● Precision matters - computer science is engineering
● personal note about
○ gratitude and the potential for growth that comes from learning
file: 220-LIVE-append-data
file: 220-START-append-data
video: 220-append-data

Data joins - Left outer join


Merging requires us to match data from two datasets. Using two datasets, we will match data
based upon a common column. When we merge data, we are taking different sets of data and
bringing them together. Merging data is also known as joining data.

Todd McLeod,94
file: 221-LIVE-left-outer-join
file: 221-START-left-outer-join
video: 221-left-outer-join

Data joins - right outer join

file: 222-LIVE-right-outer-join

Todd McLeod,95
file: 222-START-right-outer-join
video: 222-data-right-outer-join

Data joins - full outer join

file: 223-LIVE-full-outer-join
file: 223-START-full-outer-join
video: 223-full-outer-join

Todd McLeod,96
Data joins - inner join

file: 224-LIVE-inner-join
file: 224-START-inner-join
video: 224-inner-join

Data joins - left anti join

Todd McLeod,97
file: 225-LIVE-left-anti-join
file: 225-START-left-anti-join
video: 225-data-left-anti-join

Data joins - right anti join

file: 226-LIVE-right-anti-join
file: 226-START-right-anti-join
video: 226-right-anti-join

Hands-on exercises #13

#88 - append data


Using the workbook associated with this exercise, append the two sets of data together using
the query editor.
● Only create a connection to the queries of each table.
● For the append table,
○ call it ALL DATA
○ place it in a worksheet
file: 227-LIVE-append-data
file: 227-START-append-data
video: 227-append-data

Todd McLeod,98
#89 - append data update
Additional sales transactions for February have been found. Add the new data to your table
using copy/paste so that they are included in the appended data.
file: 228-LIVE-append-data-update
file: 228-START-append-data-update
video: 228-append-data-update

#90 - outer joins and inner join


In the workbook associated with this exercise:
● do a left outer join on the data
● do a right outer join on the data
● do a full outer join on the data
● do an inner join on the data
file: 229-LIVE-joins
file: 229-START-joins
video: 229-joins

#91 - anti-joins
In the workbook associated with this exercise:
● do a left anti join on the data
● do a right anti join on the data
file: 230-LIVE-anti-joins
file: 230-START-anti-joins
video: 230-anti-joins

3-D maps

Introduction
The 3-D map feature allows us to map data by location.
● get data from here
○ https://en.wikipedia.org/wiki/List_of_United_States_cities_by_population
● transform the data
○ keep: city, state, population columns
● 3D map the data
○ location: city or state
○ height: population
file: 231-LIVE-3D-population
file: 231-START-3D-population
video: 231-3D-population

Todd McLeod,99
3D maps and America's energy story
An introduction to something we will create using America's power station data.
file: 232-LIVE-energy-story
file: 232-START-energy-story
video: 232-energy-story

Creating scenes with 3D maps


We will further explore how to work with 3-D maps in this video by seeing how to create scenes
using the power state data.
file: 233-LIVE-creating-scenes
file: 233-START-creating-scenes
video: 233-creating-scenes

Hands-on exercises #14

#92 - 3-D map Europe's population


The 3-D map feature allows us to map data by location.
● get data from here
https://en.wikipedia.org/wiki/List_of_European_cities_by_population_within_city_limits
● transform the data
○ keep: city, country, population columns
● 3D map the data
○ visualization: bubble

Todd McLeod,100
○ make the size the population
file: 234-LIVE-3D-europe-population
file: 234-START-3D-europe-population
video: 234-3D-europe-population

#93 - 3-D map America's energy story


Create a new tour and then create a scene that displays the energy categories over time.
file: 235-LIVE-3D-USA-energy-over-time
file: 235-START-3D-USA-energy-over-time
video: 235-3D-USA-energy-over-time

Creating macros

Understanding macros
● Macros allow you to automate your work
○ If you have a process that you repeat over and over, you can “record” that
process and then assign that process to a shortcut key or an icon.
● macros and security
● on the view ribbon
○ view > macros
● turn on
○ developer ribbon
■ file > options > customize ribbon > developer
● under "customize the ribbon" and under "main tabs" select the
"developer" check box.
● when you record a macro
○ VBA code is automatically written
○ this will be useful to us b/c we can later look at this code to learn code
○ every action must be precise
■ think about what you're going to do before you hit record
● formatting example
○ use relative references
● assigning a macro to a keyboard shortcut
○ always use "CTRL + SHIFT"
● recording a macro
○ stop
● seeing macro
○ developer > code > macros or view > macros > view macros
■ macro dialogue box
● run
● edit
● delete

Todd McLeod,101
● adding to quick access toolbar
○ more commands → macros → modify
○ show below ribbon
● saving a workbook with macros
○ "save as macro enabled workbook"
○ xlsm
file: 236-LIVE-understanding-macros
file: 236-START-understanding-macros
video: 236-understanding-macros

Recording a macro
removing every other line …
● file: 237-LIVE-recording-a-macro
● file: 237-START-recording-a-macro
● video: 237-recording-a-macro

Recording a prank
macro keyboard shortcuts will overwrite other keyboard shortcuts.
● file: 238-LIVE-recording-a-prank
● file: 238-START-recording-a-prank
● video: 238-recording-a-prank

Relative vs absolute reference macros


● excel records macros with absolute cell references by default
■ always go to this cell …
■ always go to that cell …
● you can record your macro with relative references
○ this allows you to make changes relative to where you start
■ go up one cell and over one cell
■ paste something
■ move over two cells to the right.
● illustrating
○ absolute cell reference macro
■ click in cell A1
■ start recording
● enter text
○ Mom
○ Dad
○ Juniper
■ stop recording
■ run macro in different cells
○ relative cell reference maco

Todd McLeod,102
■ turn on USE RELATIVE REFERENCES
■ click in cell A1
■ start recording
● enter text
○ Mom
○ Dad
○ Juniper
■ stop recording
■ run macro in different cells
● comparing the code
○ VBA button or keyboard shortcut ALT + F11
● file: 239-LIVE-rel-abs-macros
● file: 239-START-rel-abs-macros
● video: 239-rel-abs-macros

Hands-on exercises #15

#94 - remove data with a macro


Using the workbook for this exercise, remove unnecessary lines from the data.
file: 240-LIVE-remove-data-with-macro
file: 240-START-remove-data-with-macro
video: 240-remove-data-with-macro

#95 - clean up data


● Go to princess cruises.
● Search for cruises in Europe.
● Get all of the data for European cruises into Excel
● Clean up the data
file: 241-LIVE-clean-up-data-with-macro
file: 241-START-clean-up-data-with-macro
video: 241-clean-up-data-with-macro

Todd McLeod,103
*** *** PROGRAMMING EXCEL WITH VBA *** ***

VBA basics

Introduction
Three perspectives help with programming
● you're learning a foreign language
● you're gaining a power
○ taking the red pill
○ reality will become malleable
● we are all, always, operating on the edge of understanding
● video: 242-VBA-intro

Orientation to VBA
● Visual Basic for Applications (VBA)
○ wikipedia
● Visual Basic Editor (VBE)
○ open
■ developer > code > visual basic
○ in coding, this is known as an integrated development environment (IDE)
● windows side-by-side

● project panel
○ VBE > view > project explorer
○ workbook
■ worksheets
■ modules
● properties panel
○ VBE > view > properties
■ objects
● have properties

Todd McLeod,104
● have methods
○ choose a sheet, then change this property
■ name: JAMES BOND
● coding window
○ VBE > view > code
● immediate window
○ VBE > view > immediate window
● object browser
○ VBE > view > object browser
○ we'll see more about this in a bit
● file: 243-LIVE-VBA-orientation
● file: 243-START-VBA-orientation
● video: 243-VBA-orientation

Playing in the immediate window


● immediate window
○ VBE > view > immediate window
■ examples
● Range("B2").Value = "Hello world"
● Range("B2").Font.Bold = True
● Range("B2").Interior.Color = rgbYellow
● Cells.Font.Name = "Times New Roman"
● Rows("2:4").Interior.Color = rgbPink
● MsgBox "Look Dave, I can see you're really upset about this. I
honestly think you ought to sit down calmly, take a stress pill, and
think things over."
■ more examples
ActiveCell and Selection are similar
● Columns("A:E").Select
● Selection.Interior.Color =rgbPink
● Selection.Font.Name = "Roboto"
● Selection.Font.Bold = True
● Selection.Columns.Autofit
● Selection.End(xldown).Select
● Selection.End(xlUp).Select
○ excel > object model > range object > properties
■ more examples
● Worksheets.Add
● Worksheets(1).Select
where the number is the order
● Worksheets(1).Name = "Puerto Escondido"
● Worksheets("Puerto Escondido").Copy Before:=Worksheets(1)
the above method has an argument
● Worksheets("Puerto Escondido").Delete

Todd McLeod,105
■ you can also ask questions
● questions always start with
○ ?
● examples
○ ?Worksheets.Count
○ ?Range("C3").Value
○ ?ActiveCell.Address
○ ?ActiveSheet.Name
○ ?WorkSheets(3).Name
■ you need at least 3 worksheets for the above line to work

○ ?ActiveSheet.Paste
● file: 244-LIVE-immediate-window
● file: 244-START-immediate-window
● video: 244-immediate-window

Recording a macro
● adjust coding window font size
○ VBE > tools > options > editor format
● first way
○ relative references
○ record macro
■ save to "this workbook"
○ make active cell bold
○ look at code
■ see the module in the "this workbook"
● second way
○ relative references
○ record macro
■ save to "personal workbook"
○ make active cell italic
○ look at code
■ see the module in the "personal workbook"
● explore module storage
○ VBAProject (<workbook name>)
■ modules
○ VBAProject (PERSONAL.XLSB)
■ modules
● file: 245-LIVE-recording-macro
● file: 245-START-recording-macro
● video: 245-recording-macro

Deleting a macro from the personal workbook


● try deleting from excel macro dialogue box

Todd McLeod,106
● go into VBE
○ see the module in the personal workbook
○ delete it
● file: 246-LIVE-delete-macro-personal-workbook
● file: 246-START-delete-macro-personal-workbook
● video: 246-delete-macro-personal-workbook

The benefits of editing code


● Editing code can help us get results.
○ create a macro to graph the data
○ does it work? does code need to be adjusted?
● file: 247-LIVE-editing-code
● file: 247-LIVE-editing-code.xlsm
● file: 247-START-editing-code
● video: 247-editing-code

Debugging code
● Show on the debug ribbon
○ right click ribbon > debug
● tools
○ step into
○ breakpoint
○ play
● compile error
○ when you type something incorrectly
● file: 248-LIVE-debugging-code
● file: 248-START-debugging-code
● video: 248-debugging-code

Hands-on exercises #16

#96 - record two macros


● Record two macros.
○ save one to "this workbook"
○ save the other to "personal workbook"
● run both macros
● look at the code for both macros
● delete both macros
● sample macro suggestion
○ relative references | entering text
■ hawaii

Todd McLeod,107
■ california
■ japan
file: 249-LIVE-record-two-macros
file: 249-START-record-two-macros
video: 249-record-two-macros

#97 - record a formatting macro


● record a macro that formats
○ phone number
○ birthday
■ mmmm dd
○ SS#
■ last four digits
● ="***-**-"&4444
■ use RIGHT func first to truncate
● apply this macro to all data
● look at the code for this macro
file: 250-LIVE-formatting-macro
file: 250-LIVE-formatting-macro.xlsm
file: 250-START-formatting-macro
video: 250-formatting-macro

Getting started with coding

Coding concepts
● event driven programming
● object oriented programming (OOP)
○ objects
■ cell
■ column
■ row
■ range
■ sheet
■ table
■ chart
■ workbook
○ properties
■ .Interior.Color = rgbPink
■ .Font.Name = "Roboto"
■ .Font.Bold = True
○ methods | functions | things it does
■ select

Todd McLeod,108
■ copy
■ paste
● select, then do
○ select a cell, then do something
○ select a graphic, then do something
○ you do that in Excel
○ you also have to do that in code

ActiveCell.Font.Bold = True
ActiveCell.Font.Italic = True
ActiveCell.Value = "wassup"

● dot notation
● file: 251-LIVE-coding-concepts
● file: 251-START-coding-concepts
● video: 251-coding-concepts

Selecting objects
● single cell
○ Range("C2").Select
○ Range("C2").Range("C2").Select
○ Cells(3,2).Select
○ [C2].Select
○ Range("A2").Offset(0,2).Select
● a range of cells
○ Range("C2:F4").Select
● a worksheet
○ Sheets(1).Select
○ Sheets("<sheet name>").Select
● file: 252-LIVE-selecting-objects
● file: 252-START-selecting-objects
● video: 252-selecting-objects

Adjusting object properties


● selecting an object
○ once you have selected something, you can use key words like these to access
that object's properties and methods
■ selection
■ activecell
■ activesheets
○ intellisense doesn't work with the selection key word
● example, similar to what was shown before, of select

Todd McLeod,109
○ single cell
■ Range("C2").Select
■ ActiveCell.Value = "Hello World"
■ ActiveCell.Interior.Color = rgbPink
■ ActiveCell.Interior.Color = rgb(255, 0, 0)
■ ActiveCell.Interior.Color = rgb(0, 255, 0)
■ ActiveCell.Interior.Color = rgb(0, 0, 255)
■ ActiveCell.Interior.Color = rgb(255, 199, 233)
■ ActiveCell.Font.Name = "Roboto"
■ ActiveCell.Font.Bold = True
■ ActiveCell.Clear
○ range of cells
○ Range("C2:D4").Select
○ Selection.Value = "Hello World"
○ Selection.Interior.Color = rgbPink
○ Selection.Interior.Color = rgb(255, 0, 0)
○ Selection.Interior.Color = rgb(0, 255, 0)
○ Selection.Interior.Color = rgb(0, 0, 255)
○ Selection.Interior.Color = rgb(255, 199, 233)
○ Selection.Font.Name = "Roboto"
○ Selection.Font.Bold = True
○ Selection.Clear
nice example - you need some data to do this:
○ Selection.Columns.Autofit
○ worksheet
■ Sheets(1).Select
■ ActiveSheet.Name = "Marvelous"
■ Sheets("Marvelous").Select
■ ActiveSheet.Name = "Amazing"
■ Worksheets("Amazing").Name = "Fantastic"

Public Sub forLoopEx() Public Sub exCode()


' active cell must not be A1 and must have content ' active cell must not be A1 and must have content
ActiveCell.Copy ActiveCell.CurrentRegion.Copy
Range("A1").Select Range("A1").Select
ActiveSheet.Paste ActiveSheet.Paste
End Sub End Sub

● file: 253-LIVE-adjusting-object-properties
● file: 253-START-adjusting-object-properties
● video: 253-adjusting-object-properties

With statement

Todd McLeod,110
Public Sub exWith() Public Sub exWith()
ActiveCell.Font.Name = "Roboto" With ActiveCell.Font
ActiveCell.Font.Bold = True .Name = "Roboto"
ActiveCell.Font.Italic = True .Bold = True
ActiveCell.Font.Size = 14 .Italic = True
End Sub .Size = 14
End With
End Sub

● video: 254-documentation

Documentation #1 - embarking on an adventure


● spirit of adventure and exploration
○ this is not going to be neat and pretty because the documentation is not neat and
pretty
● paris catacombs analogy
○ 200 miles
● file: 255-LIVE-doc-embarking
● file: 255-START-doc-embarking
● video: 255-doc-embarking

Documentation #2 - getting started with vba


● Documentation
○ official documentation will help you find answers.
○ It is good to go to the source first
■ office vba reference
● library reference > concepts
○ > getting started with vba in office
■ Getting started with vba in Office
● > vba programming 101
● > the object model
● > using developer help
● highlights
■ highlight > F1
○ "... One thing that can be confusing with an object model is that there is more
than one way to address any given object…"
○ " … Sometimes the best way to learn programming is to make minor changes to
some working code and see what happens as a result. …"
○ " … Use Copy and Paste as much as possible when working with code to avoid
typing errors. …"
○ programming tips and tricks > start with examples
○ " … Programming can get complex quickly. It's critical, especially as a beginner,
that you break the problem down to the smallest possible logical units, then write
and test each piece in isolation…."

Todd McLeod,111
● file: 256-LIVE-doc-getting-started-vba
● file: 256-START-doc-getting-started-vba
● video: 256-doc-getting-started-vba

Documentation #3 - the object model


● object model
○ object (class)
■ events
■ methods
■ properties
■ objects (classes)
● oop nested classes
● In object-oriented programming (OOP), an inner class or nested
class is a class declared entirely within the body of another class
or interface
● object model

● file: 257-LIVE-doc-object-model
● file: 257-START-doc-object-model
● video: 257-doc-object-model

Documentation #4 - exploring excel's object model


● using documentation, figure out how to change the name of a worksheet
○ maybe in worksheet object, the name property?

ActiveSheet.Name = "Puerto Escondido"

○ ActiveSheet
○ is it an object?

Todd McLeod,112
■ can we find it in the object list?
■ ctrl + f
● no "ActiveSheet" object
○ search box in top left corner, "activesheet"
■ what are the options?
● which one makes the most sense?
● Workbook.ActiveSheet or Application.ActiveSheet
○ explore ActiveSheet
○ does the worksheet object have the name property?
● file: 258-LIVE-doc-excel-exploration
● file: 258-START-doc-excel-exploration
● video: 258-doc-excel-exploration

Hands-on exercises #17

#98 - modify worksheet name


● select a worksheet
● change its name
● change its tab color
● use the documentation to
○ look up what you're doing and
○ understand what you're doing

Worksheets(3).Activate
ActiveSheet.Tab.Color = RGB(255, 105, 80)

file: 259-LIVE-modify-worksheet-name
file: 259-START-modify-worksheet-name
video: 259-modify-worksheet-name

#99 - modify a region


● put the active cell in the region of data, then select that currentregion
○ ActiveCell.CurrentRegion.Select
● change some properties - here are some ideas
○ Interior.Color = rgbYellow
○ Font.Name = "Roboto"
○ Font.Bold = True
○ Borders.LineStyle = xlContinuous
● one idea:
○ use ActiveCell and intellisense to write your code
○ then replace ActiveCell with Selection

Todd McLeod,113
● hint:
○ google "vba excel borders all around"
file: 260-LIVE-modify-region
file: 260-START-modify-region
video: 260-modify-region

#100 - documentation
● find the MOD operator for VBA in documentation
● hint: look under
○ language reference > reference > operators
● here's the link
video: 261-doc-mod

Coding fundamentals

Variables
● understanding variables
○ variables remember things
○ when need to remember things, and so do computers
● declaration
○ Dim x As Integer
● DIM
○ defined in memory
● type
○ computers need to know what data type is being stored
● assignment
○ x=2
○ in this case, the = sign is an assignment operator
○ it is not the beginning of a formula or function like in a spreadsheet
● application
○ Range("C2").Value = x
video: 262-variables

Working with variables


● comments
○ have an apostrophe before them and are green
○ 'comment
● VBE > tools > options >
○ auto syntax check
■ annoying after awhile
○ require variable declaration

Todd McLeod,114
■ otherwise, variables may be assigned to the variant type
● memory expensive
■ option explicit
● you will now see this at the top of your code
● you have to be explicit - you must say what type
○ as opposed to having the computer implicitly assign a type
○ auto list members
■ intellisense
● code completion prompt
○ ctrl + space
● VBE > view > toolbars
○ edit
● variable names
○ no spaces
○ must start with a letter
○ not conflict with keywords
■ don't name after existing objects, properties, or methods
○ camelCase
' meaning of life
Public Sub mol()
Dim x As Integer
x = 42
Range("C2").Value = x
End Sub

' YOU NEED TO PUT A DATE IN CELL A1


' format it as a date also
Public Sub dateExample()
Dim x As Date
x = Range("A1").Value
Range("C2").Value = x
End Sub

' my responsibilities as a dad


Public Sub dad()
Dim x As String
x = "Love, Provide, Protect"
Range("C2").Value = x
End Sub

' you must have a number in call A1


Public Sub mathExample2()
Dim x As Integer

Todd McLeod,115
x = Range("A1").Value
x=x+1
Range("C2").Value = x
End Sub

● file: 263-LIVE-working-with-variables
● file: 263-START-working-with-variables
● video: 263-working-with-variables

Calling code
● create these modules | subs, then run them

' you must have a number in call A1


Public Sub mathExample()
Dim x As Integer
x = Range("A1").Value
x=x+1
Range("C2").Value = x
End Sub

Sub foStuff()
ActiveCell.Font.Bold = True
ActiveCell.Font.Italic = True
ActiveCell.Interior.Color = rgbPink
End Sub

Public Sub callEm()


Call mathExample
Call foStuff
End Sub
● file: 264-LIVE-calling-code
● file: 264-START-calling-code
● video: 264-calling-code

For loops
loop over a block of code
Public Sub forLoopEx1()
Dim x As Integer
For x = 1 To 42
Cells(x, 1).Value = x
Next x
End Sub

at an angle

Todd McLeod,116
Public Sub forLoopEx2()
Dim x As Integer
For x = 1 To 42
Cells(x, x).Value = x
Next x
End Sub

loop within a loop (nesting loops)


Public Sub forLoopEx3()
Dim x As Integer
Dim y As Integer
For x = 1 To 42
For y = 1 to 10
Cells(x, y).Value = x
Next y
Next x
End Sub

loop within a loop within a loop (nesting loops)

Public Sub forLoopEx4() Public Sub forLoopEx5()


Application.ScreenUpdating = False Application.ScreenUpdating = False
Dim x As Integer Dim x As Integer
Dim y As Integer Dim y As Integer
Dim z As Integer Dim z As Integer
For z = 1 To 3 For z = 1 To 3
Sheets(z).Select Sheets("Sheet"&z).Select
Range("A1").Select Range("A1").Select
For x = 1 To 42 For x = 1 To 42
For y = 1 To 10 For y = 1 To 10
Cells(x, y).Value = x Cells(x, y).Value = x
Next y Next y
Next x Next x
Next z Next z
End Sub End Sub

● there are other loops


○ for each
○ do while
● file: 265-LIVE-for-loop
● file: 265-START-for-loop
● video: 265-for-loop

Conditional statements - if, select


if a condition is met, do something

Todd McLeod,117
Public Sub forLoopEx1()
Dim x As Integer
For x = 1 To 42
Cells(x, 1).Value = x

' format even rows


If x Mod 2 = 0 Then
Cells(x, 1).Select
ActiveCell.Interior.Color = rgbPink
End If

Next x
End Sub

Public Sub forLoopEx2()


Dim x As Integer
For x = 1 To 42
Cells(x, 1).Value = x

' format even rows


Cells(x, 1).Select
If x Mod 2 = 0 Then
ActiveCell.Interior.Color = rgbPink
Else:
ActiveCell.Interior.Color = RGB(137, 207, 240)
End If

Next x
End Sub

● there are also


○ elseif
○ select case

Public Sub forLoopEx3()


Dim x As Integer
For x = 1 To 42
Cells(x, 1).Value = x

' format specific rows


Cells(x, 1).Select

' run the select statement


Select Case x

Todd McLeod,118
Case 14
ActiveCell.Interior.Color = rgbPink
Case 21
ActiveCell.Interior.Color = rgbBlue
Case 42
ActiveCell.Interior.Color = rgbYellow
Case Else
End Select

Next x
End Sub

● file: 266-LIVE-if-statements
● file: 266-START-if-statements
● video: 266-if-statements

Hands-on exercises #18

#101 - coding math


● create a module | sub procedure
● have the module
○ put a value in cell A1
○ do the following math on that value
■ add 42 then divide by 2
○ in cell A2 put in the text "add 42"
○ in cell A3 put in the text "divide by 2"
○ in cell A4 put in the result
● save your workbook with macros
● keep your workbook open for the next exercise
● here is some code for you to reference:

' you must have a number in call A1 ' you must have a number in call A1
Public Sub mathExample() Public Sub mathExample2()
Dim x As Integer Dim x As Integer
x = Range("A1").Value x = Range("A1").Value
Dim result As Integer x=x+1
result = x + 1 Range("C2").Value = x
Range("C2").Value = result End Sub
End Sub

file: 267-LIVE-coding-math.xlsx
file: 267-LIVE-coding-math.xlsm
file: 267-START-coding-math.xlsx

Todd McLeod,119
video: 267-coding-math

#102 - using a for loop


● save your workbook from the previous exercise as the file for this exercise
● create a new sub procedure
○ have the module put numbers in the range A10:D15
○ use a for loop to do this
● save your workbook with macros
● keep your workbook open for the next exercise
● here is some code for you to reference:

Public Sub forLoopEx()


Dim x As Integer
Dim y As Integer
For x = 1 To 42
For y = 1 to 10
Cells(x, y).Value = x
Next y
Next x
End Sub

file: 268-LIVE-using-a-for-loop.xlsm
file: 268-START-using-a-for-loop.xlsm
video: 268-using-a-for-loop

#103 - using conditional logic


● save your workbook from the previous exercise as the file for this exercise
● create a new sub procedure
○ in the range A10:D15, make the cells that are in even rows pink
○ use the MOD operator
● save your workbook with macros
● keep your workbook open for the next exercise
● here is some code for you to reference:

Public Sub forLoopEx()


Dim x As Integer
For x = 1 To 42
Cells(x, 1).Value = x

' format even rows


If x Mod 2 = 0 Then
Cells(x, 1).Select
ActiveCell.Interior.Color = rgbPink

Todd McLeod,120
End If

Next x
End Sub

file: 269-LIVE-conditional-logic.xlsm
file: 269-START-conditional-logic.xlsm
video: 269-conditional-logic

#104 - calling code


● save your workbook from the previous exercise as the file for this exercise
● create a blank worksheet
● create a new sub procedure
○ have this module call all of the other modules we created
● save your workbook with macros
● here is some code for you to reference:

Public Sub callEm()


Call mathExample
Call foStuff
End Sub

file: 270-LIVE-calling-code.xlsm
file: 270-START-calling-code.xlsm
video: 270-calling-code

Useful tools

Message box

Public Sub exMsgBox()


MsgBox "Look Dave, I can see you're really upset about this. I honestly think you
ought to sit down calmly, take a stress pill, and think things over."
End Sub

file: 271-LIVE-msgbox
file: 271-START-msgbox
video: 271-msgbox

Todd McLeod,121
Input box
Public Sub exInputBox()
InputBox "What's important?", "The Big Question"
End Sub

Public Sub exInputBox2()


Dim s As String
s = InputBox("What's important?", "The Big Question")
ActiveCell.Value = s
ActiveSheet.Name = s
End Sub

● variable naming
○ the greater the scope, the more the name should be self-documenting
■ strResponse
○ the smaller the scope, the smaller the variable name
■ s
● documentation
file: 272-LIVE-input-box
file: 272-START-input-box
video: 272-input-box

Types of message boxes


● types of message boxes
○ vbYesNo
○ vbMsgBoxHelpButton
○ vbOKCancel
○ vbOKOnly
○ vbInformation
○ vbYesNoCancel
○ vbRetryCancel
● documentation
○ office vba reference > language reference > reference > functions > msgBox function

Public Sub exMsgBox()


MsgBox "Look Dave, I can see you're really upset about this. I honestly think you
ought to sit down calmly, take a stress pill, and think things over.", vbYesNoCancel,
"Hal 2000"
End Sub

Public Sub exMsgBox()


Dim x As Integer

Todd McLeod,122
(
x = MsgBox "Look Dave, I can see you're really upset about this. I honestly think you ought to
sit down calmly, take a stress pill, and think things over.", vbYesNoCancel, "Hal 2000" )
ActiveCell.Value = x
End Sub

Public Sub exMsgBox()


Dim x As Integer
x = MsgBox("Look Dave, I can see you're really upset about this. I honestly think you ought to sit down
calmly, take a stress pill, and think things over.", vbYesNoCancel, "HAL 2000")
ActiveCell.Value = x

' if 6 yes
If x = 6 Then
MsgBox "Thank you, Dave", vbInformation, "HAL 2000"
Else
MsgBox "I know I've made some very poor decisions recently, but I can give you my complete assurance
that my work will be back to normal. I've still got the greatest enthusiasm and confidence in the mission.
And I want to help you. Dave, stop. Stop, will you? Stop, Dave. Will you stop Dave? Stop, Dave.",
vbInformation, "HAL 2000"
End If
End Sub
file: 273-LIVE-msg-box-types
file: 273-START-msg-box-types
video: 273-msg-box-types

Hands-on exercises #19

#105 - message box


● create a message box with a quote from a computer movie
● here is some code for you to reference:

Public Sub exMsgBox()


MsgBox "Look Dave, I can see you're really upset about this. I honestly think you
ought to sit down calmly, take a stress pill, and think things over."
End Sub

file: 274-LIVE-msg-box
file: 274-START-msg-box
video: 274-msg-box

#106 - input box


● create an input box that allows a user to enter their favorite drink

Todd McLeod,123
○ put "DRINKS" in A1
○ add the drink to the end of a list of drinks for the bartender to make
● here is some code for you to reference:

Public Sub exInputBox()


InputBox "What's important?", "The Big Question"
End Sub

Public Sub exInputBox()


Dim s As String
s = InputBox("What's important?", "The Big Question")
ActiveCell.Value = s
ActiveSheet.Name = s
End Sub

ActiveCell.End(xldown).Select
ActiveCell.End(xldown).Select
ActiveCell.End(xlUp).Select
ActiveCell.Offset(1,0).Select

solution
Public Sub exBarDrinks()
' set A1 to DRINKS
Range("A1").Select
ActiveCell.Value = "DRINKS"

' get drink


Dim s As String
s = InputBox("What's your drink?", "The Big Question")

' find next empty cell


ActiveCell.End(xlDown).Select
ActiveCell.End(xlDown).Select
ActiveCell.End(xlUp).Select
ActiveCell.Offset(1, 0).Select

' add drink to list


ActiveCell.Value = s
End Sub

file: 275-LIVE-input-box
file: 275-START-input-box
video: 275- input-box

Todd McLeod,124
#107 - yes no cancel box
● create an input box that
○ asks users a question
○ allows them to choose either yes or no or cancel
■ remember "yes" returns the value 6
○ store their response in a variable
○ use conditional logic to show one of two different MsgBox responses
● here is some code for you to reference:

Public Sub exMsgBox()


Dim x As Integer
x = MsgBox("Look Dave, I can see you're really upset about this. I honestly think you ought to sit down
calmly, take a stress pill, and think things over.", vbYesNoCancel, "HAL 2000")
ActiveCell.Value = x

' if 6 yes
If x = 6 Then
MsgBox "Thank you, Dave", vbInformation, "HAL 2000"
Else
MsgBox "I know I've made some very poor decisions recently, but I can give you my complete assurance
that my work will be back to normal. I've still got the greatest enthusiasm and confidence in the mission.
And I want to help you. Dave, stop. Stop, will you? Stop, Dave. Will you stop Dave? Stop, Dave.",
vbInformation, "HAL 2000"
End If
End Sub

file: 276-LIVE-yes-no-box
file: 276-START-yes-no-box
video: 276-yes-no-box

User defined functions

Easy steps
● give your function a descriptive name

Public Function DisneyTripBillSplitter()

End Function

● write out the math in a comment

Public Function DisneyTripBillSplitter()

Todd McLeod,125
' SCENARIO: three families go to Disneyland
' they agree to split collective bills per person
' for each family
' we need (cost per person) * (people in family)
' (total cost / total people) * (people in family)

End Function

● add parameters to function


● when you run the function you will provide arguments

Public Function DisneyTripBillSplitter(totalCost As Double, totalPeople As Integer,


peopleInFamily As Integer)

' SCENARIO: three families go to Disneyland


' they agree to split collective bills per person
' for each family
' we need (cost per person) * (people in family)
' (total cost / total people) * (people in family)

End Function

● write the formula


● you must assign the result to a variable with the same name as the function

Public Function DisneyTripBillSplitter(totalCost As Double, totalPeople As Integer,


peopleInFamily As Integer)

' SCENARIO: three families go to Disneyland


' they agree to split collective bills per person
' for each family
' we need (cost per person) * (people in family)
' (total cost / total people) * (people in family)

DisneyTripBillSplitter = (totalCost / totalPeople) * peopleInFamily

End Function

● use the user defined function (UDF)

Todd McLeod,126
file: 277-LIVE-udf-easy-steps
file: 277-START-udf-easy-steps
video: 277-udf-easy-steps

Hands-on exercises #20

#108 - user defined function


● create a UDF to calculate percent change over time

percentChange = (new - old) / old

● use this UDF in the spreadsheet to find the percent change over time

file: 278-LIVE-udf
file: 278-START-udf
video: 278-udf

Congratulations

Great work!
You have done great work - the greatest work. You have taken steps to create a better life for
yourself, and for others. As an individual improves their own life, they improve the world. The
skills you are acquiring are some of the most valuable skills demanded today: knowing how to
use Excel. Great job.
● education has the power to transform lives
○ transform your own life

Todd McLeod,127
○ transform the lives of others
video: 279-great-work

Bonus lecture
● https://www.udemy.com/user/toddmcleod
● www.heartmindway.com
video: 280-bonus-lecture

Todd McLeod,128

You might also like