Wordman s Production Corner

Similar documents
Explore commands on the ribbon Each ribbon tab has groups, and each group has a set of related commands.

MODULE VI: MORE FUNCTIONS

VBA Excel 2013/2016. VBA Visual Basic for Applications. Learner Guide

Excel Advanced

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

2. create the workbook file

My Top 5 Formulas OutofhoursAdmin

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

This chapter is intended to take you through the basic steps of using the Visual Basic

Customizing the Excel 2013 program window. Getting started with Excel 2013

Microsoft Excel 2013 Unit 1: Spreadsheet Basics & Navigation Student Packet

Excel Select a template category in the Office.com Templates section. 5. Click the Download button.

Microsoft Excel 2010 Basics

ACCT 133 Excel Schmidt Excel 2007 to 2010 Conversion

Chart For Dummies Excel 2010 Title Link To Cell Value Into

2013 INTERMEDIATE MANUAL

Excel VBA. Microsoft Excel is an extremely powerful tool that you can use to manipulate, analyze, and present data.

Free ebooks ==>

MicroStrategy Desktop

KNACK TRAINING. MICROSOFT OFFICE: TIPS & TRICKS FOR EFFICIENCY

Speakers 8/5/2011. Presented by Donna Payne, CEO Tara Byers, VP of Development Susan Horiuchi, VP of Training

EXCEL 2007 GETTING STARTED

DOWNLOAD PDF MICROSOFT EXCEL ALL FORMULAS LIST WITH EXAMPLES

Excel 2013 Intermediate

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and

Ms Excel Vba Continue Loop Through Worksheets By Name

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL

Excel 2013 Getting Started

Advance Excel Performing calculations on data 1. Naming groups of data 2. Creating formulas to calculate values

Transitioning to Office 2010 from Office 2007

Rev Up to Excel 2010

2013 ADVANCED MANUAL

Working with Excel CHAPTER 1

Ms Excel Vba Continue Loop Through Range Of

Getting the Most from your Microsoft Excel

Manual Calculation Definition Excel 2010 Vba Set

Macros enable you to automate almost any task that you can undertake

ITS Training Class Charts and PivotTables Using Excel 2007

Reference Services Division Presents. Excel Introductory Course

Microsoft Excel 2010 Level III

Working with Excel involves two basic tasks: building a spreadsheet and then manipulating the

You can record macros to automate tedious

ADVANCED EXCEL Course Modules for Advance Excel Training Online (MS Excel 2013 Course):

Instructions for creating and modifying queries will be available in the future.

Chapter 13. Creating Business Diagrams with SmartArt. Creating SmartArt Diagrams

download instant at

Chart Wizard: Step 1 (Chart Types)

Lesson 1: Exploring Excel Return to the FastCourse Excel 2007 Level 1 book page

course notes quick reference guide

Contents Part I: Background Information About This Handbook... 2 Excel Terminology Part II: Advanced Excel Tasks...

Preview from Notesale.co.uk Page 2 of 61

Microsoft Excel 2010 Step-by-Step Exercises PivotTables and PivotCharts: Exercise 1

Empower and invest in yourself WORKBOOK MICROSOFT EXCEL INTERMEDIATE

Microsoft Office Excel

5. Excel Fundamentals

Module Five: Customizing Excel

Excel 2013 Essentials Syllabus

1 Introducing Charts in Excel Customizing Charts. 3 Creating Charts That Show Trends. 4 Creating Charts That Show Differences

Starting Excel application

Microsoft Excel 2007

Microsoft Excel 2010 Training. Excel 2010 Basics

TRAINEE WORKBOOK. Atlas 5.0 for Microsoft Dynamics AX 2012 Reporting system

At least one Charley File workbook for New Excel. This has an xlsx extension and is for PC Excel 2007, Mac Excel 2008, and after.

Excel 2013 Intermediate

Excel 2010 Charts and Graphs

Ms Excel Vlookup Tutorial 2003 Pdf 2007 Complete

Information Technology and Media Services. Office Excel. Charts

Introduction to macros

Gloucester County Library System. Excel 2010

Macros enable you to automate almost any task that you can undertake

COMP1000 / Spreadsheets Week 2 Review

Microsoft Excel 2007 Macros and VBA

Basic Microsoft Excel 2007

Lesson 1: Exploring Excel Return to the Excel 2007 web page

Introduction to Microsoft Office 2007

MICROSOFT EXCEL KEYBOARD SHORCUTS

Microsoft How to Series

<excelunusual.com> Creating, Sizing, Translating and Rotating 2D Shapes in Excel by George Lungu. < 1

Mastering the Actuarial Tool Kit

Table of Contents Data Validation... 2 Data Validation Dialog Box... 3 INDIRECT function... 3 Cumulative List of Keyboards Throughout Class:...

Intermediate Excel 2013

Excel Template Instructions for the Glo-Brite Payroll Project (Using Excel 2010 or 2013)

Make it a Great Day at the Office: Essential Tips and Tricks for Office 2013 and Outlook 2013

lab MS Excel 2010 active cell

Microsoft Excel - Macros Explained

Workbooks (File) and Worksheet Handling

Study Guide. PCIC 3 B2 GS3- Key Applications-Excel. Copyright 2010 Teknimedia Corporation

Candy is Dandy Project (Project #12)

Excel 2. Module 3 Advanced Charts

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. < 1. Introduction: Chart naming: by George Lungu

Advanced Excel. IMFOA Conference. April 11, :15 pm 4:15 pm. Presented By: Chad Jarvi, CPA President, Civic Systems

MS Excel Advanced Level

Introducing Microsoft Office Specialist Excel Module 1. Adobe Captivate Wednesday, May 11, 2016

Sample Chapters. To learn more about this book, visit the detail page at: go.microsoft.com/fwlink/?linkid= Copyright 2010 by Curtis Frye

Excel Intermediate. Click in the name column of our Range of Data. (Do not highlight the column) Click on the Data Tab in the Ribbon

Become strong in Excel (2.0) - 5 Tips To Rock A Spreadsheet!

The Foundation. Review in an instant

VIDYA SAGAR COMPUTER ACADEMY. Excel Basics

Gloucester County Library System EXCEL 2007

Table of Contents COPYRIGHTED MATERIAL. Introduction Book I: Excel Basics Chapter 1: The Excel 2013 User Experience...

Transcription:

Wordman s Production Corner By Dick Eassom, AF.APMP Three Excel Tricks...Just for a Change Three Problems One of my colleagues has the good fortune to have to manage marketing mailing lists. Since the address fields are in separate columns on an Excel worksheet, she needs a simple way of combining these fields into one address field, and then exporting the combined address to another workbook. What s the best way to do this? Another colleague wants to add stop light formatting to column cells in an Excel worksheet. Excel 2003 s Conditional Formatting feature colors the cells according to their value, but he would prefer something more visually attractive, such as a colored circle, i.e. a true stop light. However, he s finally upgraded from Office 2003 to Office 2007, so can the new version help him? I m a big fan of Farmville; some would say an addict. If you haven t heard of this game, then you re probably not on Facebook. With more than 75 million players worldwide, Farmville, by Zynga Game Network, Inc., is one of the fastest growing social media games, allowing Facebook users to manage a virtual farm. Part of the tactics of Farmville is deciding which crops to plant. Each type of crop takes a different amount of time to grow before it can be harvested, provides a different profit margin, and different experience points or XPs. To advance in the game, you need more XPs, but also the cash to generate them. That s probably more about Farmville than you cared to know, but I set myself the task of finding out which crops provide the most XPs per hour at the most profit per hour. Having collected the data, I created an Excel X-Y scatter plot to show my results. But how can I get each value to display the crop name? It appears there is no way to do this! Three Solutions Concatenating Address Fields A typical address list might have these columns in an Excel worksheet: APMP Perspective 30 Volume 20, Issue 1, 2010

Here s a typical address: Address 1 4695 MacArthur Court Address 2 8th Floor Address 3 City Newport Beach State CA Post Code/ZIP 92660 Country USA Whereas you can add the numeric values of cells in a worksheet using the + operator, or the SUM function, joining text values, or concatenating, is done using the & operator. So if we use column H for the combined address, we could use the formula: The logical_test is evaluated as True or False, and we can use the LEN function to test if there is any text in the Address 2 or Address 3 fields. If there is text (LEN(Cell)>0), we ll add a comma and a space (, ), otherwise we ll add nothing ( ). So our formula now becomes: =A4&, &IF(LEN(B4)>0,B4&,, )&IF(LEN(C4)>0,C4&,,, )&D4&, &E4&, &F4&, &G4 Using this, our formula returns 4695 MacArthur Court, 8th Floor, Newport Beach, CA, 92660, USA You can copy this formula into all your address rows in your worksheet. But if we try and copy the composite address column to another worksheet, it will just copy the formulas, so make sure to use Paste Values: =A4&B4&C4&D4&E4&F4&G4 Using our typical address above, the resulting value in column H will be: 4695 MacArthur Court8th FloorNewport BeachCA92660USA We need some commas and spaces to make this usable, so now our column H formula becomes: =A4&, &B4&, &C4&, &D4&, &E4&, &F4&, &G4 Better, but still not perfect. Since there is no Address 3 value, our formula is going to return: 4695 MacArthur Court, 8th Floor,, Newport Beach, CA, 92660, USA Excel 2007 Conditional Formatting You ve probably used Excel s conditional formatting feature at some time to automatically color cells depending on their value. Let s take a simple example: a group of cells with the values 1 through 10: We need to consider that there may not be an Address 2 or Address 3 field, and we can do that using the Excel IF and LEN functions. The general form of the IF function is: =IF(logical_test,[value_if_true],[value_if_false]) APMP Perspective 31 Volume 20, Issue 1, 2010

To apply conditional formatting in Excel 97-2003, select the range (A1:J1), and then click Format > Conditional Formatting. In the Conditional Formatting dialog, we can add up to three levels, e.g. color cells green for values between 8 and 10, yellow for cell values between 4 and 7 and red for cell values from 1 to 3: Excel 2010, which will be released this year, has a further feature, called sparklines, intense, simple, word-sized graphics, as their inventor Edward Tufte describes them in his book Beautiful Evidence (available on Amazon at http://www.amazon.com/beautiful- Evidence-Edward-R-Tufte/dp/0961392177). Here s an example, taken from the official blog of the Microsoft Excel product team (http://blogs.msdn.com/excel/archive/2009/07/17/sparklines-inexcel.aspx): However, Excel 2007 gives us many more options! Select the cells and click Conditional Formatting on the Home tab: Sparklines are not floating charts but appear like text in a cell. Personally, I can t wait to use them! Adding Labels to Scatter Plots Here s a sample of the data from the Farmville game: There are some very cool options under Data Bars, Color Scales and Icons Sets that certainly solve my colleague s problem as stated in my introduction to this article. As there are so many rich formatting options here, I suggest you take some time to explore them yourself! However, here are a few ideas: I wanted to plot the last two columns against each other as an X-Y, or scatter, chart. The crops at the top right of the chart offer the best return on investment for both profit and experience points. I would like the first column to be the label for each point, obviously. Selecting the K and L columns and inserting a scatter chart displays the data the way I wanted to see it, but APMP Perspective 32 Volume 20, Issue 1, 2010

Excel gives me no way to add the data in column A as labels without messing up the chart. However, I found a solution in a Microsoft Support article, How to use a macro to add labels to data points in an xy scatter chart or in a bubble chart in Excel, available online at http://support.microsoft.com/kb/213750. Those of you who have been following my Wordman articles know that I m a big fan of using macros to add functionality to Microsoft Office applications. Creating extra functionality using Microsoft Visual Basic for Applications (VBA) within Excel is just as easy as doing it within Word but slightly different. If you ve been following previous Wordman articles about using VBA, you ll remember that when you create a simple macro in Word, it gets stored in your personal Normal.dot; the same file that Word uses to store other customizations such as your toolbar changes. Excel has its equivalent personal file, named personal.xlsb (Excel 2007), or personal.xls (Excel 97-2003). Start Excel. In Excel 2007, if the Developer tab is not displayed on the ribbon, click the Office Button, click Excel Options, and under Popular, check Show Developer tab in the ribbon. Click OK to close the Excel Options dialog. Select the now visible Developer tab and then click Visual Basic (or press Alt+F11) to display the Visual Basic (VB) editor. (In older versions of Excel, go to Tools > Macro > Record New Macro.) If your personal file, e.g. personal.xlsb, is not displayed in the Project pane at the top left of the editor, you ll need to create a dummy macro to create it. To do this, in Excel, on the Developer tab, click Record Macro. In the Record Macro dialog, select Personal Macro Workbook under Store macro in, name the macro Dummy Macro and click OK. Now click Stop Recording on the Developer tab. (In older versions of Excel, click Stop Recording on the Stop Recording toolbar.) In the VB editor Project pane, you ll see that Personal.xlsb has been created. Double click Personal.xlsb to expand it, and then click Modules > Module 1. The empty Dummy Macro has been created. You can now delete this dummy macro and enter the code listing at the end of this article. I ve enhanced the original code posted by Microsoft with some features to make it more robust and to allow you to select the column that contains the data labels. How does it work? After creating some variables to store some data, we ll need during code execution, the first part of the code checks that we ve selected the chart before we run the macro. Next, the code checks that the chart is the correct type, i.e., an X-Y scatter chart. If both those checks pass, then the code gets the formula for the first data series. In my chart, this looks like: =SERIES(Seeds!$M$1,Seeds!$L$2:$L$48,See ds!$m$2:$m$48,1) By using VB s text string manipulation functions (Left, Mid, and Instr), the code parses out the formula until only Seeds!$L$2:$L$48 remains. The code then activates the worksheet containing the data, i.e. Seeds, and displays an input box that allows you to select the column containing the data labels: APMP Perspective 33 Volume 20, Issue 1, 2010

Clicking OK allows the code to continue. It calculates the offset of the data label column from the data column, activates the chart, and then applies the relevant data label to each data point in the chart. Below is the final result, showing that I should plant blackberries for best return on investment, assuming I could play FarmVille 24 hours per day! (I ve added a white background to the data labels and moved some to make the chart clearer.) Since we ve saved the code in your personal macro storage, you can call this macro at any time by clicking Macros on the Developer tab, selecting PERSONAL. XLSB!AttachDataLabels in the Macro dialog, and then clicking Run. (In older versions of Excel, go to Tools > Macros > Macro to display the Macro dialog.) Summary I hope you found some useful Excel tips in this Wordman article. I ll be presenting another Wordman workshop at the 21st Annual APMP International Conference & Exhibits at the Walt Disney World Dolphin, in Orlando, Florida, from June 1 4, 2010. As usual, there is no set agenda: please bring your Word problems, and we ll sort them out! We might even have some time for Excel and PowerPoint! You can reach Wordman via Dick Eassom, AF.APMP, at dick.eassom@apmp.org. Wordman is 2001 2010, Dick Eassom, and used with permission by APMP. Thanks to Sean Jones (www.knitestudios.com) for the Wordman artwork. APMP Perspective 34 Volume 20, Issue 1, 2010

Public Sub AttachDataLabels() Dim intpoint Dim strchartname Dim strvals Dim rngdatalabels Dim wkshdata Dim chtchart Dim intcoldata Dim intoffset As Integer As String As String As Range As Worksheet As Chart As Integer As Integer Const c_intrangetype As Integer = 8 Check the chart is active If ActiveChart Is Nothing Then Call MsgBox(Prompt:= Select chart, then run again, _ Title:= Add Data Labels, Buttons:=vbCritical + vbokonly) Exit Sub End If Store chart object Set chtchart = ActiveChart Test if it s a scatter chart with markers Select Case chtchart.charttype Case xlxyscatter, xlxyscatterlines, xlxyscattersmooth Do nothing Case Else Call MsgBox(Prompt:= This is not an scatter chart with markers, _ Title:= Add Data Labels, Buttons:=vbCritical + vbokonly) Exit Sub End Select Store the formula for the first series in strvals strvals = ActiveChart.SeriesCollection(1).Formula Extract the range for the data from strvals strvals = Mid(strVals, InStr(InStr(strVals,, ), strvals, Mid(Left(strVals, _ InStr(strVals,! ) - 1), 9))) strvals = Left(strVals, InStr(InStr(strVals,! ), strvals,, ) - 1) Do While Left(strVals, 1) =, strvals = Mid(strVals, 2) Loop Get column for data intcoldata = Range(strVals).Columns(1).Column Get worksheet name containing data Set wkshdata = Worksheets(Left(strVals, InStr(strVals,! ) - 1)) Get column for data labels. Ignore error if user clicked Cancel On Error Resume Next: Application.DisplayAlerts = False wkshdata.activate Set rngdatalabels = Application.InputBox(Prompt:= Select the data label column, _ Title:= Data Labels, Type:=8) On Error GoTo 0: Application.DisplayAlerts = True Exit if no range returned If rngdatalabels Is Nothing Then Exit Sub Get offset from data to data label columns intoffset = rngdatalabels.columns(1).column - intcoldata Activate the chart, and attach a label to each data point chtchart.activate For intpoint = 1 To Range(strVals).Cells.Count With chtchart.seriescollection(1).points(intpoint).hasdatalabel = True.DataLabel.Text = Range(strVals).Cells(intPoint, 1).Offset(0, intoffset).value End With Next intpoint End Sub APMP Perspective 35 Volume 20, Issue 1, 2010