50
Create Dynamic and Interactive Charts Publication Date: March 2020

Create Dynamic and Interactive Charts

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

Publication Date: March 2020

Page 2: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

Copyright © 2009-2020 by Mill Creek Publishing

P.O. Box 11, Zionsville, IN 46077

Revised: March 2020

All rights reserved. No part of this course may be reproduced in any form or by any means, without permission in writing from the publisher. The author is not engaged by this text or any accompanying lecture or electronic media in the rendering of legal, tax, accounting, or similar professional services. While the legal, tax, and accounting issues discussed in this material have been reviewed with sources believed to be reliable, concepts discussed can be affected by changes in the law or in the interpretation of such laws since this text was printed. For that reason, the accuracy and completeness of this information and the author's opinions based thereon cannot be guaranteed. In addition, state or local tax laws and procedural rules may have a material impact on the general discussion. As a result, the strategies suggested may not be suitable for every individual. Before taking any action, all references and citations should be checked and updated accordingly.

This publication is designed to provide accurate and authoritative information in regard to the subject matter

covered. It is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other

professional service. If legal advice or other expert advice is required, the services of a competent professional

person should be sought.

--From a Declaration of Principles jointly adopted by a committee of the American Bar Association and a Committee

of Publishers and Associations.

Page 3: Create Dynamic and Interactive Charts

Contents

Overview – Range Names and SERIES ............................................................................................................ 1 Relative and Absolute Cell References ....................................................................................................... 1 Range Names .............................................................................................................................................. 1 SERIES Formula ........................................................................................................................................... 2

SERIES Formula and Range Names ................................................................................................................. 3 Review Questions – Section 1 ........................................................................................................................ 6 Overview of OFFSET and COUNT Functions ................................................................................................... 7

OFFSET Function ......................................................................................................................................... 7 COUNT Functions........................................................................................................................................ 8

Create an Automatically Expanding Chart ...................................................................................................... 9 Review Questions – Section 2 ...................................................................................................................... 14 Review Exercise -Self Expand ....................................................................................................................... 15 Review Exercise -Self Expand 2 Series .......................................................................................................... 16 Controlling Data in a Self-Expanding Chart .................................................................................................. 18

Display the Last X Data Points in the Worksheet ..................................................................................... 18 Review Exercise – Display 4 Data Points ...................................................................................................... 21 Selecting a Beginning and Ending Point for a Series .................................................................................... 23 Review Exercise -Beginning and Ending Point .............................................................................................. 26

Create a Spinner ....................................................................................................................................... 28 Scroll Bar ................................................................................................................................................... 32

Linking Title Text to a Cell ............................................................................................................................. 33 Review Questions – Section 3 ...................................................................................................................... 35 Feedback Answers to Review Questions ...................................................................................................... 36 Glossary ........................................................................................................................................................ 40 Creating Dynamic & Interactive Charts – Final Exam ................................................................................... 42

Page 4: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

Course Description: This course walks you through setting up Excel charts so they update automatically as data in entered into the worksheet. In addition, to discussing self-expanding charts, it also covers how to specify the number of data points to display in a chart. For example, you may only want the last rolling six months of data to display, in the chart, as you add new data each month. Linking a chart title to a cell and creating a spinner control is also discussed. This eBook walks you through the process step by step and then includes practice exercise for each topic as well as answer files. This EBook covers:

Creating Range Names in a SERIES formula

Using OFFSET and COUNTA functions for charting purposes

Discusses other COUNT functions

Shows how to create Self-Expanding Charts

Shows how to displaying the last x number of data points

Selecting a beginning and ending point for a data series

Creating and using Spinners

Linking a Chart Title to a Cell Learning Objectives: By the end of the course participants will be able to: 1. Differentiate between different types of cell references and recognize to apply

them. 2. Recognize the steps needed to create the components of range names and named

formulas. 3. Differentiate between the different COUNT functions 4. Recognize how the SERIES, OFFSET and COUNTA functions work to create dynamic

charts that update automatically. 5. Recognize the concept of input cells and how to apply them. 6. Recognize the steps needed to link a chart title to a cell so that a chart title updates

automatically 7. Recognize the steps needed to create a spinner or scroll box. Prerequisites: An advanced knowledge of Excel is assumed. You need to be familiar with functions and have an understanding of absolute and relative cell references. This course was written for Excel 2019 and Microsoft Office 365 users; however, users of earlier versions should have absolutely no difficulty. How to Use This EBook This EBook is comprised of different sections that cover one or more topics. Each topic is briefly discussed and then the topic is broken down into simple step by step instructions so that you can understand how to apply the given tip or tool to your own work. A file folder icon , will prompt you to open a file so that you can try an

Page 5: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

exercise. After each significant exercise, there is an optional Review Exercise for you to try on your own to reinforce what you have learned. Student Data Files The files to be used with this EBook can be found at the same location as the EBook. Using this EBook and these files you will be able to work at your own pace. The answers to each of the exercises are also in the file or a separate answer file. TO BEGIN – Download the Excel Files

Download the Student Data Excel Files The files to be used with this EBook can be found in the same web page as this book, at the Course Overview page. In the Downloads section of the Course Overview page, download the zip file containing the Excel worksheets to your hard drive by selecting ‘Download’ for the Other Materials and then double-click to extract the files. You should specify where you want Excel to save the files. Start Excel. Go to the File Ribbon, select Open and then find the file on your hard drive.

Advanced Preparation: None Software Version: Excel 2019/ Microsoft Office 365 NASBA Classification: Computer Software and Applications Updated/Reviewed: March 2020 Recommended Hours: 4

Page 6: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

1

Overview – Range Names and SERIES I thought I would go over a few underlying assumptions before we just jump into the topic of interactive charts. This eBook spends a lot of time on range names, editing a SERIES formula and using the OFFSET function. Since this is the underlying foundation of this course, let’s discuss these features a bit before we start using them.

Relative and Absolute Cell References

By default, all cell references are relative references. When copied across multiple cells, they change based on the relative position of rows and columns. For example, if you copy the formula =A1+B1 from row 1 to row 2, the formula will become =A2+B2. Absolute cell references are cells references that do not change even when the formula that incorporates them moves. Absolute cell references are denoted by a dollar sign $. =$A$1+$B$1 remains =$A$1+$B$1even when it is copied from row 1 to row 2.

Range Names A Range Name is a cell, or group of cells, in an Excel spreadsheet that has been named. Range naming can be very useful particularly in budgeting or using percentages, as a range name in a formula continually refers to that cell even if you copy or move the formula. Range Names are treated as absolute cell references. In other words, I can name cell A1 as Tax_Rate and even if I create a formula referencing that cell and then copy it elsewhere, the formula continually goes back to cell A1 as its reference. Range names also have other some other uses, such as navigating around a spreadsheet.

Since Excel 2007, you have been able to utilize the same range name more than once in a workbook , if you change the default scope, however, I think that is very confusing. So, we are going to assume that Excel will only allow you to create a specific range name once within a workbook during this course. There are certain naming rules that do exist and the three most important rules are that a range name:

cannot contain spaces. cannot begin with a number. cannot contain a special character such as a hyphen.

Page 7: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

2

SERIES Formula In this EBook we will be using a range name with the SERIES formulas. In case you are wondering what a SERIES formula is – it is the formula that graphs/displays your data in a chart. If you click or hover over a data series in a chart, the Series formula will display as shown in the screenshot below.

Each SERIES formula represents a data series in the active chart. It cannot be used in worksheets.

Page 8: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

3

SERIES Formula and Range Names Open up Series.xlsx. If necessary, click on the sheet names Bikes. 1. Click with your mouse on the January data series in the chart.

2. Look up at the Formula Bar and you should see the SERIES formula.

=SERIES(Bikes!$B$4,Bikes!$A$5:$A$9,Bikes!$B$5:$B$9,1) So, how do you read this? The formula is comprised of 3 parts: 1. B4 contains the name of the data series which is January. 2. The product line in Column A (A5 through A9) – the category labels. 3. The actual data values ( January sales in B5 through B9).

The way the formula reads in English is =Series (January, the category axis in cells A5 though A9, and the data values in column B (B5 through B9). Bikes is the name of the sheet. Now we are going to name the January data series by defining it in the Define Name dialog box. 3. Click in the spreadsheet (your cursor should NOT be in the chart). 4. Click on the Formulas Tab. 5. Click on the drop down arrow beside Define Name and select Define Name….

Page 9: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

4

6. Click in the Name: section and type Jan. 7. Leave the Scope as the Workbook which is the default. The workbook Scope default

means that you can use this name Jan anywhere in the workbook and Excel will recognize it.

8. Click in the “Refers to:” section and either type in $B$5:$B$9 or select B5:B9 with your cursor.

9. Click OK. Click on the January chart series again (in the chart). 10. Click in the Formula Bar. 11. Select $B$5:$B$9.

12. Replace these cell references with the word Jan by typing Jan. 13. Click the check mark on the Formula Bar to enter the formula changes.

Now go back and click on the January series in the chart and you will see that it reads Jan up on the Formula Bar. Yes, that’s it. It doesn’t do a lot but it does make the chart more readable. As I said before, this is the underlying foundation that we are going to build upon so while not yet exciting it is important that you understand what we did. In the next section we are going to build off of your understanding of the SERIES formula and range names (which are absolute cell references by the way) by creating named formulas which can be used inside the SERIES formula. This will allow us to create

Page 10: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

5

interactive or dynamic charts that can automatically update when new data is entered into the spreadsheet. It allows you to control the data displayed. If you spell a Defined Name incorrectly or have an error in the Refers to: section, the easiest way to correct it is to go to the Name Manager dialog on the Formula tab and correct it there.

If you have a long formula, it tends to be easier to see it and edit it in the Name Manager dialog box. You can also delete names in the Name Manager dialog box.

Page 11: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

6

Review Questions – Section 1 1. Which of the following is TRUE?

A. You can use a range name more than once in a workbook. B. A range name can be created multiple times in a worksheet. C. You cannot create a range name at the worksheet level. D. You cannot create a range name at the workbook level.

2. Range names ______

A. Can contain spaces. B. Can begin with a number. C. Cannot contain more than 10 characters. D. Can contain underscores.

3. Named ranges are ________

A. Relative references. B. Absolute references. C. Mixed references. D. Static references.

4. Each SERIES formula represents a _____________ A. Data point in the chart. B. Data series in the chart. C. A column chart. D. A series of lines.

Page 12: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

7

Overview of OFFSET and COUNT Functions OFFSET Function The OFFSET function is not very well known, however, it is extremely powerful. With it, you can create a chart that will automatically expand and update as additional information is entered into the source data that the chart is referencing. Having a chart automatically expand as you ADD data to the data range of the chart is a great timesaver as you do not have to create a new chart or even redraw or reformat the existing chart.

The OFFSET function returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and the number of columns to be returned. All the OFFSET function does is return a cell reference which doesn’t sound that useful; however, OFFSET can be used with any other function expecting a reference argument. In our example we are going to marry the OFFSET function with a COUNT function.

Offset Function: The basic syntax of the function: OFFSET(reference,rows,cols)

Reference The cell(s) from which you want to base the Offset. Reference must refer to a cell or range of adjacent cells. Consider it the anchor.

Rows The number of rows, up or down, that you want the upper-left cell to refer to. Using 10 as the rows argument specifies that the upper-left cell in the reference is 10 rows below reference. Rows can be positive (below the starting reference) or negative (above the starting reference).

Cols The number of columns, to the left or right, which you want the upper-left cell of the result to refer to. Using 8 as the columns argument specifies that the upper-left cell in the reference is 8 columns to the right of reference. Columns can also be positive (to the right of the starting reference) or negative (to the left of the starting reference).

Height Indicates the number of rows to be included in the range (optional argument)

Width Indicates the number of columns to be included in the range (optional argument).

Page 13: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

8

COUNT Functions COUNT AND COUNTA

In this course, we are only going to be using the COUNTA function; however, many people get confused over the different count functions so I wanted to take a minute and discuss them as they are all extremely useful and it is important to understand the differences. =COUNT, is the most common COUNT function, and it only counts cells containing numbers. =COUNTA counts cells containing both text as well as numbers. Please note that since it counts cells with text it may also count column headings if they contain text.

In the example below, using COUNT on cells B1: B7 resulted in an answer of 1 since it only counted the number 2 in cell B4. COUNTA, however, on the same range returned an answer of 3 since it counted the contents of B2, B4 and B6.

We will be using COUNTA in a couple of the sections and we will be using OFFSET pretty much throughout this course. If you start doing a lot with macros, you will see the OFFSET command frequently.

Other COUNT Functions

Other COUNT functions you should be aware of are COUNTBLANK which counts blank cells and COUNTIF which counts cells that meet a specified criterion. For example, if you wanted to count the number of cells that has the word CPA in it in the above screen shot, you would use =COUNTIF(B1:B7,"CPA") and it would return a value of 1 as CPA only displays once in B1.B7. Quotations were used around CPA because it is text. If I had wanted to count how many instanced of the number 2 there were in B1.B7, I would have used the following formula =COUNTIF(B1:B7,2) and left off the quotation marks since 2 is a numeric value.

If you are not familiar with COUNTIF, it can be quite useful. For example, you can use it if you wanted to count the number of negative numbers in a reserve column or count the number of lockboxes displaying in a column.

Page 14: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

9

Okay, all the basics are out of the way and we are ready to begin creating dynamic and interactive charts.

Create an Automatically Expanding Chart In this exercise, we are going to walk through the steps needed to set up a chart to automatically update as new data is entered into the worksheet. Open up Self_Expand.xlsx and select the sheet named Sheet1 if necessary.

Normally you would click in cell A1 and enter the data to be graphed vertically; however, I have already entered the data so that I could create a chart for you. Column A shows the months and Column B shows pounds of coffee beans purchased.

1. Click Formulas on the ribbon. (It does not matter where the cursor is). 2. Click Define Name. 3. In the “Name:” field enter the title of the first column which is Date. 4. Leave the default Scope set as Workbook. 5. In the ““Refers to:” field, type =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A:$A)-1)

Warning! (If you re-named your sheet then you need to change the formula from Sheet 1 to whatever you named it, otherwise, this will not work).

6. Click OK to create the range name Date.

Page 15: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

10

Formula explanation: This OFFSET formula, we just created, tells Excel that cell A2, in Sheet 1, is where the data for the first column (the X axis) begins. The 0, tells Excel not to move over any additional rows or columns. The second part of the equation tells Excel to count all the data in Column A. COUNTA counts both text and values. Because column A has a heading row called Date in Row 1, the formula subtracts a 1 from the number since we do not want to cell A1 to be included as a data point in the graph.

7. Click on Name Manager on the Formulas Tab.

8. Click New…at the top of the dialog box. 9. Click in the “Name:” field and type the name of the second series which will be

Beans. 10. In the “Refers to:” box, type =OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B)-1) If you don’t like to type you could copy the original Date formula in the Refers to:” box, paste it in and then edit it. Essentially you are changing all the Column A references to Column B references so that Excel understands you are referring to the second column for the Beans range name.

Page 16: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

11

The equation is similar to the first with the primary exception being that we are referencing Column B instead of Column A. 11. Click OK to add the name and to close the New Name dialog box. When you name the range as we did above you create a named formula. In the example above the formula =Offset (Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B)-1) in the “Refers to:” box is in actuality a formula.

As mentioned above, a range name formula is called a named formula. However, it is a bit different than other formulas you may be familiar with in Excel. This formula actually acts differently from a formula that you type into a spreadsheet as it does not exist in an Excel cell but in Excel’s memory. Since the formulas don’t have a specific cell address you don’t see the effect of the formulas until you use them.

We are almost done. 12. Click in the chart to activate it. 13. Click on the data series Beans in the chart.

Page 17: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

12

Make sure that you selected the data series rather than just a single data point.You should see that every data point in the chart is selected.

14. Notice the Formula Bar.

=SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$7,Sheet1!$B$2:$B$7,1) 15. Replace the range references in the SERIES formula $A$2:$A$7 with the range name

Date and replace $B$2:$B$7 with Beans.

Your formula should looks similar to this =SERIES(Sheet1!$B$1,Sheet1!Date,Sheet1!Beans,1)

16. Click in Cell A8 and start entering more data. Watch your chart automatically update as you enter more information.

If you have multiple data ranges to graph, make sure that the first argument refers to the first data point and that the argument for COUNTA includes the X axis range name and the range name of the column being graphed.

Page 18: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

13

Four Common Errors If you have a problem getting the chart to expand automatically: 1. Check to make sure that you deleted the absolute cell reference symbols ($) s in the

Formula Bar. 2. Check that you did not inadvertently delete the exclamation point between the

words Sheet 1 and the range name. 3. Make sure that your sheet name is reflected properly in the formula. 4. Check your spelling and make sure you have matching parentheses. To check your syntax, look in the Name Manager on the Formulas Tab.

Page 19: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

14

Review Questions – Section 2 1. In the OFFSET formulas using $A:$A tells Excel to extract the data

A. From cell A1. B. From the Column A. C. From the Row A. D. From Column AA

2. The most common error that people tend to make when creating interactive charts is

leaving in the ___when replacing the data series with a named range. A. $ B. ! C. * D. #

3. Which function counts both text and numbers?

A. COUNTBLANK B. COUNTIF C. COUNT D. COUNTA

4. Cell A1 contains the value of 10 and Cell A2 contains the value CPA. If you used the COUNT

function, your answer would be ___. A. 0 B. 1 C. 2 D. 10

5. Cell A1 contains the value of 10 and Cell A2 contains the value CPA. If you used the COUNTA

function, your answer would be ______________. A. 0 B. 1 C. 2 D. 10

6. The sheet name and the range name are separated by a/an ___________.

A. Exclamation point B. Comma C. Quotation marks D. Semi colon

Page 20: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

15

Review Exercise -Self Expand Click on Sheet 2 in Self_Expand.xlsx. The data has already been entered and the chart drawn showing Sales by Month. 1. Using the information, you learned in the last exercise, create a chart that will

automatically expand as more data is entered into the worksheet at row 10. 2. Remember it is recommended that range names only be created once in a workbook

so, in the Formula >Define Name dialog box, choose names that are different from the last exercise. In the answer file, I used Month and Sales instead of Date and Beans.

This exercise is very similar to the one that we just did EXCEPT that this is Sheet2 instead of Sheet1. The completed exercise can be found on Sheet 2 in Self_Expand_Answers.xlsx. (If your SERIES formula doesn’t contain the file name – that’s fine – don’t worry about it.)

Don’t forget that range names should only be used once in a workbook and the range names cannot contain spaces. Excel now allows you to use range names more than once in a file, however, it can be very confusing so I don’t recommend it. This is why we have left the Scope set to the default of Workbook when defining names.

Page 21: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

16

Review Exercise -Self Expand 2 Series This Review Exercise is more of a challenge since it adds a 2nd series but I know you can do it! Click on the 3rd sheet in Self _Expand.xlsx The data has already been entered and the chart drawn showing Units Sold and Budget Units by Month. 1. Select the Formulas Tab. 2. Select Define Name and then use the range names Years, Units, Budget.

3. In this case you are being asked to create a chart that will automatically expand as

more data is entered into 2 data series instead of just 1 series.

The completed exercise can be found on the Sheet 3 in Self_Expand_Answers.xlsx. Hint: You need to set up 3 Ranges instead of 2 as you also need one this time for column C so you need to edit the SERIES formula for both data series. If you do not want to type in the OFFSET formula, you can copy it and then using Name Manager edit to change the Sheet Name and the Column References. If you have not used Name Manager before, click with your mouse when editing otherwise, if you use your mouse, Excel types those movements into the formula.

Here is a screenshot of all the formulas we have created.

Page 22: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

17

Page 23: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

18

Controlling Data in a Self-Expanding Chart As soon as everyone understands how to expand a chart automatically, guess what everyone wants to know? Yes- you guessed it. Everyone wants to be able to specify or control the data that was being automatically charted. The following sections show you some different ways to control the data.

Display the Last X Data Points in the Worksheet In this exercise, we are going to have Excel automatically graph the last 12 months of data. This could be handy if you had 24 months of sales data but only want to display the last 12 months. Open Last_Number_Data_points.xlsx and click on Sheet 1 if necessary.

The chart, in this exercise, has already been created for you. In our example, cell G2 is the arbitrary cell selected where we will specify how many points we want charted.

1. Click on G2. 2. Type in a number. We will use 12 in our example since we want the last 12 data

points in the column to be graphed. 3. Click Define Name on the Formulas Tab. 4. Click in the “Name:” field, and type number_of _cells (make sure the Refers to:

section displays $G$2). 5. Click OK.

6. Click again on Define Name on the Formulas Tab. 7. Click in the “Names” field and type Date. 8. In the “Refers to:” section, type the following:

=OFFSET(Sheet1!$A$2,COUNTA(Sheet1!$A:$A)-number_of_cells-1,0,number_of_cells,2)

9. Click OK. 10. Click again on Define Name on the Formulas Tab. 11. Click back in the “Name:” field and type Pounds. 12. In the Refers to section type the following:

=OFFSET(Sheet1!$C$2,COUNTA(Sheet1!$C:$C)-number_of_cells-1,0,number_of_cells,1)

Page 24: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

19

13. Click OK. 14. Click in the chart on the data series itself. 15. In the Formula Bar, edit the formula by substituting the words Date and Pounds

for the data series, as we did in earlier exercises. The formula should read as follows: =SERIES (Sheet1!$C$1,'last number data points.xlsx'!date,'last number data points.xlsx'!pounds,1). (If the file name doesn’t appear when you are doing the exercise – don’t worry about it! - sometimes it appears- sometimes it doesn’t.) If the sheet name does not display then the formula should look like this: =SERIES(Sheet1!$C$1,Sheet1!date,Sheet1!pounds,1) This illustration assumes you used the same sheet name I did!

Now, if you go to row 25 and add a year, month and a quantity of coffee, you will see it display in the chart automatically. Formula Explanation: So, what did we do? The formula for Date is: OFFSET(Sheet1!$A$2,COUNTA(Sheet1!$A:$A)-number_of_cells-1,0,number_of_cells,2) What does this mean? The formula tells Excel to: 1. Start with cell A2 as the anchor.

Page 25: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

20

2. Select and count all the cells in Column A and to subtract the number of cells specified in cell G2 less 1.

▪ The 1 is subtracted so that the title is not a data point. 3. (We told it to move 24 rows -12 -1 =11 rows from A2). 4. The 0 indicates to move over 0 columns (stay in Column A). 5. Display the number of cells to chart as specified in cell G2. 6. Include 2 columns (Column A and Column B).

So to summarize, Excel counted all the cells in Column A containing either text or numbers and determined that there were 24 cells containing values. Excel was told to subtract the 12 cells specified in cell G2 and to also subtract the first cell above the anchor A2 so that the text in the cell does not display in the chart. In other words, move down 11 rows from the anchor cell of A2. Display Column A and column B.

The Pounds series is virtually identical except that we told it to count the cells in Column C and to only display Column C.

Page 26: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

21

Review Exercise – Display 4 Data Points This exercise is similar to the one you just did, however, here we only want the last 4 data points to display. Click on Sheet 2 in Last_Number_Data_Points.xlsx.

The data has already been entered and the chart drawn.

1. Click in cell G2 and type in a 4 (This is an arbitrary number I picked – the last 4 rows

of data will display in the chart) The instructions are below- but try doing it on your own first. The chart below is how it should look when you have completed the exercise. In the answer file, the range names I created, in the Define Name dialog box, were number_of_datapoints, Month and Units.

If you had not entered numbers into the cells in Columns A and B as your first steps, you would have seen an error message at the finish of the last step. This error message would display because you asking the chart to draw a blank; however, as soon as numbers are entered in, the chart accepts the numbers and everything is fine.

2. Click Define Name on the Formulas Tab. 3. Type number_of_datapoints in the “Name:” field and verify that Refers to: shows

cell $G$2. 4. Click OK. 5. Click back on Define Name and in the “Name:” section type Month. 6. In the “Refers to:” section type the following: 7. =OFFSET(Sheet2!$A$2,COUNTA(Sheet2!$A:$A)-number_of_datapoints-

1,0,number_of_datapoints,1) 8. Click OK. 9. Click back on Define Name and in the Name section type Units. 10. In the “Refers to:’ section type the following: 11. =OFFSET(Sheet2!$B$2,COUNTA(Sheet2!$B:$B)-number_of_datapoints-

1,0,number_of_datapoints,1)

Page 27: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

22

12. Click OK. 13. Click in the chart on the data series itself. 14. In the Formula Bar, edit the formula by substituting the words Month and Units for

the data series. 15. The formula should read as follows:

=SERIES (Sheet2!$B$1,'last number data points.xlsx'!month,'last number data points.xlsx'!units,1).

Common Error This exercise was on Sheet2 and that name needs to be reflected in the Series formula. If the file name does not display that is okay – that should not create a problem. Another common error is a typing error when you defined the names. Click on the Name Manager icon to see the defined names if you want to double-check and edit them. Did it work? If you want to look at the answer – you can find it in Last_Number_Data_Points_Answers.xlsx on Sheet2.

Page 28: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

23

Selecting a Beginning and Ending Point for a Series If you have a lot of data that is continually growing and you only need to display portions of the data, this exercise will be helpful. This exercise will show you how to specify a beginning and an ending point that allows Excel to chart everything in between those data points. In this exercise, you will create a chart where the chart’s beginning and ending point is controlled by the user. Open Beginning_End_point.xlsx and select Sheet 1 if necessary.

The data has already been entered for you in Columns A, B and C. The chart has already been created by selecting cells A1.C24.

A text label has been entered in E2 and E3 stating Beginning row and Ending row. We are going to have Excel only chart the data in Rows 14 through and including Row 19 so

1. Enter the number 14 in G2. 2. Enter the number 19 in G3. 3. Click the Formulas Tab and select Define Name.

4. Enter the name begin_row.

Page 29: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

24

5. Click with the mouse in the “Refers to:” section and click on cell G2. 6. Click OK. 7. Click on Define Name in the Formulas Tab. 8. Enter the name end_row in the “Name:” field. 9. Click with the mouse in the “Refers to:” section and click on cell G3. 10. Click OK. 11. Click on Define Name in the Formulas Tab. 12. Enter the text Date in the “Name:” field. 13. Click with the mouse in the “Refers to:” section and type the following

=OFFSET(Sheet1!$A$2,begin_row-2,0,end_row-begin_row+1,2) 14. Click OK. 15. Click on Define Name in the Formulas Tab. 16. Enter Pounds_sold in the “Name:” field. 17. Click with the mouse in the “Refers to:” section and type the following

=OFFSET(Sheet1!$c$2,begin_row-2,0,end_row-begin_row+1,1) 18. Click OK.

You should be seeing a similarity between the last exercise and this one. One last step!

19. Click on the data series in the chart and replace the range $A$2:$B$24 with the word Date and the range $C$2:$C$24 with the named range Pounds_sold.

If you had not entered numbers into G2 and G3 as your first steps, you would have seen an error message at the finish of the last step since you asking the chart to draw a blank however as soon as numbers are entered into G2 and G3 the chart accepts the numbers and everything is fine.

Formula Explanation: So what do those formulas mean? What did we actually do? Pounds_sold is defined as ………….. =OFFSET(Sheet1!$C$2,begin_row-2,0,end_row-begin_row+1,1) Offset: Our anchor is cell C2 where the data begins Row: How many rows to chart? Beginning row -2 = contents of G2 minus 2 =12 Cols: Don’t move over any columns Height: End row – beginning row +1 =19 -14 +1 means include 6 rows Width: 1 column should be included

In English this means, start charting 12 rows from the anchor cell which is A2 so the chart begins at Row 14 and include 5 rows so the chart includes data from Rows 14 through and including Row 19.

Page 30: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

25

The date series is just a bit different in that the width is 2 since the chart includes both Column A and Column B data. =OFFSET(Sheet1!$A$2,begin_row-2,0,end_row-begin_row+1,2)

Page 31: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

26

Review Exercise -Beginning and Ending Point In this Review Exercise, set up the chart so that the data series contains the beginning and ending points specified by the user which, in this case, is the 3rd through and including the 7th data point.

Try it on your own, but the steps are below if you get stuck. In the answer file, I used start_row, last_row, shipdate and unitsshipped in the Name>Define dialog box. Be careful – This sheet is NOT called Sheet 1.

Click on the 2nd sheet in Beginning_End_Point.xlsx which is called Practice.

The data has already been entered and the chart drawn. 1. Enter the number 3 in F1. 2. Enter the number 7 in F2. 3. Click the Formulas Tab and select Define Name. 4. Enter the name start_row in the “Name:” field. 5. Click with the mouse in the “Refers to:” section and click on cell F1. 6. Click OK. 7. Select Define Name. 8. Enter the name last_row in the “Names:” field. 9. Click with the mouse in the “Refers to:” section and click on cell F2. 10. Click OK. 11. Select Define Name. 12. Enter the name shipdate in the “Name:” field. 13. Click with the mouse in the “Refers to:” section and type the following

=OFFSET(Sheet1!$A$2,start_row-2,0,last_row-start_row+1,1) 14. Click OK. 15. Select Define Name. 16. Enter the name unitsshipped in the “Name:” field. 17. Click with the mouse in the “Refers to:” section and type the following

=OFFSET(Practice!$B$2,start_row-2,0,last_row-start_row+1,1) 18. Click OK. 19. Click on the data series in the chart and replace the range $A$2:$A$23 with the

word Shipdate and the range $B$2:$B$23 with the named range unitsshipped.

Your chart should look similar the one below when you are finished.

Page 32: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

27

Common Errors Remember the sheet I used was named Practice. If the file name does not appear in your formula that is okay. The other common errors are inadvertently leaving a $ in or deleting an exclamation point ! which separates the sheet name from the cell reference.

Below is a screenshot of Name Manager and the different formulas used in this workbook.

Page 33: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

28

Scroll Bars and Spinners

I thought you might want a break from the formulas. A spinner is a button that is linked to a given cell. As you click the spinner button the value of the linked cell changes and you can see the impact of these changes. Adding a scroll bar or a spinner is nice particularly if you have different people updating your chart or if they are not really familiar with Excel or charts. It is also handy to have for presentations. In the example below, we are going to create a spinner button for the exercise we just went through so that someone doesn’t have to type in the beginning cell number. Instead, they can click on the spinner to select the beginning cell number. How interactive is that?

Create a Spinner First, we need to access the spinner control which is not immediately visible in a standard installation. If you do not see the Developer tab on the Ribbon then we need it to display.

1. Click File 2. Click Options

3. Click Customize Ribbon

4. In the Customize the Ribbon list box , ono Main Tabs, check Developer

checkbox

5. Click OK.

Click the File button and then click Options.

Click Customize Ribbon.

Page 34: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

29

When you look at the Ribbon you should now see the Developer tab. The Developer

tab is also used extensively when creating macros.

Open Spinner.xlsx and click on Sheet1. (This worksheet contains the same data as the last exercise in case you think your eyes are playing tricks on you.) 1. On the Developer Tab, in the Controls group, click Insert.

2. Under Form Controls, click the Spin button (Form Control)- the 4th icon on the top

row. 3. Let up on the mouse button and move your mouse to cell Q1.

Page 35: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

30

(Your mouse should have a small + attached to it) 4. Click and drag to make a box. Make the spinner box as large or small as you would

like. You can always resize it.

5. Right-click the spinner and select Format Control. 6. Select a minimum value (let’s pick 3). 7. Select a maximum value (let’s pick 23).

(Max. value allowed is 30,000) 8. Set an increment if you wish. 9. Click in the cell link field and then type in G2 or select it with your mouse.

10. Click OK. 11. Click in a cell in the worksheet so that the spinner is no longer selected. 12. Now click on the top or bottom spinner arrow and you should see the value in

cell G2 change and also see the chart change. If you have any problems, look at cell M1 and M3 and you will see a spinner button that I created for the beginning row and for the end row.

Page 36: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

31

Page 37: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

32

Scroll Bar You can also use a scroll bar icon instead if you prefer to scroll. The scroll bar is also located on the Developer tab and the steps are essentially the same as for the spinner.

Page 38: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

33

Linking Title Text to a Cell We are basically done but I wanted to add one last item in case you weren’t already aware of it. This is quick and easy- and while not exactly interactive it allows for easier updates of chart titles. Open Linking_Title.xlsx and select Sheet 1.

I already created the chart and included the chart title. 1. Click on the title in the chart. 2. Click in the Formula Bar and type an = 3. Click in the cell that contains the text you want for your title. In this case, select cell

A2. 4. Press Enter or click the checkmark on the Formula Bar.

Whatever text is in cell A2 will appear as the chart title. I told you that this one was easy! If you change your title in A2, it will automatically update in the chart. Key: If your chart does not have a title, you need to create one first before you can link the title to a cell.

Page 39: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

34

Page 40: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

35

Review Questions – Section 3

1. The maximum value allowed on a spinner is ____. A. 3 B. 300 C. 3,000 D. 30,000

2. To link a title into the chart, you must type an = _____________. A. In the text box B. In the formula bar C. In the chart D. In the name box

Page 41: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

36

Feedback Answers to Review Questions Feedback to Review Questions – Section 1 1. Which of the following is TRUE?

A. You can use a range name more than once in a workbook. B. A Range name can be created multiple times in a worksheet. C. You cannot create a range name at the worksheet level. D. You cannot create a range name at the workbook level. A is correct. Starting with Excel 2007, you can create and use a range name at the workbook level which is the default but you can also create and use it at the sheet level. Personally, I don’t recommend using the sheet level but you can if you want. B is incorrect. A range name cannot be created multiple times in a worksheet- Excel would not know how to apply it if multiple ranges were named the same thing. C is incorrect. You can create a range name at the workbook level in all versions of Excel. D is incorrect. You can create a range name at the worksheet level since the Excel 2007 version.

2. Range names ___________ A. Can contain spaces. B. Can begin with a number. C. Cannot contain more than 10 characters D. Can contain underscores A is incorrect. Range names cannot contain spaces. B is incorrect. Range names cannot begin with a number. C is incorrect. Range names can contain more than 10 characters. D is correct. Range names can contain underscores. Total_Revenue would be an acceptable range name.

3. Named ranges are

A. Relative references. B. Absolute references. C. Mixed references. D. Static references. A is incorrect as a relative reference always moves or adjusts based upon the dictates of the spreadsheet. B is correct. An absolute cell reference is a cell reference that does not move or adjust regardless of other changes in the spreadsheet which is why a named range is absolute – so it will always refer back to the specified cells. C is incorrect. A mixed reference is one where only part of the cell reference remains static. D is incorrect as there is no such thing as a static reference.

4. Each SERIES formula represents a _____________ A. Data point in the chart. B. Data series in the chart. C. A column chart. D. A series of lines. A is incorrect. A data point is only a single point in a data series so while the data point is reflected in the SERIES formula it does not represent it.

Page 42: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

37

B is correct. The formula represents a data series in the chart. The data series is comprised of data points. C is incorrect. The SERIES formula represents a series of data and can be represented in any type of chart. It does not have to be a column chart. D is incorrect. The SERIES formula represents a data series in a chart and is not required to be in specific chart type.

Feedback to Review Questions – Section 2 1. In the OFFSET formulas using $A:$A tells Excel to extract the data

A. From cell A1. B. From the Column A. C. From the Row A. D. From Column AA. A is incorrect. If you wanted to reference the first cell in Column A, you would reference A1. B is correct. Using the absolute A references tells Excel to select all of Column A even if copied elsewhere. A:A would also have worked. C is incorrect. There is not Row A. Rows are numbers and columns are letters. D is incorrect as we used $A:$A and not $AA:$AA which is column A not column AA.

2. The most common error that people tend to make when creating interactive charts is leaving in the __ when replacing the data series with a named range. A. $ B. ! C. * D. # A is correct. Leaving $ in is a common error when replacing the data series with a named range. B is incorrect. The EBook identifies the 3 most common errors and leaving $ in when replacing the formula is one of them. Omitting the exclamation point, which separates a sheet name from a cell reference, can be an error but it is not the most common error. C. is incorrect. Asterisks are not accepted by Excel in formulas except as a multiplication step and has no place in this discussion D. is incorrect. Excel would not accept a # in a function.

3. Which function counts both text and numbers? A. COUNTBLANK B. COUNTIF C. COUNT D. COUNTA A is incorrect. COUNTBLANK only counts blank cells. B is incorrect. COUNTIF counts a specified criteria. C is incorrect. COUNT counts only numbers. D is correct. COUNTA counts both text and numbers.

4. Cell A1 contains the value of 10 and Cell A2 contains the value CPA. If you used the COUNT function, your answer would be __. A. 0

Page 43: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

38

B. 1 C. 2 D. 10 A is incorrect. Since there is a number in one the cells, a zero would not be returned. B is correct. There is only one number in the cells and COUNT only counts numbers. C is incorrect. COUNT does not count text so it would ignore the value in A2 when counting. D is incorrect. The total value of the cells is 10 however that is summing – not counting.

5. Cell A1 contains the value of 10 and Cell A2 contains the value CPA. If you used the COUNTA function, your answer would be _________. A. 0 B. 1 C. 2 D. 10 A is incorrect. There are values in the cells so the answer cannot be 0. B is incorrect. COUNTA counts both text and numbers so it would count both entries not just one. C is the correct answer. COUNTA counts both text and numbers so it would count both values. D is incorrect. The total value of the cells is 10 however that is summing – not counting.

6. The sheet name and the range name are separated by a/an ___________.

A. Exclamation point B. Comma C. Quotation marks D. Semi colon A is correct. The exclamation point is always used to separate the sheet name and the range name or cell reference. B is incorrect. Excel would not recognize a comma in the formula there. You would receive an error message. C is incorrect. Quotations are typically used to differentiate text. D is incorrect. Excel would not recognize a semi colon in the formula there. You would receive an error message.

Feedback to Review Questions – Section 3

1. The maximum value allowed on a spinner is ____.

A. 3 B. 300 C. 3,000 D. 30,000 A is incorrect. A spinner’s maximum value is greater than 3. B is incorrect. A spinner’s maximum value exceeds 300. C is incorrect. A spinner’s maximum value exceeds 3,000. D is correct. The maximum value allowed on a spinner is 30,000. This unfortunately can limit the use of a spinner.

Page 44: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

39

2. To link a title into the chart, you must type an =

A. in the text box. B. in the formula bar. C. in the chart. D. in the Name box.

A is incorrect. If you type an = into the text box, then the equal sign will just be displayed B is correct. You are linking the contents of a cell to the title so in effect you are creating a formula and so need to type the = in the formula bar so Excel recognizes what you are doing. C is incorrect. You cannot type directly onto the chart as it is a graphical object. D is incorrect. You cannot link a title to a chart by typing in the Name box.

Page 45: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

40

Glossary

Absolute Cell Reference A cell address that contains a dollar sign ($) in the row or column coordinate, or both. When you enter a cell reference in a formula the cell remains static. The cell does not change if the formula containing it is copied or moved.

Interactive Chart A chart that reflects a growing data set or a chart that shows only part of a data. This is considered synonymous with Dynamic Chart. Range Name A name is assigned to a cell or group of cells in a spreadsheet. A named range can be used to identify the cells used in charts, functions and formulas. Relative Cell Reference The default cell address. The cell address when referenced in a formula will adjust as the formula is moved or copied elsewhere. Scroll bar A bar that can be either horizontal or vertical. The bar contains a box that is clicked and dragged up, down, left, or right in order to see parts of the screen Spinner A spinner is a box added to a worksheet that is linked to a cell which can return a numeric value

Page 46: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

41

Index

Absolute references ..................................................................................................................................6, 36

Common Error ...............................................................................................................................................22

Common Errors .............................................................................................................................................27

Controlling Data ............................................................................................................................................18

Count .............................................................................................................................................................. 8

COUNTA .................................................................................................... 8, 9, 10, 12, 14, 18, 19, 21, 38, 44

COUNTBLANK ................................................................................................................................................. 8

COUNTIF ......................................................................................................................................................... 8

CPE Credit ....................................................................................................................................................... 5

Display the last x data points ......................................................................................................................18

Form Controls ................................................................................................................................................29

Link Title ........................................................................................................................................................33

memory .........................................................................................................................................................11

Name Manager .............................................................................................................................. 5, 10, 13, 22

offset .........................................................................................................................................................7, 11

OFFSET ................................................................................. 4, 1, 7, 8, 9, 10, 14, 18, 19, 21, 24, 25, 26, 37, 44

range name ............................................................................................................ 1, 2, 6, 9, 11, 12, 13, 36, 42

Relative references ....................................................................................................................................6, 36

Review Exercise ...................................................................................................................... 5, 15, 16, 21, 26

Scope ...........................................................................................................................................................4, 9

scroll bar ........................................................................................................................................................28

Selecting a Beginning and Ending Point .......................................................................................................23

Series formula........................................................................................................................................ 3, 4, 12

spinner ...........................................................................................................................................................28

Student Data Files ........................................................................................................................................... 5

Page 47: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

42

Creating Dynamic & Interactive Charts – Final Exam

Please select the single best answer.

1. By default, Excel references are _____cell references. A. Relative B. Absolute C. Mixed D. Static

2. If you wanted to create an efficient formula to show the sales of the East region as a

percentage of the total and then copy it down for the other regions, what should the denominator be?

A. 238 B. B6 C. $B$6 D. 50

3. ___ would be considered an absolute cell reference.

A. B$1 B. $B$1 C. B1 D. $B1

4. ___ would be considered a relative cell reference.

A. B$1 B. $B$1 C. B1 D. $B1

5. A range name allows you to name ____________.

A. A file

Page 48: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

43

B. A cell or a range of cells C. A sheet D. A workbook

6. To define a name in Excel you would select the ___ Tab and then select Define Name.

A. Formulas B. Data C. Developer D. Review

7. The default scope for a range name is _____________.

A. Workbook B. Sheet C. Chart D. Cell

8. Which of the following is an acceptable range name?

A. Cost of Goods B. Cost_of_Goods C. 2020CGS D. CostofGoods$

9. If you wanted to edit or delete a range name that you created, you would want to go to the

____. A. Name Manager B. RANGE NAME Manager C. Developer Tab D. You cannot edit or delete a range name once it has been created

10. Which of the following would be correct based upon the screen shot below?

A. =CountA(A1.A3)=0 B. =CountA(A1.A3)=1 C. =CountA(A1.A3)=2 D. =CountA(A1.A3)=3

11. If you wanted to count only numbers, in a worksheet, you would use the ___function.

A. COUNT B. COUNTA C. COUNTB D. COUNTIF

Page 49: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

44

12. If you click on a data series in a chart, what formula will display on the formula bar? A. RANGE B. COUNT C. CHART D. SERIES

13. A SERIES formula is _____________.

A. A defined name B. A formula that displays data in a chart C. A function D. A macro

14. The _________function is not very well known but it is extremely powerful.

A. COUNT B. SERIES C. OFFSET D. COUNTA

15. In two exercises you named input cells (for example, we named G2 as begin_row.) What

was the advantage of naming it? A. The worksheet looks prettier. B. If the cell is moved, Excel can still find it. C. All cells have to be named. D. For documentation purposes.

16. If you want your OFFSET formula to select an entire column, such as Column B, you would

use the which of the following in the formula? A. B B. B1:B3650 C. $B:$B D. ColumnB

17. The following syntax belongs to what function: =________(reference,rows,cols) A. COUNT B. COUNTA C. OFFSET D. SERIES

18. The spinner control is found on the ____tab.

A. Form B. Design C. Developer D. Form Control

19. If you wish to create a scroll bar, you need to access the ___________. A. Insert tab B. Chart tab

Page 50: Create Dynamic and Interactive Charts

Create Dynamic and Interactive Charts

45

C. Developer tab D. Form tab

20. The trick to linking a chart title text to a cell is ______________.

A. To create the title first before trying to link it B. To use the Link function C. To use the Paste Special command D. To use the Paste Link command