More Complex Formulas and Functions CREATING A THREE-DIMENSIONAL FORMULA A 3-D formula is one that calculates data across multiple worksheets. If data is collected, for example, on a monthly basis, it is common to want to summarize that data with year-to-date totals, averages, etc. Because a 3-D cell reference refers to data that is in the same location on multiple sheets, you need to set up the worksheets so that they are identical in structure. This can be done in one of two ways: 1. Create one worksheet and then copy it as many times as needed, or 2. Insert the total number of blank sheets needed by clicking here: then right click on one sheet tab, and then click “Select All Sheets” to enter Group Mode. Then enter the data and do the formatting that will be same on all sheets. To exit Group Mode, right click on any sheet tab and choose “Ungroup Sheets”. Warning: when you are Group Mode, anything you do on one sheet gets done to all selected sheets! Follow these steps to create a 3-D formula that adds the value in cell B4 on each of 12 monthly worksheets: 1. Select the cell where you want to total to appear. 2. Type =SUM( or click the AutoSum button on the Ribbon. 3. Select the sheets you want to include in the calculation. In this case, click on the “January” sheet (the 1st one), hold down the S key, and then click on the “December” sheet (the last one). 4. Click on cell B4. This indicates that you want to add the value in cell B4 on each of the selected sheets. 5. The result will look like this: =SUM('January:December'!B4) CREATING NAMES Every cell in Excel has a default “name”, which is the column letter followed by the row number. A cell or a range of cells can also be given a name that is more descriptive. The same name should only be used once in a workbook. Names can be up to 255 characters in length, must start with a letter, and cannot contain any spaces. Excel: More Complex Formulas & Functions To create a name: 1. Select the cell or range of cells you wish to name. 2. Click in the name box: Name box Selected range 3. Type the name you want to use to refer to the selected range. In the above example, you might use a name such as Qtr1 4. Press J (this is critical- if you don’t press J, the name will not be saved). Once names have been created, they will appear as a list when you click the down arrow at the right hand side of the Name Box. Clicking on a name will either move the active cell to that location (a single cell) or select the range (multiple cells). Names can be edited or deleted by clicking the Name Manager button on the Formulas Tab on the Ribbon. It is possible to create multiple names at the same time. Select the cells you want to name, including the text you want to use as the names. For example: On the Formulas tab, in the Defined Names group, click “Create from Selection”. Excel will now ask which text you want to use for the names. In this example, top row is the correct location. This will automatically create 4 names (Quarter1, Quarter2, Quarter3, Quarter4) using the text in the top row of the selection. USING NAMES IN FORMULAS Once names have been created, they can easily be used in formulas as a substitute for cell references. In the above example, we could total the sales for the first half of the year with the following formula: =SUM(Quarter1,Quarter2) Page 2 of 6 ©2015 Christopher Babin Excel: More Complex Formulas & Functions As you are creating the formula, there are two ways to enter the range names into the formula: 1. If you remember the name, just start typing it. The name will pop up on a list. To use that name, either double-click on it or select it and press the T key. 2. If you don’t remember the name or don’t want to type it, click the “Use in Formula” button in the Defined Names Group on the Formulas tab. This will display a list of all names. Pick one from the list. USING MORE COMPLEX FUNCTIONS Remember that functions are pre-defined calculations. Every function works the same way. A function consists of three parts: = (equal sign): This tells excel that you want to perform a calculation Name: This describes the function (e.g. SUM, AVERAGE, or COUNT) Arguments: These tell Excel more specifically what to calculate. They are always inside parentheses and, if there is more than one argument, they are separated by commas Many functions have arguments that can include an expression. An expression refers to things like, “equal to”, “greater than”, “less than”, etc. These are the most common expressions: = Equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to <> Not equal to "" Blank The COUNTIF function The COUNTIF function counts the number of cells within a range that meet a given condition. Here is the syntax: =COUNTIF(range,criteria) Range defines the range from which you want to count non-blank cells. Page 3 of 6 ©2015 Christopher Babin Excel: More Complex Formulas & Functions Criteria is the condition that defines which cells will be counted. It can be a number, text (in quotes), or an expression (in quotes). Examples: =COUNTIF(A5:A100,"x") Counts the number of cells in the range A5:A100 that contain an “x” =COUNTIF(C2:F45,”>90”) Counts the number of cells in the range C2:F45 that have values greater than 90 =COUNTIF(G1:G35,100) Counts the number of cell in the range C1:G35 that contain the number 100 The IF function The IF function checks whether a given condition is met, and returns one value if TRUE, and another if FALSE. Another way to think of this is: “if this expression is true, do this. Otherwise, do that”. Here is the syntax: =IF(Logical_test,Value_if_true,Value_if_false) Logical_test is any expression that can be evaluated to TRUE or FALSE. Value_if_true is what you want Excel to do if the outcome of Logical_test is TRUE. This can be a number, a calculation, or text (text must be in quotes). Value_if_false is what you want Excel to do if the outcome of Logical_test is FALSE. This can be a number, a calculation, or text (text must be in quotes). Example: if a student scores 95 or above on the final exam, the student gets 2 bonus points added to the score (the final exam score is in cell F3). =IF(F3>=95,F3+2,F3) Excel looks in cell F3 to see if the value is 95 or more. If so, it adds 2 to the value in F3. If not, it displays the value in F3 (score without bonus) The VLOOKUP function The VLOOKUP function looks for a value in the leftmost column of a table, and then returns a value in the same row of the table from a column you specify. This is the equivalent of looking up your taxable income in the leftmost column of the IRS tax table, and then counting across to the column that matches your filing status to find out the amount of your tax. Here is the syntax: =VLOOKUP(Lookup_value,Table,Col_index_num,Range_lookup) Page 4 of 6 ©2015 Christopher Babin Excel: More Complex Formulas & Functions Lookup_value is the value to be found in the first column of the table. It can be a number, a cell reference, or text. Table is a range from which data is retrieved. The table should be sorted in ascending order. It can be a cell range, but it is better to name the table and use the name for this argument. Col_index_num is the column number in Table from which the matching value should be returned. Columns in a table are numbered sequentially. The leftmost column is 1, for example. Range_lookup is either TRUE or FALSE. Use TRUE to find the closest match in the first column of the table; use FALSE to find an exact match. Example: Let’s say we have calculated a student’s final score for the quarter, and now we want Excel to look up what letter grade the student should receive. The final score is located in cell P3. We have created the following table and have named it Grade_Lookup: [Note that table is sorted in ascending order] =VLOOKUP(P3,Grade_Lookup,2,TRUE) P3 is the cell that contains the score that we want to look up in the grade table. Grade_Lookup is the name of the grade table. 2 refers to the 2nd column of the grade table. TRUE means to find an approximate, not an exact, match. Text Functions Not all functions perform math calculations. Excel has several functions that help to manipulate text. Here are a few of them: Function Description Syntax Concatenate Joins several text strings into one =CONCATENATE(text1,text2…) Left Return a specified # of characters from the start of text string =LEFT(text,num_chars) Proper (also Upper & Lower) Converts text to proper case (1st letter of each word capitalized) =PROPER(text) Trim Removes all spaces from a text string, except for single spaces between words =TRIM(text) Page 5 of 6 ©2015 Christopher Babin Excel: More Complex Formulas & Functions Here is an example: Let’s say that we have imported into Excel a large list of names from another system. As is often the case, the names are shown in Excel in all caps. Because we want to use this list to create mailing labels, we want the names converted to proper case. A sample would look like this: As you can see above, the first Proper function is created in cell B2 like this: =PROPER(A2) This can then be copied down the column to convert all of the names to proper case. However, before you can delete Column A (it’s no longer needed), you must first convert the Proper functions to values. To do this, follow these steps: 1. Select all of the cells containing the Proper function 2. Copy these cells 3. Click the lower half of the Paste button (Home Tab) and click on Paste Values Let’s say you want to sort these names by last name. You cannot do this as long as first name and last name are in the same cell. We need to separate first and last name into different cells. To do this: Select all of the cells that you want to separate 1. On the Data tab, click “Text to Columns” 2. On the 1st screen, be sure “Delimited” is selected, and click “Next” 3. On the 2nd screen, choose “Space” as the delimiter, and then click “Finish”. If the first name and last name are in different cells and you want to combine them into a single cell, you would use the CONCATENATE function. Let’s say that first name is in A1 and last name is in A2. Select cell A3 and type the following: =CONCATENATE(A1," ",A2) This instructs Excel to combine the contents of cell A1, a space, and the contents of cell A2. Page 6 of 6 ©2015 Christopher Babin
© Copyright 2025 Paperzz