Dynamic Chart Switcher

4,502 views
4,351 views

Published on

Illustrated tutorial on how to create a dynamic chart in Microsoft Excel 2007

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,502
On SlideShare
0
From Embeds
0
Number of Embeds
145
Actions
Shares
0
Downloads
74
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Dynamic Chart Switcher

  1. 1. Dynamic Chart with Dropdown List Control<br />February 18, 2011<br />
  2. 2. Overview<br />We will create a chart in Microsoft Excel that updates automatically based on a selection from an in-cell dropdown list<br />This chart will function based on quarterly figures as its data source<br />The main purpose is to show users the dynamic functionality of Microsoft Excel without using macros<br />Copyright © 2011 Techronology. All rights reserved.<br />
  3. 3. Quick Glance<br />The components<br />Dropdown selection list<br />Categories and data<br />Dynamic chart<br />The idea<br />To be able to change the chart's data source based a user's selection<br />Again, we will not show you how to create the dropdown list itself, which is covered in a separate lesson<br />Copyright © 2011 Techronology. All rights reserved.<br />
  4. 4. Requirements<br />Microsoft Excel 2007<br />You may be able to apply the instructions in this tutorial to other versions of Microsoft Excel<br />Optional<br />Check out the tutorials below on creating dropdown lists in Microsoft Excel(We will not cover the creation of dropdown lists in this tutorial)<br />Copyright © 2011 Techronology. All rights reserved.<br />Tutorial Links<br />http://www.slideshare.net/techron/incell-interactivity-dropdown-box-in-excel<br />http://www.techronology.com/index.php?pageID=007002&lessonID=excel0001&lessonType=pres<br />
  5. 5. Get the Data Ready<br />This data refers to the amount of money spent on business supplies and stationary for a particular business<br />Below is the data you should use in this lesson<br />Copyright © 2011 Techronology. All rights reserved.<br />We have our data organized in cells D5 to H8, as shown below<br />
  6. 6. Enter the Data<br />Enter the data (in cells D5 to H8) for your chart using the same numbers as below<br />Copyright © 2011 Techronology. All rights reserved.<br />
  7. 7. Create the In-cell Dropdown List<br />In cell B6, create an in-cell dropdown list with four choices<br />1st Quarter<br />2nd Quarter<br />3rd Quarter<br />4th Quarter<br />Copyright © 2011 Techronology. All rights reserved.<br />
  8. 8. Select Your Data and Prepare to Create Chart<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Select cells D5 to E8, which will serve as your initial data for your chart<br />Click on the Insertmenu<br />2<br />2<br />
  9. 9. Create a Standard Pie Chart<br />Click on the Pie icon<br />Click on the first pie icon in the 2-D Pie section<br />Copyright © 2011 Techronology. All rights reserved.<br />
  10. 10. Chart Display<br />You can move the chart around, resize it, etc., but it is time to make the chart more dynamic<br />Now that the chart is created, let's make some named ranges that will work with the chart<br />Copyright © 2011 Techronology. All rights reserved.<br />
  11. 11. Create the Named Ranges for First Two Quarters<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Select cells E6 to E8<br />Type qtrData1 in the Name Box and press Enter<br />Select cells F6 to F8<br />Type qtrData2 in the Name Box and press Enter<br />We cover named ranges in a previous tutorial, which is listed on the Requirements page in the beginning of this tutorial<br />2<br />2<br />
  12. 12. Finish Creating the Named Ranges<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Select cells G6 to G8<br />Type qtrData3 in the Name Box and press Enter<br />Select cells H6 to H8<br />Type qtrData4 in the Name Box and press Enter<br />2<br />2<br />
  13. 13. Test the Dropdown List<br />We now want to supply a number based on the user's selection<br />Below are the index values we want to use for the dropdown list<br />1st Quarter = 1<br />2nd Quarter = 2<br />3rd Quarter = 3<br />4th Quarter = 4<br />So, when a user selects 3rd Quarter, for example, the value 3 should be applied<br />Copyright © 2011 Techronology. All rights reserved.<br />
  14. 14. Match Up Your Choice<br />Type the formula shown above in cell B8 and press Enter<br />The MATCH function searches for a specified item in a range and then returns the relative position of that item in the range<br />In our case, the range is {"1st Quarter","2nd Quarter","3rd Quarter","4th Quarter"}<br />Copyright © 2011 Techronology. All rights reserved.<br />
  15. 15. Our Match Formula Breakdown<br />Copyright © 2011 Techronology. All rights reserved.<br />=MATCH($B$6,{"1st Quarter","2nd Quarter","3rd Quarter","4th Quarter"},0)<br />This is the value in cell B6 we want to lookup<br />These are the range of values to check B6 against<br />The zero value in MATCH looks for an exact match<br />The final result should be 1, 2, 3, or 4 in cell B6<br />If a match cannot be found, an error is displayed<br />Our dropdown list should only allow the values listed in the match range; therefore, an error should not occur<br />
  16. 16. Creating the Series Names from User Selections<br />We can now append the number produced in B6 to the text "qtrData"<br />For example, if the user selects "2nd Quarter" then B6 will equal 2 and the text "qtrData" will become "qtrData2"<br />Below are the text values that we want to create based on the user selection<br />1st Quarter = "qtrData1"<br />2nd Quarter = "qtrData2"<br />3rd Quarter = "qtrData3"<br />4th Quarter = "qtrData4"<br />Copyright © 2011 Techronology. All rights reserved.<br />
  17. 17. Test the Series Text Name<br />In cell B9, enter the follow formula (including the quotations)…<br />="qtrData"&B8<br />…which will produce qrtData1, qrtData2, qrtData3, or qrtData4<br />Copyright © 2011 Techronology. All rights reserved.<br />Remember, cell B8 is the same as…<br />=MATCH($B$6,{"1st Quarter","2nd Quarter","3rd Quarter","4th Quarter"},0)<br />
  18. 18. Finalize Series Name<br />In cell B10, combine cell B8 and B9 using the following formula…<br />="qtrData"&MATCH($B$6,{"1st Quarter","2nd Quarter","3rd Quarter","4th Quarter"},0)<br />This will become our master named range for the chart series<br />Copyright © 2011 Techronology. All rights reserved.<br />
  19. 19. Get the Formula for the Series Name<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Click on cell B10<br />Press function key 2 (F2) to go into edit more<br />Select all the text, including the equal sign<br />Press Ctrl-C to copy the formula<br />Or…<br />Select and copy the formula from the formula toolbar<br />2<br />2<br />
  20. 20. Create the Series Named Range<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Click Formulas from the menu<br />Click Define Name from the Formulas ribbon<br />Type seriesData as the Name<br />Paste in the formula you copied from cell B10 to the Refers to box<br />Press Enter or click OK<br />You may need to try this twice or type in the formula directly to get use to the procedure<br />2<br />2<br />
  21. 21. Make the New Range Name an Indirect Range<br />Open the Name Manager by pressing Ctrl-F3 or by clicking Name Manager from the Formulas ribbon (see previous page)<br />Click on seriesData<br />In the Refers to box, enclose everything in parenthesis<br />Before the first parenthesis, type INDIRECT <br />See the complete formula below<br />Copyright © 2011 Techronology. All rights reserved.<br />=INDIRECT("qtrData"&MATCH(Sheet1!$B$6,{"1st Quarter","2nd Quarter","3rd Quarter","4th Quarter"},0))<br />
  22. 22. INDIRECT Function Note<br />INDIRECT returns the reference specified by a text string. References are immediately evaluated to display their contents. Use INDIRECT when you want to change the reference to a cell within a formula without changing the formula itself.<br />Copyright © 2011 Techronology. All rights reserved.<br />
  23. 23. Apply Your New Range Name to the Chart<br />Right-click on a white area on the chart to view the shortcut menu<br />Click Select Data from the shortcut menu<br />You can also click on the chart, select Design from Chart Tools, and click on the Select Data icon<br />Copyright © 2011 Techronology. All rights reserved.<br />
  24. 24. Create New Data Source<br />Copyright © 2011 Techronology. All rights reserved.<br />1<br />1<br />Click on 1st Qtr and then click the Edit option<br />Under Edit Series, type Sheet1!seriesData in the Series values box<br />Press Enter or click OK<br />Basically, what you are doing is typing the name of your sheet, the exclamation point, and the named range<br />If your sheet's name is not "Sheet1" replace "Sheet1" with the name of your sheet<br />2<br />2<br />
  25. 25. Test Your Chart<br />Now when you select an option from the dropdown, the chart will update automatically according to your selection<br />On the other hand, the series name or title will not change because you did not create a dynamic range name for them yet<br />You really do not need to unless you plan on displaying a chart or series title<br />Simply click on the chart title and press delete<br />Copyright © 2011 Techronology. All rights reserved.<br />
  26. 26. End Notes<br />You can now delete the contents of the test cells (B8, B9, and B10)<br />This technique can work with almost any kind of chart<br />Once you get really good, you can create charts that automatically adjust to the size of a range<br />You can get the supporting Microsoft Excel file from the following site:<br />http://www.techronology.com/products.php?prodID=less002<br />Copyright © 2011 Techronology. All rights reserved.<br />
  27. 27. www.techronology.com<br />

×