Se está descargando tu SlideShare. ×

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Cargando en…3
×

1 de 55 Anuncio

# Excel 2003 Training for Business Analysts

An excel couse designed to introduce analysts to useful functions and their combination

An excel couse designed to introduce analysts to useful functions and their combination

Anuncio
Anuncio

Anuncio

### Excel 2003 Training for Business Analysts

2. 2. Introduction • Excel 2003 • Needs to be interactive or will be “Death by Powerpoint” • Many levels of knowledge – no question is stupid © Tim Ward 2009 – all rights reserved
3. 3. Suggested Agenda • Spreadsheet Design • Visual Basic • Think before you build • Introduction • Simple Functions • Recording Macros • Named Ranges • Editing Macros • Navigation • Custom Functions • Toolbars • Formatting • Objects (Pictures etc) • Data Handling • Text Functions • Lookup &Reference Functions • If statements • Nesting Formulae • Error Handling • Pivot Tables © Tim Ward 2009 – all rights reserved
4. 4. Spreadsheet Design “Think before you build” • Questions you should be able to answer • What is the purpose of my spreadsheet? • Who is going to use it? • What are the inputs? • What are the outputs? • Who is the audience for the output? © Tim Ward 2009 – all rights reserved
5. 5. Spreadsheet Design “Think before you build” • Simple rules for good design • Never change imported data • Never link workbooks • create an output sheet and copy it instead • Always have a worksheet for constants • Use named ranges • Try to place input cells on a separate page • Apply consistent formatting always • Develop a team style and be anal about applying it © Tim Ward 2009 – all rights reserved
6. 6. Spreadsheet Design Simple functions • Simplest Function • =A1 • Refers to the value in cell A1 • When copied the reference will change • Fixed references • Use Named range • Use “\$” to fix row or column or both • {F4} cycles between the options • =\$A\$1 – both row and column fixed • =\$A1 – just column fixed • =A\$1 – just row fixed • Try it now © Tim Ward 2009 – all rights reserved
7. 7. Spreadsheet Design Simple functions • Other simple functions: • =SUM() • adds up a range • =COUNT() • counts the number of numbers in a range • =COUNTA() • counts the number of non blank cells in a range • =SUMIF(lookup_range, criteria, sum_range) • Adds up values in a range matching a criteria © Tim Ward 2009 – all rights reserved
8. 8. Spreadsheet Design Named Ranges • Refers to a cell or cells • Can be fixed or relative • Makes formulae easier to read understand • Insert a single name by: • Insert > Name > Define • Insert Multiple Names • Insert > Name > Create • Examples © Tim Ward 2009 – all rights reserved
9. 9. Spreadsheet Design Navigation & Shortcuts • Using the Keyboard is much more efficient than clicking with the mouse, but it is a personal choice… • {Ctrl}+{Space} – select the whole column • {Shift}+{Space} – select the whole row • {Ctrl}+{Arrow Down} – move to last cell in current range in the current column • {Ctrl}+{End}- move to last cell in worksheet • {Ctrl}+{Page Up} – move to worksheet next on right • {Ctrl}+{Page Down} – move to worksheet next on left • {Ctrl}+{Tab} – Cycle through open workbooks • Right Click Button • {Alt}+{Underlined Letters} – Use menu items with keyboard © Tim Ward 2009 – all rights reserved
10. 10. Spreadsheet Design Formatting • How something is presented is at least as important as what is being presented • Formatting may be different for different media • Decide on and use standard formats for: • Font • Borders & Shading • Numbers • Colour Schema • Headings, Details, Totals etc • Never Hide a column or row use Outline Symbols instead • Aim for professional but do not be too “bold” © Tim Ward 2009 – all rights reserved
11. 11. Spreadsheet Design Objects Pictures • Almost any “object” can be embedded • Pictures (JPEG, GIF, BMP etc) • VISIO • Other Excel ranges • Excerpts from Word (and vica versa) • Video • Sounds • IMPORTANT: Make sure the Aspect Ratio is maintained • Try it now… © Tim Ward 2009 – all rights reserved
12. 12. Data Handling • Very rare to input all data into a spreadsheet • Important to be able to manipulate data and represent it as required • Pivot Tables • Powerful for ad-hoc analysis • Not great for standard reporting • Many categories of function – covering today • TEXT • LOOKUP • INFORMATION • LOGICAL © Tim Ward 2009 – all rights reserved
13. 13. TEXT Functions • Broadly 2 categories • Formatting • Extracting and Searching • Often used in combination with other formulae • First lets cover the most useful functions © Tim Ward 2009 – all rights reserved
14. 14. TEXT Functions - Formatting • Data extracted from systems has often been inconsistently input with different cases and spacing. • This looks unprofessional • Can lead to incorrect lookup results • 6 Functions • =PROPER() • =UPPER() • =LOWER() • =TEXT() • =VALUE() • =TRIM() © Tim Ward 2009 – all rights reserved
15. 15. TEXT Functions - Formatting • Go to the TEXT - Formatting Worksheet • Example text in cell A6 “thE qUicK bRown FOX JumPs Over tHe lAZy dog” • Hard to read and looks scrappy • Type =PROPER(A6) into Cell B6 • This capitalizes the first letter of each word and makes all other letters lower case © Tim Ward 2009 – all rights reserved
16. 16. TEXT Functions - Formatting • Type =UPPER(A6) into Cell B7 • This capitalizes all letters in the text • Type =LOWER(A6) into Cell B7 • This changes all letters in the text to lower case © Tim Ward 2009 – all rights reserved
17. 17. TEXT Functions - Formatting • Excel has a “code” for number formats. • dd-mmm-yyyy formats dates to read “16-Jun-2001” • Or dd-mm-yy = 16-06-01 • #,##0 would format the number 1234 to 1,234 • #,##0.00 would format the number 1234 to 1,234.00 • 00000 would format the number 1234 to 01234 • Q00 C000 would format the number 1234 to Q01 C234 • Etc… • This syntax can be used to define your own custom formats • Everyone happy? © Tim Ward 2009 – all rights reserved
18. 18. TEXT Functions - Formatting • =TEXT(Cell,Format) • Converts a number into text • Format is per the previous slide • Type =TEXT(A11,”#,##0.00“ in to cell B11 • =VALUE() • Converts text into a number • Type =VALUE(B11) into cell B12 © Tim Ward 2009 – all rights reserved
19. 19. TEXT Functions - Formatting • Finally the TRIM() function • Text strings can have inconsistent spacing • This makes it hard to manipulate the data • It can make it hard to read • TRIM() removes all spaces and replaces them with a single space between each “word” © Tim Ward 2009 – all rights reserved
20. 20. TEXT Functions Extracting and Searching • Selecting Part of a text string • LEFT(), RIGHT() and MID() • Useful when: • Text has structure • Want to display only part of the text • Want to extract a number from a text string • Often combined with lookup & other functions • Searching within a text string • FIND() © Tim Ward 2009 – all rights reserved
21. 21. TEXT Functions Extracting and Searching • =LEFT(Cell,NoChar) • Returns a text string “NoChar” long starting from the far left of the “Cell” • Type =LEFT(A19,3) into cell B19 • This returns “thE” • Now try typing =UPPER(LEFT(A19,3)) in cell B20 - What do you think the result will be? © Tim Ward 2009 – all rights reserved
22. 22. TEXT Functions Extracting and Searching • =RIGHT(Cell,NoChar) • Returns a text string “NoChar” long starting from the far right of the “Cell” • Type =RIGHT (A19,3) into cell B21 • This returns “dog” • =MID(Cell,Start,NoChar) • Returns a text string “NoChar” long starting “Start” letters into the “Cell” • Type =MID(A19,5,5) in cell B22 • This returns “qUicK” • Try writing your own formula to convert this to read “Quick” in cell B23 © Tim Ward 2009 – all rights reserved
23. 23. TEXT Functions Extracting and Searching • Selecting Part of a text string • LEFT(), RIGHT() and MID() • =LEFT(Cell,NoChar) • Returns a text string “NoChar” long starting from the far left of the “Cell” • Type =LEFT(A19,3) into cell B19 • This returns “thE” • Now try typing =UPPER(LEFT(A19,3)) in cell B20 - What do you think the result will be? © Tim Ward 2009 – all rights reserved
24. 24. TEXT Functions Extracting and Searching • Left, Right and Mid are useful but what if you don’t know: • How long the text string should be • Where the text string starts • The “FIND” function becomes important • =FIND(String,Cell,Start) • String - the text you want to search for (case sensitive) • Cell - The cell containing the text you want to search • Start - Where in the cell to start searching © Tim Ward 2009 – all rights reserved
25. 25. TEXT Functions Extracting and Searching • Try typing =FIND(“o”,A19) in cell B24 • This gives the result 13 • i.e. the first LOWER case “o” in cell A19 is at position 13 • Try typing =FIND(“O”,A19) in cell B24 • This gives the result 18 • i.e. the first UPPER case “O” in cell A19 is at position 18 © Tim Ward 2009 – all rights reserved
26. 26. TEXT Functions Exercise Data has been extracted from a system which contains values which are structured as follows: a variable length code followed by a container number followed by the delivery point and the Vessel Name The container number and delivery point need to be extracted into Columns B and C as Headed - Switch to the “TEXT - Exercise” Worksheet - Using the LEFT, RIGHT, MID, and FIND functions 1. write a formulae to extract the container number 2. write a formulae to extract the Delivery Point © Tim Ward 2009 – all rights reserved
27. 27. TEXT Functions Exercise Review • To extract the container number from column A we would use the MID function. • =MID(Cell,Start,NoChar) • Cell is easy • Container numbers are always the same length so we know that NoChar is 11 • How do we work out where the container number starts? © Tim Ward 2009 – all rights reserved
28. 28. TEXT Functions Exercise Review • If we look at the data container number is always proceeded by a space • We can use the find function to work out which position the space is in • =FIND(“ “,Cell) • And we know that the container number starts 1 character after the space • So the formula would be • =MID(Cell,FIND(“ “,Cell)+1,11) © Tim Ward 2009 – all rights reserved
29. 29. TEXT Functions Exercise Review • For the Whiz Kids • The elements of the formula are: • Cell - as before • Start - FIND(" ",A3,FIND(" ",A3,12)+1)+1 • The character after the second space • NoChar - FIND(" ",A3,FIND(" ",A3,FIND(" ",A3)+1)+1)-(FIND(" ",A3,FIND(" ",A3,12)+1)) • The number of characters between the third space and the second space We can go through this later if anyone wants to :-) © Tim Ward 2009 – all rights reserved
30. 30. Summary - TEXT Functions • You have learnt how to: • Change the case and data type of a cell with LOWER, UPPER, PROPER, TEXT, VALUE and TRIM functions • Extract parts of a text string with LEFT, RIGHT and MID functions • Search for stings within a cell with the FIND function • Combine the FIND and MID functions to increase their flexibility © Tim Ward 2009 – all rights reserved
31. 31. Lookup & Reference Functions • There are many of these functions. This section will cover: • VLOOKUP and HLOOKUP • MATCH & INDEX • ROW • COLUMN • OFFSET © Tim Ward 2009 – all rights reserved
32. 32. Lookup & Reference Functions • Lookup functions quite inefficient • Character by character match • Very slow • Need error trapping • Sorting important • If lot of similar lookups or error trapping • Use Match and Index instead of HVLOOKUP © Tim Ward 2009 – all rights reserved
33. 33. Lookup and Reference Functions VLOOKUP and HLOOKUP • These lookup functions search for a value in the first row or column of a range and return the value x rows or columns away from the match. • These functions have the same syntax but perform their searches in different directions • “V” = Vertical and this function works by searching down columns • “H” = Horizontal and this function works by searching across rows © Tim Ward 2009 – all rights reserved
34. 34. Lookup and Reference Functions VLOOKUP • Data must be arranged in columns • =VLOOKUP(What,Where,Return,Match_Type) • Where = the range containing the data • The values for “What” must be in the first Column • What = the value to be looked up in the first column of “Where” • Return = the column in the “Where” range that contains the values to be returned • Match_Type = the type of match required • 0 = an exact match (not case sensitive), Returns “#N/A” if no match is found • 1 = the closest match that is less than or equal to the What value (1st column of “Where” must be in ascending order) © Tim Ward 2009 – all rights reserved
35. 35. Lookup and Reference Functions HLOOKUP • Data must be arranged in Rows • =HLOOKUP(What,Where,Return,Match_Type) • Where = the range containing the data • The values for “What” must be in the first Row • What = the value to be looked up in the first row of “Where” • Return = the row in the “Where” range that contains the values to be returned • Match_Type = the type of match required • 0 = an exact match (not case sensitive), Returns “#N/A” if no match is found • 1 = the closest match that is less than or equal to the What value (1st column of “Where” must be in ascending order) © Tim Ward 2009 – all rights reserved
36. 36. Lookup and Reference Functions • =MATCH(What,Where,Match_Type) • Use on single row or column • Returns the number of the row or column where the match is found • What = the value to be looked up • Where = the range to do the lookup in • Match_Type = the type of match required • -1 - finds the smallest value that is greater than or equal to “What”. “Where” must be placed in descending order • 0 - finds the first value that is exactly equal to “What”. “Where” can be in any order. Returns “#N/A” if no match is found • 1 - finds the largest value that is less than or equal to “What”. “Where” must be placed in ascending order © Tim Ward 2009 – all rights reserved
37. 37. Lookup and Reference Functions • =INDEX(RANGE,Row_No,Column_No) • Returns the value at the intersection of the Row_No and Column_No in the RANGE • Like coordinates in Maths • Much faster than lookup as no searching • Combine with “Match” – error trapped lookups, efficient multi column return • Combine with SUM to allow formula to cope with increasing periods etc © Tim Ward 2009 – all rights reserved
38. 38. Lookup and Reference Functions • =ROW() • Returns the number of the row the cell is in • =COLUMN() • Returns the number of the column the cell is in • Sometimes useful in calculations • e.g. January is in column E (or 5), Feb in F etc. • If you need to use the month in the formula in a column then COLUMN()-4 gives this. © Tim Ward 2009 – all rights reserved
39. 39. Lookup and Reference Functions • =OFFSET(Reference,Row_Down,Column_Across) • Returns the value in the cell x Row_Down and y Column_Across from the Reference • Useful alternative to index if selecting values from a table where you need both rows and columns to be variable © Tim Ward 2009 – all rights reserved
40. 40. IF Statements • If statements let a formula return different values or perform different calculations depending on the result of a logical test • A logical test is any expression that can be evaluated as TRUE or FALSE • Black = White is a logical test and would return FALSE • Age >= 21 is a logical test which would return true if the value for Age was greater than or equal to 21 © Tim Ward 2009 – all rights reserved
41. 41. IF Statements • =IF(Expr,Value_If_True,Value_If_False) • Expr is the logical test • Value_If_True is the result if Expr evaluates to true • Value_If_False is the result if Expr evaluates to false © Tim Ward 2009 – all rights reserved
42. 42. IF Statements • Sometimes the result of an IF statement depends on more than one Logical Test • OR and AND Expressions can be used to add this functionality to an IF statement • AND(Expr1, Expr2, …, Expr30) • If all of the Expr’s evaluate to TRUE then the AND statement evaluates to TRUE otherwise it evaluates to FALSE © Tim Ward 2009 – all rights reserved
43. 43. IF Statements • OR(Expr1, Expr2, …, Expr30) • If ANY of the Expr’s evaluate to TRUE then the OR statement evaluates to TRUE © Tim Ward 2009 – all rights reserved
44. 44. Error Handling • Errors make totalling difficult and look unprofessional • Need to trap errors • Use if statement combined with: • ISERROR • ISNUMBER • ISLOGICAL • ISNA • IS… © Tim Ward 2009 – all rights reserved
45. 45. Error Handling • All “IS…” functions have the same format • Most common is “ISERROR” • =ISERROR(EXPRESSION) • Tests the value to see if it is an Excel error • #N/A, #REF, #VALUE etc • If it is an error then the formula evaluates to TRUE • If not an error then the formula evaluates to FALSE © Tim Ward 2009 – all rights reserved
46. 46. Pivot Tables • Very powerful tool – revolutionised analysis • Not great for standard reporting • Can change size and shape • Tricks for forcing standard size and shape • Data sources • External • Worksheet • Another Pivot Table • Formatting © Tim Ward 2009 – all rights reserved
47. 47. Visual Basic for Applications • Language Structure • Recording Macros • Editing Macros • Custom Functions © Tim Ward 2009 – all rights reserved
48. 48. Visual Basic for Applications • Can be used for: • Automating repetitive tasks • Guiding users with messages and dialog boxes • Restricting functionality • Designing custom menus and toolbars • Custom Functions • Structure is the same between office applications • Objects may vary © Tim Ward 2009 – all rights reserved
49. 49. Visual Basic for Applications • Language Structure • VBA is an Object Orientated Language • Almost everything in Excel is an Object • Workbooks, Worksheets, Cells • An object is a thing that you want to do something to • Objects are grouped in collections • Objects have PROPERTIES • The font size, value in a cell etc • You do things towith OBJECTS using a METHOD • Copy, Paste, Delete • The best way to start learning is to record a Macro © Tim Ward 2009 – all rights reserved
50. 50. Visual Basic For Applications • Look at the macro we just recorded • Tools > Macro > Visual Basic Editor • Make sure the project explorer is showing on the left – if not click {Ctrl}+R or go to the View menu • Look for VBA Project (My Name.xls) • Click the + sign next to it to expand the container • VBA Code is stored in a Module • Click the + sign next to the Modules folder • There should be a “Module 1” • Double Click this module © Tim Ward 2009 – all rights reserved
51. 51. Visual Basic for Applications • All macros start with the word sub followed by the macro name followed by brackets • The macro we recorded starts Sub Macro1() • All macros end with the words End Sub() • Lets look at the detail.. © Tim Ward 2009 – all rights reserved
52. 52. Visual Basic for Applications • Macro’s can be edited once you understand their structure • Reading our macro is there anything that is superfluous? • Other common edits • add a loop • Repeats the same action for a number of Worksheets or Ranges etc • Do WhileUntil… Loop • For…Next • For Each xxx in xxx … Next xxx © Tim Ward 2009 – all rights reserved
53. 53. Visual Basic for Applications • Other common edits • add a loop • Repeats the same action for a number of Worksheets or Ranges etc • Do WhileUntil… Loop • For…Next • For Each xxx in xxx … Next xxx • with xxxx • Allows many properties to be set for the same object • If ... Then … Else … End if © Tim Ward 2009 – all rights reserved