excel 2016 - advanced - cdn.ymaws.com · of the data to see more details or calculate different...

15
Excel 2016 - Advanced LINDA MUCHOW Alexandria Technical & Community College 320-762-4539 [email protected]

Upload: others

Post on 08-Sep-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

Excel 2016 - Advanced

LINDA MUCHOW

Alexandria Technical & Community College 320-762-4539 [email protected]

Page 2: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

1

Table of Contents Macros .................................................................................................................................................................................... 2

Adding the Developer Tab in Excel 2016 ............................................................................................................................ 2

Excel Macro Recorder ......................................................................................................................................................... 3

Recording the Macro .......................................................................................................................................................... 4

Recording a Relative Reference Macro ............................................................................................................................... 5

Personal Workbook Macro ................................................................................................................................................. 6

Create custom Macro Tab ................................................................................................................................................... 6

IF AND OR ................................................................................................................................................................................ 8

Nested IF Statement ............................................................................................................................................................... 8

Linking Data ............................................................................................................................................................................. 9

Linking worksheets.............................................................................................................................................................. 9

Edit Links ............................................................................................................................................................................. 9

PivotTables & PivotCharts ..................................................................................................................................................... 10

Creating a PivotTable ........................................................................................................................................................ 10

To add a calculated field ................................................................................................................................................... 12

Timelines in PivotTables .................................................................................................................................................... 13

Slicers in PivotTables ......................................................................................................................................................... 13

Create a PivotChart ........................................................................................................................................................... 14

Page 3: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

2

Macros Adding the Developer Tab in Excel 2016

1. Click on the File tab of the ribbon to open the file menu.

2. Click on Options in the menu to open the Excel Options dialog box.

3. Click on the Customize Ribbon option in the left hand window to view the available options in the right hand

window of the dialog box.

4. Under the Main Tabs section of the options window check off the Developer option.

5. Click OK .

6. The Developer tab should now be visible in the ribbon in Excel 2013.

Before we start recording our macro, we need to add the worksheet title we will be formatting.

Since the title of each worksheet is usually unique to that worksheet, we don't want to include the title in the macro.

Therefore we will add it to the worksheet, before starting the macro recorder.

1. Click on cell A1 in the worksheet.

2. Type the title: Expenses for June 2014

3. Press the Enter key on the keyboard.

Page 4: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

3

Excel Macro Recorder

The easiest way to create a macro in Excel is to use the macro recorder. To do so:

1. Click on the Developers tab.

2. Click on Record Macro in the ribbon to open the Record Macro dialog box.

There are 4 options to complete in this dialog box:

1. Macro name - give your macro a descriptive name. The name must begin with a letter and spaces are not

allowed. Only letters, numbers and the underscore character are permitted.

2. Shortcut key - (optional) fill in a letter, number, or other character in the available space. This will allow you to

run the macro by holding down the CTRL key and pressing the chosen letter on the keyboard.

3. Store macro in

Options:

a) This workbook: The macro is available only in this file

b) New workbook: this option opens a new Excel file. The macro is available only in this new file.

c) Personal macro workbook: This option creates a hidden file Personal.xls which stores your macros and makes

them available to you in all Excel files.

4. Description: (optional) enter a description of the macro.

Page 5: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

4

Recording the Macro

1. Click the OK button in the Record Macro dialog box to start the macro recorder.

2. Click on the Home tab of the ribbon.

3. Drag select cells A1 to F1 in the worksheet to highlight them.

4. Click on the Merge and Center icon to center the title between cells A1 and F1.

5. Click on the Fill Color icon (looks like a paint can) to open the fill color drop down list.

6. Choose Blue, Accent 1 from the list to turn the background color of the selected cells to blue.

7. Click on the Font Color icon (it is a large letter "A") to open the font color drop down list.

8. Choose White from the list to turn the text in the selected cells to white.

9. Click on the Font Size icon (above the paint can icon) to open the font size drop down list.

10. Choose 16 from the list to change the size the text in the selected cells to 16 point.

11. Click on the Developer tab of the ribbon.

12. Click the Stop Recording button.

13. At this point, your worksheet title should resemble the title in the image.

To run a macro you have recorded:

1. Click on the Sheet2 tab at the bottom of the spreadsheet.

2. Click on cell A1 in the worksheet.

3. Type the title: Expenses for July 2014.

4. Press the Enter key on the keyboard.

5. Click on the Developer tab of the ribbon.

6. Click the Macros button on the ribbon to bring up the View Macro dialog box.

Page 6: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

5

7. Click on the format macro in the Macro name window.

8. Click the Run button.

What are Relative References?

When you use Excel to record a macro it will record only what you did, not how you did it. This works for most types of

macros that you will be creating, but not all. What do you need to do if you wanted a macro to record in more detail?

Imagine that you would like to move from cell A1 to cell C1; you can do this by pressing the right arrow key on your

keyboard. By default Excel will not record that this key was used; instead, it only records that C1 has been selected.

Now imagine that you have recorded these actions, but you would like to use this macro on A2 so that it would select

C2. However, when the macro is executed, C1 will be selected. This is because instead of recording that you moved two

cells to the right, it only knows that C1 has been selected.

To remedy this issue, Excel includes the ability to record macros relatively. If we recorded the macro created above using

relative references, it would know to move to the right of any cell selected, instead of blindly selecting C1 all the time.

Recording a Relative Reference Macro

If you would like to record a macro relatively, relative references need to be enabled.

1. You can do this by selecting “Use Relative References” from the Developer tab:

2. You are able to see when Relative References has been enabled by the highlighted color:

When Relative References has been enabled, you can then record your

macro just as if you would record any other: by selecting Record Macro

from the Macros drop-down command. When you are done recording

this macro, select the Stop Recording option from the same drop-down.

The only difference is that everything you do will be relative, so you cannot make changes to a specific cell.

Page 7: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

6

Running a Relative Reference Macro

Running a relative reference macro is slightly different than running a regular macro. You need to be aware of what cell

you have selected, as everything that the macro will do will be relative to that cell. When you have the proper cell

selected, you can then go through the process of selecting the Macros drop-down command, selecting View Macros

from the menu, choosing the macro that you would like to use, and then clicking Run.

The key is to always remember that the macro will run relative to your starting cell. In this example the macro that was

used turns the fourth cell from the right of the starting cell yellow:

The red boxes denote the starting point from which the macro was run. As you can see, it’s all relative to the starting

position.

Personal Workbook Macro When you want to use a macro in more than one workbook, change the Store Macro In dropdown to: Personal Macro Workbook.

To see the macros, select View >> Unhide >>PERSONAL. Remember to hide the Personal workbook when you are done – View >> Hide

Create custom Macro Tab You will likely want to create customized tab on your ribbon to hold all of the macros you can use in any worksheet.

1. Select File >> Options >> Customize Ribbon.

Page 8: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

7

2. Click New Tab and then Rename the Tab.

3. Select the New Group (Custom) item and click Rename.

4. Select Choose Commands From – Popular Commands Dropdown. Select Macros. Select your macro from the

left. Click the Add button in the middle.

5. You will now have a macro tab with your macro(s) available to use at any time.

Page 9: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

8

IF AND OR =IF(AND(D2>5,C2>10000),2,1) Salespeople who have been employed for more than 5 years AND have sales of greater than $10,000 should be assigned a job level of 2, all others should have a job level of 1.

IF(OR(D2>5,C2>10000),2,1) Sales people who have been employed for more than 5 years or have sales of greater than $10,000 should be assigned a job level of 2, all others should have a job level of 1.

Nested IF Statement Sales people who have sales of 40,000 or greater are a level 3, $10,000 or greater are a level 2, the rest are a level 1.

Page 10: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

9

Linking Data Linking allows data stored on a worksheet to be referenced by another worksheet. This can be within the same workbook, or in separate workbooks.

Linking worksheets 1. Open the file containing worksheets that you want to link together. 2. Copy the cell you wish to link to another worksheet. 3. Switch to that worksheet and select the desired cell. 4. Right mouse click – select Paste Special

5. Select the Paste Link option.

If the data is changed for a source cell, it is automatically updated in the destination cell, provided the changes to the source are saved.

Edit Links One file could be linked to one or more other files through formulae. During the course of time, as these workbooks get updated / changed, there could be a need to change the links in these workbooks. Changing the source link allows the user to change the location of the source where the data exists or to change the link to a new workbook altogether. To change the source link you have to use the “Edit Links” option. This option gives the user a view of all the other files the current file is linked to, so that the user can update or remove the links.

1. From the Data Tab select Edit Links.

2. This window allows you to Change the source, open the source, break the link or check the status.

Page 11: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

10

PivotTables & PivotCharts A PivotTable interactively allows for quickly summarizing large amounts of data. You can rotate its rows and columns to see different summaries of the source data, filter the data by displaying different pages, or display the details for areas of interest. PivotCharts are associated with PivotTables and provide graphical representations of the same information. Use a PivotTable when you want to compare related totals, especially when you have a long list of figures to summarize and you want to compare several facts about each figure. Because a PivotTable is interactive, you can change the view of the data to see more details or calculate different summaries. This gives a customized perspective on the data without having to change anything in the range of cells it is based on.

Creating a PivotTable 1. Click a cell in the range of cells that contains the data you want to make a PivotTable

out of. 2. From the Insert Tab, within the Tables group, click PivotTable. 3. Click OK. Excel adds an empty PivotTable report to a new worksheet. 4. To add fields to the report, click and hold the field name in the field section, and then

drag it to an area in the layout section. Fields you put in the different layout section are as follows:

1. Report Filters: filters are shown at the top-level report above the PivotTable and will filter the entire table at once.

2. Column Labels: are shown in column layout (horizontal) at the top of the PivotTable. 3. Row Labels: are shown in Row layout (vertical) on the left side of the PivotTable. 4. Values: are shown as summarized numeric values.

Page 12: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

11

Pivot Tables – What’s Next! Show Values % of Grand Total

1. First select one of the Total values that you wish to display as a percentage of the Grand Total and Right Mouse Click.

2. Select Show Value As >> % of Grand Total

Show Values Difference From

1. First select one of the Total values you wish to display as values from difference and Right Mouse Click. 2. Select Show Values As >> Difference From. In this example the Base field is the Building. The Base Item is the

Building named North.

3. Click Ok. Results are displayed.

4. To clear the results. Right mouse click an amount. Select Show Values As >> No Calculation.

Page 13: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

12

Running Total 1. Right mouse click a cell within the total column. Select Show Values As>>Running Total In 2. Select the Base Field. In this example we will show values as a running total by Building.

3. Click OK.

To add a calculated field 1. Select a cell in the pivot table, and on the Excel Ribbon, under the PivotTable Tools tab, click the Options tab. 2. From the Calculations group, Select Fields, Items, & Sets >> Calculated Field.

3. Type a name for the calculated field, for example, 15% increase 4. In the Formula box, delete everything but the equal sign (=). Double click a field from the Field list. And add any

arithmetic operators and numbers to complete your formula. This formula is going to multiply the salary amount by 1.15.

5. Click Add to save the calculated field, and click Close. The field appears in the Values area of the pivot table, and in the field list in the PivotTable Field List.

Page 14: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

13

Timelines in PivotTables You can now insert a Timeline in a PivotTable as long as you have date fields to work with!

Slicers in PivotTables Slicers allow you to quickly filter PivotTables and Charts.

1. Select Analyze >> Filter Group >> Insert Slicer. 2. Select the fields you wish to filter by. Click OK.

3. The slicers will be added. Simply select the items you wish to see. Hold down the ctrl key to select multiple

items at once. Notice the Clear Filter button in the upper right corner of each slicer.

Page 15: Excel 2016 - Advanced - cdn.ymaws.com · of the data to see more details or calculate different summaries. This gives a customized perspective on the data This gives a customized

14

4. New to 2016 you can select Multi Select to remove several items at once.

Create a PivotChart 1. Select any cell in your PivotTable 2. From the PivotTable Tools Analyze Tab select PivotChart from Tools group. You can also use the Insert Tab >>

Charts >> PivotChart 3. The insert chart dialog box will appear. Select the desired chart type and layout, then click OK.