Professional Documents
Culture Documents
Table of Contents
1.0 Using logical functions .................................................................................................................... 1
1.1 The IF function (recap) ................................................................................................................ 1
1.2 Creating nested IF functions ....................................................................................................... 3
1.3 The IFS function .......................................................................................................................... 4
1.4 AND and OR functions................................................................................................................. 6
1.5 Combining logical functions ........................................................................................................ 8
2.0 Working with Lookups .................................................................................................................... 9
2.1 The VLOOKUP function ............................................................................................................... 9
2.2 The HLOOKUP function ............................................................................................................. 14
2.3 INDEX & MATCH........................................................................................................................ 15
3.0 Data Validation ............................................................................................................................. 19
3.1 Using data validation ................................................................................................................ 19
3.2 Setting criteria for entry of text, values and dates .................................................................... 22
3.3 Creating a dropdown list ........................................................................................................... 25
4.0 PivotTables and PivotCharts ......................................................................................................... 28
4.1 Creating and rearranging PivotTables ....................................................................................... 28
4.2 Using the PivotTable toolbar ..................................................................................................... 33
4.3 Creating PivotCharts ................................................................................................................. 34
4.4 Using Slicers to manipulate PivotTables .................................................................................... 36
5.0 Using analytical options ................................................................................................................ 41
5.1 Using Goal Seek......................................................................................................................... 41
5.2 Creating, saving and viewing scenarios ..................................................................................... 45
5.3 Creating single input data tables ............................................................................................... 49
5.4 Creating double input data tables ............................................................................................. 52
6.0 Macros .......................................................................................................................................... 54
6.1 Creating macros ........................................................................................................................ 54
6.2 Using the macro recorder ......................................................................................................... 56
i
Fast Track Series - Microsoft Office Excel Advanced
The IF function checks whether a condition is met, and returns one value if true and another value if
false.
Explanation: if the price is greater than 500, the IF function returns High, else it returns Low.
Formula: =IF(A2>500,"High","Low")
Note: you can use the following comparison operators: = (equal to), > (greater than), < (less than), >=
(greater than or equal to), <= (less than or equal to) and <> (not equal to).
Formula: =IF(A2<500,"Low","High")
1
Fast Track Series - Microsoft Office Excel Advanced
Formula: =IF(A2="USA",5,0)
3a. The formula below calculates the progress between two points in time.
3b. You can use the IF function to display an empty string if the end value hasn't been entered yet (see
row 5).
Explanation: if the end value is not empty (<> means not equal to), the IF function calculates the
progress between the start and end value, else it displays an empty string (two double quotes with
nothing in between).
Formula: =IF(B2<>"",B2-A2,"")
2
Fast Track Series - Microsoft Office Excel Advanced
The IF function in Excel can be nested, when you have multiple conditions to meet. The FALSE value is
being replaced by another IF function to make a further test.
Explanation: if the score equals 1, the nested IF formula returns Bad, if the score equals 2, the nested
IF formula returns Good, if the score equals 3, the nested IF formula returns Excellent, else it returns
Not Valid.
Explanation: if the score is less than 60, the nested IF formula returns F, if the score is greater than or
equal to 60 and less than 70, the formula returns D, if the score is greater than or equal to 70 and less
than 80, the formula returns C, if the score is greater than or equal to 80 and less than 90, the formula
returns B, else it returns A.
Formula: =IF(B2<60,"F",IF(B2<70,"D",IF(B2<80,"C",IF(B2<90,"B","A"))))
3
Fast Track Series - Microsoft Office Excel Advanced
Use the IFS function in Excel 2016 or later when you have multiple conditions to meet. The IFS function
returns a value corresponding to the first TRUE condition.
Note: if you don't have Excel 2016 or later, you can nest the IF function.
1a. If the value in cell A1 equals 1, the IFS function returns Bad.
1b. If the value in cell A1 equals 2, the IFS function returns Good.
1c. If the value in cell A1 equals 3, the IFS function returns Excellent.
1d. If the value in cell A1 equals another value, the IFS function returns No Valid Score.
Note: instead of TRUE, you can also use 1=1 or something else that is always TRUE.
4
Fast Track Series - Microsoft Office Excel Advanced
2a. If the value in cell A1 is less than 60, the IFS function returns F.
2b. If the value in cell A1 is greater than or equal to 60 and less than 70, the IFS function returns D.
2c. If the value in cell A1 is greater than or equal to 70 and less than 80, the IFS function returns C.
2d. If the value in cell A1 is greater than or equal to 80 and less than 90, the IFS function returns B.
2e. If the value in cell A1 is greater than or equal to 90, the IFS function returns A.
Note: to slightly change the boundaries, you might want to use "<=" instead of "<" in your own
function.
Formula: =IFS(A1<60,"F",A1<70,"D",A1<80,"C",A1<90,"B",A1>=90,"A")
5
Fast Track Series - Microsoft Office Excel Advanced
Use the IF function in combination with the AND function and the OR function and become an Excel
expert.
Explanation: the AND function returns TRUE if the first score is greater than or equal to 60 and the
second score is greater than or equal to 90, else it returns FALSE. If TRUE, the IF function returns Pass,
if FALSE, the IF function returns Fail.
Formula: =IF(AND(B2>=60,C2>=90),"Pass","Fail")
Explanation: the OR function returns TRUE if at least one score is greater than or equal to 60, else it
returns FALSE. If TRUE, the IF function returns Pass, if FALSE, the IF function returns Fail.
Formula: =IF(OR(B2>=60,C2>=60),"Pass","Fail")
6
Fast Track Series - Microsoft Office Excel Advanced
Explanation: the AND function above has two arguments separated by a comma (Table, Green or
Blue). The AND function returns TRUE if Product equals "Table" and Color equals "Green" or "Blue". If
TRUE, the IF function reduces the price by 50%, if FALSE, the IF function reduces the price by 10%.
Formula: =IF(AND(A2="Table",OR(B2="Green",B2="Blue")),0.5*C2,0.9*C2)
7
Fast Track Series - Microsoft Office Excel Advanced
The IF function is a great function. Let's take a look at a few more cool examples.
1. For example, use IF and AND to test if a value is between two numbers.
Explanation: the AND function returns TRUE if the person is older than 12 and younger than 20, else
it returns FALSE. If TRUE, the IF function returns Yes, if FALSE, the IF function returns No.
Formula: =IF(AND(B2>12,B2<20),"Yes","No")
2. You can combine IF with AVERAGE, SUM and other Excel functions. The sky is the limit!
Explanation: the AND function returns TRUE if the input value is greater than 100 and the average of
the values in the named range Data1 is greater than 100, else it returns FALSE. If TRUE, the IF function
returns the sum of Data2, if FALSE, the IF function returns 0.
Formula: =IF(AND(F3>100,AVERAGE(Data1)>100),SUM(Data2),0)
8
Fast Track Series - Microsoft Office Excel Advanced
The VLOOKUP function is one of the most popular functions in Excel. This page contains many easy to
follow VLOOKUP examples.
The VLOOKUP (Vertical lookup) function looks for a value in the leftmost column of a table, and then
returns a value in the same row from another column you specify.
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the range
$E$4:$G$7 and returns the value in the same row from the third column (third argument is set to 3).
The fourth argument is set to FALSE to return an exact match or a #N/A error if not found.
Formula: =VLOOKUP(A2,$E$4:$G$7,3,FALSE)
9
Fast Track Series - Microsoft Office Excel Advanced
Note: when we drag the VLOOKUP function down, the absolute reference ($E$4:$G$7) stays the same,
while the relative reference (A2) changes to A3, A4, A5, etc.
Exact Match
Most of the time you are looking for an exact match when you use the VLOOKUP function in Excel.
Let's take a look at the arguments of the VLOOKUP function.
1. The VLOOKUP function below looks up the value 53 (first argument) in the leftmost column of the
red table (second argument).
Formula: =VLOOKUP(H2,B3:E9,4,FALSE)
10
Fast Track Series - Microsoft Office Excel Advanced
2. The value 4 (third argument) tells the VLOOKUP function to return the value in the same row from
the fourth column of the red table.
Note: the Boolean FALSE (fourth argument) tells the VLOOKUP function to return an exact match. If
the VLOOKUP function cannot find the value 53 in the first column, it will return a #N/A error.
3. Here's another example. Instead of returning the salary, the VLOOKUP function below returns the
last name (third argument is set to 3) of ID 79.
11
Fast Track Series - Microsoft Office Excel Advanced
Approximate Match
Let's take a look at an example of the VLOOKUP function in approximate match mode (fourth
argument set to TRUE).
1. The VLOOKUP function below looks up the value 85 (first argument) in the leftmost column of the
red table (second argument). There's just one problem. There's no value 85 in the first column.
2. Fortunately, the Boolean TRUE (fourth argument) tells the VLOOKUP function to return
an approximate match. If the VLOOKUP function cannot find the value 85 in the first
column, it will return the largest value smaller than 85. In this example, this will be the
value 80.
12
Fast Track Series - Microsoft Office Excel Advanced
3. The value 2 (third argument) tells the VLOOKUP function to return the value in the same row from
the second column of the red table.
Note: always sort the leftmost column of the red table in ascending order if you use the VLOOKUP
function in approximate match mode (fourth argument set to TRUE).
Formula: =VLOOKUP(F3,B3:C7,2,TRUE)
13
Fast Track Series - Microsoft Office Excel Advanced
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.
14
Fast Track Series - Microsoft Office Excel Advanced
Explanation: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Formula: =INDEX(E4:F7,A2,B2)
Formula: =INDEX(E4:E7,A2)
15
Fast Track Series - Microsoft Office Excel Advanced
Explanation: the INDEX function returns the 5th value (second argument) in the range E3:E9 (first
argument).
Formula: =INDEX(E3:E9,5)
The MATCH function returns the position of a value in a given range. For example, the MATCH function
below looks up the value 53 in the range B3:B9.
Formula: =MATCH(A2,E4:E7,0)
16
Fast Track Series - Microsoft Office Excel Advanced
Explanation: 53 (first argument) found at position 5 in the range B3:B9 (second argument). In this
example, we use the MATCH function to return an exact match so we set the third argument to 0.
Formula: =MATCH(H2,B3:B9,0)
17
Fast Track Series - Microsoft Office Excel Advanced
Instead of using VLOOKUP, use INDEX and MATCH. To perform advanced lookups, you'll need INDEX
and MATCH. Maybe this is one step too far for you at this stage, but it shows you one of the many
other powerful formulas Excel has to offer. Replace the value 5 in the INDEX function (see previous
example) with the MATCH function (see first example) to lookup the salary of ID 53.
Explanation: the MATCH function returns position 5. The INDEX function needs position 5. It's a perfect
combination. If you like, you can also use the VLOOKUP function. It's up to you. However, you'll need
INDEX and MATCH to perform advanced lookups, as we will see next.
Formula: =INDEX(B3:E9,MATCH(H2,B3:B9,0),4)
The INDEX function can also return a specific value in a two-dimensional range. For example, use
INDEX and MATCH in Excel to perform a two-way-lookup.
Formula: =INDEX(B2:D13,MATCH(G2,A2:A13,0),MATCH(G3,B1:D1,0))
18
Fast Track Series - Microsoft Office Excel Advanced
This example teaches you how to use data validation to prevent users from exceeding a budget limit.
Note: cell B10 contains a SUM function that calculates the sum of the range B2:B8.
2. On the Data tab, in the Data Tools group, click Data Validation.
19
Fast Track Series - Microsoft Office Excel Advanced
4. In the Formula box, enter the formula shown below and click OK.
Explanation: the sum of the range B2:B8 may not exceed the budget limit of $100. Therefore, we apply
data validation to the range B2:B8 (not cell B10!) because this is where the values are entered. Because
we selected the range B2:B8 before we clicked on Data Validation, Excel automatically copies the
formula to the other cells. Notice how we created an absolute reference ($B$2:$B$8) to fix this
reference.
As you can see, this cell also contains the correct formula.
20
Fast Track Series - Microsoft Office Excel Advanced
Result. Excel shows an error alert. You cannot exceed your budget limit of $100.
21
Fast Track Series - Microsoft Office Excel Advanced
This example teaches you how to use data validation to reject invalid dates.
2. On the Data tab, in the Data Tools group, click Data Validation.
5. Enter the Start date and End date shown below and click OK.
Explanation: all dates between 5/20/2016 and today's date + 5 days are allowed. All dates outside this
date range are rejected.
22
Fast Track Series - Microsoft Office Excel Advanced
Note: to enter an input message and error alert message, go to the Input Message and
Error Alert tab.
4. In the Formula box, enter the formula shown below and click OK.
23
Fast Track Series - Microsoft Office Excel Advanced
As you can see, this cell also contains the correct formula.
Note: to enter an input message and error alert message, go to the Input Message and Error Alert tab.
24
Fast Track Series - Microsoft Office Excel Advanced
Drop-down lists in Excel are helpful if you want to be sure that users select an item from a list, instead
of typing their own values.
1. On the second sheet, type the items you want to appear in the drop-down list.
Note: if you don't want users to access the items on Sheet2, you can hide Sheet2. To achieve this, right
click on the sheet tab of Sheet2 and click on Hide.
3. On the Data tab, in the Data Tools group, click Data Validation.
25
Fast Track Series - Microsoft Office Excel Advanced
5. Click in the Source box and select the range A1:A3 on Sheet2.
6. Click OK.
Result:
Note: to copy/paste a drop-down list, select the cell with the drop-down list and press CTRL + c, select
another cell and press CTRL + v.
26
Fast Track Series - Microsoft Office Excel Advanced
7. You can also type the items directly into the Source box, instead of using a range reference.
Note: this makes your drop-down list case sensitive. For example, if a user types yes, an error alert will
be displayed.
27
Fast Track Series - Microsoft Office Excel Advanced
Pivot tables are one of Excel's most powerful features. A pivot table allows you to extract the
significance from a large, detailed data set.
Our data set consists of 213 records and 6 fields. Order ID, Product, Category, Amount, Date and
Country.
The following dialog box appears. Excel automatically selects the data for you. The default location for
a new pivot table is New Worksheet.
28
Fast Track Series - Microsoft Office Excel Advanced
3. Click OK.
29
Fast Track Series - Microsoft Office Excel Advanced
Drag fields
The PivotTable Fields pane appears. To get the total amount exported of each product, drag the
following fields to the different areas.
30
Fast Track Series - Microsoft Office Excel Advanced
Below you can find the pivot table. Bananas are our main export product. That's how easy pivot tables
can be!
Sort
To get Banana at the top of the list, sort the pivot table.
31
Fast Track Series - Microsoft Office Excel Advanced
Result.
32
Fast Track Series - Microsoft Office Excel Advanced
You may have noticed the PivotTable Tools tabs that appear when you inserted your chart. These
contextual tabs are used throughout Office 2010. The appropriate tab appears, depending on which
type of object you are using.
Analyse
Design
33
Fast Track Series - Microsoft Office Excel Advanced
A pivot chart is the visual representation of a pivot table in Excel. Pivot charts and pivot tables are
connected with each other.
34
Fast Track Series - Microsoft Office Excel Advanced
3. Click OK.
Below you can find the pivot chart. This pivot chart will amaze and impress your boss.
Note: any changes you make to the pivot chart are immediately reflected in the pivot table and vice
versa.
35
Fast Track Series - Microsoft Office Excel Advanced
Use slicers in Excel to quickly and easily filter pivot tables. Connect multiple slicers to multiple pivot
tables to create awesome reports.
36
Fast Track Series - Microsoft Office Excel Advanced
4. Click United States to find out which products we export the most to the United States.
Conclusion: bananas are our main export product to the United States. The report filter (cell B1)
changes to United States.
37
Fast Track Series - Microsoft Office Excel Advanced
9. On the Options tab, in the Slicer Styles group, click a slicer style.
10. Use the second slicer. Click the Multi-Select button to select multiple products.
Note: instead of using the Multi-Select button, hold down CTRL to select multiple items.
To connect both slicers to this pivot table, execute the following steps.
38
Fast Track Series - Microsoft Office Excel Advanced
13. On the Options tab, in the Slicer group, click Report Connections.
Conclusion: the total amount of apples exported to Canada equals $24,867 (6 orders) and the total
amount of oranges exported to Canada equals $19,929 (3 orders).
39
Fast Track Series - Microsoft Office Excel Advanced
17. Click the icon in the upper-right corner of a slicer to clear the filter.
Note: we didn't export any beans or carrots to Canada. Try it yourself, download the Excel file and use
slicers to create awesome reports.
40
Fast Track Series - Microsoft Office Excel Advanced
If you know the result you want from a formula, use Goal Seek in Excel to find the input value that
produces this formula result.
Use Goal Seek in Excel to find the grade on the fourth exam that produces a final grade of 70.
41
Fast Track Series - Microsoft Office Excel Advanced
7. Click in the 'By changing cell' box and select cell B5.
8. Click OK.
42
Fast Track Series - Microsoft Office Excel Advanced
Use Goal Seek in Excel to find the loan amount that produces a monthly payment of $1500.
Explanation: the PMT function calculates the payment for a loan. If you've never heard of this function
before, that's OK. The higher the loan amount, the higher the monthly payment. Assume, you can only
afford $1500 a month. What is your maximum loan amount?
6. Click in the 'To value' box and type -1500 (negative, you are paying out money).
43
Fast Track Series - Microsoft Office Excel Advanced
7. Click in the 'By changing cell' box and select cell B3.
8. Click OK.
44
Fast Track Series - Microsoft Office Excel Advanced
What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The following
example helps you master what-if analysis quickly and easily.
Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price
of $50 and a certain % for the lower price of $20.
If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * $50 + 40 * $20 = $3800.
But what if you sell 70% for the highest price? And what if you sell 80% for the highest price? Or 90%,
or even 100%? Each different percentage is a different scenario. You can use the Scenario Manager to
create these scenarios.
Note: You can simply type in a different percentage into cell C4 to see the corresponding result of a
scenario in cell D10. However, what-if analysis enables you to easily compare the results of different
scenarios. Read on.
45
Fast Track Series - Microsoft Office Excel Advanced
4. Type a name (60% highest), select cell C4 (% sold for the highest price) for the Changing cells and
click on OK.
46
Fast Track Series - Microsoft Office Excel Advanced
Finally, your Scenario Manager should be consistent with the picture below:
Note: to see the result of a scenario, select the scenario and click on the Show button. Excel will
change the value of cell C4 accordingly for you to see the corresponding result on the sheet.
47
Fast Track Series - Microsoft Office Excel Advanced
Scenario Summary
To easily compare the results of these scenarios, execute the following steps.
2. Next, select cell D10 (total profit) for the result cell and click on OK.
Result:
Conclusion: if you sell 70% for the highest price, you obtain a total profit of $4100, if you sell 80% for
the highest price, you obtain a total profit of $4400, etc. That's how easy what-if analysis in Excel can
be.
48
Fast Track Series - Microsoft Office Excel Advanced
Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price
of $50 and a certain % for the lower price of $20. If you sell 60% for the highest price, cell D10 below
calculates a total profit of 60 * $50 + 40 * $20 = $3800.
1. Select cell B12 and type =D10 (refer to the total profit cell).
We are going to calculate the total profit if you sell 60% for the highest price, 70% for the highest
price, etc.
49
Fast Track Series - Microsoft Office Excel Advanced
6. Click in the 'Column input cell' box (the percentages are in a column) and select cell C4.
We select cell C4 because the percentages refer to cell C4 (% sold for the highest price). Together with
the formula in cell B12, Excel now knows that it should replace cell C4 with 60% to calculate the total
profit, replace cell C4 with 70% to calculate the total profit, etc.
Note: this is a one variable data table so we leave the Row input cell blank.
7. Click OK.
50
Fast Track Series - Microsoft Office Excel Advanced
Result.
Conclusion: if you sell 60% for the highest price, you obtain a total profit of $3800, if you sell 70% for
the highest price, you obtain a total profit of $4100, etc.
Note: the formula bar indicates that the cells contain an array formula. Therefore, you cannot delete
a single result. To delete the results, select the range B13:B17 and press Delete.
51
Fast Track Series - Microsoft Office Excel Advanced
1. Select cell A12 and type =D10 (refer to the total profit cell).
We are going to calculate the total profit for the different combinations of 'unit profit (highest price)'
and '% sold for the highest price'.
52
Fast Track Series - Microsoft Office Excel Advanced
7. Click in the 'Row input cell' box (the unit profits are in a row) and select cell D7.
8. Click in the 'Column input cell' box (the percentages are in a column) and select cell C4.
We select cell D7 because the unit profits refer to cell D7. We select cell C4 because the percentages
refer to cell C4. Together with the formula in cell A12, Excel now knows that it should replace cell D7
with $50 and cell C4 with 60% to calculate the total profit, replace cell D7 with $50 and cell C4 with
70% to calculate the total profit, etc.
9. Click OK.
Result.
Conclusion: if you sell 60% for the highest price, at a unit profit of $50, you obtain a total profit of
$3800, if you sell 80% for the highest price, at a unit profit of $60, you obtain a total profit of $5200,
etc.
Note: the formula bar indicates that the cells contain an array formula. Therefore, you cannot delete
a single result. To delete the results, select the range B13:D17 and press Delete.
53
Fast Track Series - Microsoft Office Excel Advanced
6.0 Macros
6.1 Creating macros
With Excel VBA you can automate tasks in Excel by writing so called macros. In this chapter, learn how
to create a simple macro which will be executed after clicking on a command button.
1. Right click anywhere on the ribbon, and then click Customize the Ribbon.
2. Under Customize the Ribbon, on the right side of the dialog box, select Main tabs (if necessary).
54
Fast Track Series - Microsoft Office Excel Advanced
4. Click OK.
5. You can find the Developer tab next to the View tab.
55
Fast Track Series - Microsoft Office Excel Advanced
The Macro Recorder, a very useful tool included in Excel VBA, records every task you perform with
Excel. All you have to do is record a specific task once. Next, you can execute the task over and over
with the click of a button. The Macro Recorder is also a great help when you don't know how to
program a specific task in Excel VBA. Simply open the Visual Basic Editor after recording the task to
see how it can be programmed.
Unfortunately, there are a lot of things you cannot do with the Macro Recorder. For example, you
cannot loop through a range of data with the Macro Recorder. Moreover, the Macro Recorder uses a
lot more code than is required, which can slow your process down.
Record a Macro
2. Enter a name.
56
Fast Track Series - Microsoft Office Excel Advanced
3. Select This Workbook from the drop-down list. As a result, the macro will only be available in the
current workbook.
Note: if you store your macro in Personal Macro Workbook, the macro will be available to all your
workbooks (Excel files). This is possible because Excel stores your macro in a hidden workbook that
opens automatically when Excel starts. If you store your macro in New Workbook, the macro will only
be available in an automatically new opened workbook.
4. Click OK.
5. Right mouse click on the active cell (selected cell). Be sure not to select any other cell! Next, click
Format Cells.
57
Fast Track Series - Microsoft Office Excel Advanced
6. Select Percentage.
7. Click OK.
58
Fast Track Series - Microsoft Office Excel Advanced
Now we'll test the macro to see if it can change the number format to Percentage.
59
Fast Track Series - Microsoft Office Excel Advanced
4. Click Run.
Result:
60
Fast Track Series - Microsoft Office Excel Advanced
Note: the macro has been placed into a module called Module1. Code placed into a module is available
to the whole workbook. That means you change the number format of cells on other sheets as well.
Remember, code placed on a sheet (assigned to a command button) is only available for that particular
sheet.
61
Fast Track Series - Microsoft Office Excel Advanced
Result:
6. Empty Range("B3:B5").
7. Select any cell on the sheet and run the recorded macro.
Result:
62
Fast Track Series - Microsoft Office Excel Advanced
Wouldn't it be nice to place these words anywhere on the sheet automatically? Not just
Range("B3:B5"). This would make the macro much more flexible. Solution: record the macro in relative
mode.
Result:
8. Select any other cell (for example, cell D4) and run the recorded macro.
63
Fast Track Series - Microsoft Office Excel Advanced
Result:
Excel places the words relative to the initial selected cell. That's why it's called recording in relative
mode.
64