Microsoft Office Microsoft Office Excel 2013 Core Excel 2013 Core Courseware # 3253 Lesson 3: Using Formulas Microsoft Office Excel 2013 Core Lesson 3 Objectives • what formulas are • create and edit simple formulas • use math operators and understand order of calculations • reference other worksheets • use common functions • use SUBTOTAL function • use a conditional function © CCI Learning Solutions Inc. • use conditional summary functions • use text functions • use absolute and relative cell references • use mixed absolute and relative cell addresses • display and print formulas • use data validation 2 Microsoft Office Excel 2013 Core Creating and Editing Simple Formulas • A formula is a calculation using any combination of: – values entered directly – values in worksheet cells – functions • A powerful feature of formulas is ability to get data from other worksheet cells using cell references • First character of every formula must be ‘=‘ (equal sign) • Formula can have more than one cell reference • Formula results automatically update any time data is changed (or added or deleted) © CCI Learning Solutions Inc. 3 Microsoft Office Excel 2013 Core Creating and Editing Simple Formulas • Example formulas: Cell Formula/Value Results Description A1 10 10 A constant value B1 =A1 10 References value in cell A1 C1 =A1*8 80 Multiply value in A1 by 8 D1 =C1/5 16 Divide value in C1 by 5 E1 =SUM(A1:D1) 116 Built-in function that calculates sum of cells A1 to D1 • If the value in cell A1 is changed, all other formulas that use this value directly or indirectly will also change © CCI Learning Solutions Inc. 4 Microsoft Office Excel 2013 Core Creating and Editing Simple Formulas • If Excel detects error or inconsistency in formula, displays message with suggestion on how to fix • Displays to mark this formula as different from the formulas used in adjacent cells • Clicking on the smart tag displays a menu of options: © CCI Learning Solutions Inc. 5 Microsoft Office Excel 2013 Core Cell References • Can enter cell references into formula by: – typing cell reference directly into cell, or – clicking on cells to be referenced • Most formulas have one or more cell references • Formulas may also use a function that uses a range of cells – Example: =SUM(A1:D1) – Note use of “:” to separate the two cell addresses • Other rules about cell ranges: – Can only be used in functions or arrays, not on their own in a formula – Can be any rectangular block of multiple rows and columns of cells, or a single column or row – Can be an entire row or column, example: =SUM(B:C), =SUM(3:3) © CCI Learning Solutions Inc. 6 Microsoft Office Excel 2013 Core Mathematical Operators • Perform calculations in “natural order” (precedence): 1. Exponents and roots 2. Multiplication and division 3. Addition and subtraction • Can be altered by placing components of formula within parentheses • Standard mathematical operators: * Multiplication / Division + Addition - Subtraction © CCI Learning Solutions Inc. 7 Microsoft Office Excel 2013 Core What-If Analysis • Simple arithmetic can be done using paper and a basic calculator • Spreadsheets are better when many calculations need to be repeated many times with different numbers • What-if describes the trial-and-error method of repeating calculations with different numbers © CCI Learning Solutions Inc. 8 Microsoft Office Excel 2013 Core Referencing Other Worksheets • Can reference cells in other worksheets in same workbook • General format is: ‘<worksheet name>’!<cell reference> – ! indicates cell is located in different worksheet – need single quotes if worksheet name has spaces • Can use the point-and-click method to enter the cell reference © CCI Learning Solutions Inc. 9 Microsoft Office Excel 2013 Core Using Common Functions • Large library of functions for mathematical and data operations • Functions accept values (usually numbers) and cell references as arguments in parentheses • General format: =FUNCTION(numbers or values or cell reference) • Most commonly used are SUM, MIN, MAX, AVERAGE, and COUNT © CCI Learning Solutions Inc. 10 Microsoft Office Excel 2013 Core Using Common Functions • AutoSum is shortcut method to enter a SUM function: – On Formulas tab, in Function Library group, click AutoSum, or – on Home tab, in Editing group, click AutoSum, or – click Insert Function • Always verify you have correct cell range in formula – Excel automatically selects range of cells immediately above or to left of selected cell, and displays it to accept or change • Arrow for AutoSum displays other common functions © CCI Learning Solutions Inc. 11 Microsoft Office Excel 2013 Core Using the Subtotal Function • Enter as: =SUBTOTAL(function #,cell range) • Calculates a variety of common statistics, such as: 1 – Average 2 – Count 3 – CountA 4 – Max 5 – Min 9 - Sum • Ignores other SUBTOTAL calculations in the cell range © CCI Learning Solutions Inc. 12 Microsoft Office Excel 2013 Core Conditional Function =IF(logical test,value if true,value if false) • Logical Test can include comparison operators or qualifiers: = > < >= <= <> Equal to (or the same as) Greater than Less than Greater than or equal to Less than or equal to Not equal to • Value if True/False can contain text string, values, or other functions • Example: =IF(B10=0,0,C10/B10) © CCI Learning Solutions Inc. 13 Microsoft Office Excel 2013 Core Conditional Function • Nesting IF statements =IF(A1=10, “text A”, IF(A1=20, “text B”, “text C”)) If A1 contains Then cell will display 10 text A 20 text B Any other value text C © CCI Learning Solutions Inc. 14 Microsoft Office Excel 2013 Core Using Conditional Summary Functions • Conditional versions of AVERAGE, COUNT, and SUM – Combines IF function with AVERAGE, COUNT, and SUM • Example: =SUMIF(D4:D207,"Visa",F4:F207) – Logical test is "Visa" - value to look for – Criteria range is D4:D207 – the cell range to look for the test value – Sum range is F4:F207 – apply sum to this range if the logical test is true • The logical test is applied to every cell in the criteria range • If no comparison operator is used, “=“ is assumed • Advanced topic - the logical test can be put into a worksheet cell, and a cell reference to it is placed into the function • Sum range is optional – If not specified, the sum is applied to criteria range © CCI Learning Solutions Inc. 15 Microsoft Office Excel 2013 Core Using Text Functions LEFT Extract the specified number of characters starting from the left side of the text string. RIGHT Extract the specified number of characters starting from the right side of the text string. MID Extract the specified number of characters starting from any position in the text string. UPPER Convert all characters in a text string to uppercase. LOWER Convert all characters in a text string to lowercase. PROPER Convert the first letter of the text string to uppercase. All other characters are set to lowercase. CONCATENATE Join two or more strings together to create one text string. Alternatively, use the & operator to join strings together. © CCI Learning Solutions Inc. 16 Microsoft Office Excel 2013 Core Using Absolute and Relative Cell References • Most formulas use relative addressing – when formula is copied, cells automatically adjusts for new location – address is not adjusted if formula is moved to another location • Absolute addressing - cell addresses are not adjusted when copied elsewhere on worksheet • To change to absolute cell address: – type dollar sign before row number and/or column letter, or – press F4 • • • • first time makes both column and row reference absolute second time makes only row references absolute third time makes only column reference absolute fourth time removes absolute references on both column and row © CCI Learning Solutions Inc. 17 Microsoft Office Excel 2013 Core Using Mixed Absolute and Relative Cell References • Select what needs to stay absolute when formula is copied to another cell: Column Data must be from same column =C10*$D2 Row Data must be from same row =C10*D$2 Both Must always be this cell =C10*$D$2 © CCI Learning Solutions Inc. 18 Microsoft Office Excel 2013 Core Displaying and Printing Formulas • To see formula, select cell and examine in formula bar • To see all formulas at same time: – File tab, click Options, click Advanced, click Show formulas in cells instead of their calculated results – Formulas tab, in Formula Auditing group, click Show Formulas • Useful for verifying accuracy of spreadsheet © CCI Learning Solutions Inc. 19 Microsoft Office Excel 2013 Core Data Validation • Prevent errors when data entered • Validation check types: Any value No data validation. Whole number Numeric values without decimal digits. Decimal Any numeric value. List Selection only from a defined list of values. Also known as a pick list. Date Date values only. Earliest date is January 1, 1900. Time Time values only. Text length Text only, up to specified number of characters. Custom Enter a formula to validate the data. Result is True or False. © CCI Learning Solutions Inc. 20 Microsoft Office Excel 2013 Core Data Validation • Displays icon and error message when incorrect data is entered © CCI Learning Solutions Inc. • Displays helpful message when user selects the cell 21 Microsoft Office Excel 2013 Core Lesson Summary • what formulas are • create and edit simple formulas • use math operators and understand order of calculations • reference other worksheets • use common functions • use SUBTOTAL function • use a conditional function © CCI Learning Solutions Inc. • use conditional summary functions • use text functions • use absolute and relative cell references • use mixed absolute and relative cell addresses • display and print formulas • use data validation 22 Microsoft Office Excel 2013 Core Review Questions 1. List which standard math operators Excel uses and what is their order of precedence. 2. Give examples of how using formulas to perform a what-if analysis is beneficial to you. 3. Which of the following are invalid? a) =MAX(B5:B15) b) c) d) e) f) g) h) =MAX(B5,B6,B7,B8,B9,B10,B11,B12,B13,B14) =MAX(B5:B7,B8:B10,B11:B15) =MAX(B1,B5:B8,B9:B15) All of the above are invalid formulas None – all are valid formulas c b, c, and d © CCI Learning Solutions Inc. 23 Microsoft Office Excel 2013 Core Review Questions 4. Define the different parts of a reference to other worksheets using the reference Tours!B4 as an example. 5. What is the main difference between an IF function and other functions discussed in this lesson such as SUM, AVERAGE, and UPPER? 6. Are the LEFT and MID functions fully interchangeable? In other words, can you always use the LEFT function instead of MID, as well as using MID instead of LEFT. 7. Explain the difference between absolute and relative cell references. 8. Provide examples of when or why it may be beneficial to print the formulas in the worksheet © CCI Learning Solutions Inc. 24