Module 4: Spreadsheets 4.4 FORMULAS & FUNCTIONS 1. FORMULAS & FUNCTIONS Spreadsheets are useful tools for performing all types of calculations rapidly: arithmetic, financial, statistical and many more. To do this, they provide everything you need to write formulas and execute different types of calculations immediately. It is important to know how to: • perform basic operations and • compose simple logical functions. 2. A MATHEMATICS REFRESHER… We learned how to perform basic mathematical operations in school. We learned how to represent them using Addition, Subtraction, Multiplication and Division signs. We also know the meaning of signs like Equal, Greater than, Less than, Minimum and Maximum. These signs, combined with numbers or the quantities that interest us, comprise the formulas and functions that are indispensable for performing calculations. In Excel, formulas and functions are entered in cells along with all the values we need. In effect, Excel formulas are equations that perform calculations on the values in the worksheet. 3. FORMULAS IN EXCEL 4.4.1.1 Cells, or sets of cells, are identified by references, i.e., the coordinates of the rows and columns that comprise them. The reference is a tool that is used to find the values or data that you wish to include in a formula. So, the formula just needs the references for the cell, or set of cells, on which you want to perform an operation and it’s ready to be used! However, you do have to be careful to enter the correct references in the formula. 4. REFERENCES TO CELLS Let's take a look at the main types of references that you need to know and what they mean: 4.4.1.4 • • A relative reference to a cell in a formula, that is based on the relative position of the cell that contains the formula and the cell of the reference. Remember: if you change the position of the cell that contains the formula, you also change the reference. An absolute reference, that always refers to a specific position. If you change the position of the cell that contains the formula, the absolute reference remains unchanged. © 2011 WebScience Srl. All rights reserved. Copy forbidden. Module 4: Spreadsheets • A mixed reference, that contains an absolute column and a relative row or an absolute row and a relative column. Only the relative references are changed, while the absolute references remain unchanged. If you always keep these differences in mind, you can copy and move your formulas where you prefer without having to rewrite them each time: Excel updates formulas with the new cell references automatically. If for example we carry forward the formulas just seen on an Excel spreadsheet, we can see that you simply press F4 on your keyboard to switch from one reference to another. If we also copy the same formula written in a different way (a simple sum but containing different references) into the adjacent cells, we see that the results vary depending on the type of reference contained within it. 5. THE FORMULA BAR AND THE RIBBON Excel offers different ways to enter formulas in cells and offers guidance in various cases. After selecting the cell to enter the formula, you can write it directly in the formula bar by typing the specific equation. But, if the formula is complex or you don't remember it exactly, the Ribbon will help you continue. For example, when you select Insert, a window opens where you can select the desired function and instructions to follow for its correct completion. Or you can open the windows that display functions grouped by type, such as those recently used. 6. HOW TO CREATE SIMPLE FORMULAS 4.4.1.2 Performing simple arithmetical operations is not complicated at all. Suppose, for example, that we want to calculate the sum of the values displayed here and put the result in cell A1. We can begin writing in the formula bar or even in the cell: in any case, every formula must begin with an equal sign. You will have to follow the usual rules of arithmetic and type the references to the cells that contain the values to be summed. When finished, just click the checkmark or press Enter on the keyboard and Excel will display the equation you typed in the formula bar and the result of the operation in the cell. Using the same procedure, you can write even more complex formulas that involve any type of mathematical, financial or logical operators. Let's look at another example. If we insert a formula that contains a subtraction and a division - like A2-C4 divided by B3 - and we want to ensure that the value in B3 does not change if the cell is copied to another location, it is important to recall that: 1) The subtraction will put in parentheses so that it is executed independently before the division takes place 2) The B3 reference must be absolute so that its value remains constant Therefore our formula must be written as follows: =(A2-C4)/$B$3 © 2011 WebScience Srl. All rights reserved. Copy forbidden. Module 4: Spreadsheets 7. WORKING WITH FUNCTIONS 4.4.2.1 Formulas that require the use of more complex operators that automatically execute certain operations require the use of functions. The most used functions include: • • • • • • • the Maximum function that returns the largest value in a list of arguments; the Minimum function, which returns the smallest value in a list of arguments; the Sum function, which calculates the sum of a list of arguments; the Average function, which calculates the arithmetic average of a list of arguments; the Count Number function, which counts the number of cells containing numbers in a list of arguments. the Counta function, which counts the number of cells within a range which are not empty the Round function, which rounds a number to a certain number of decimals 8. INSERTING FUNCTIONS We can use the Insert function window that we talked about above to enter formulas that contain functions easily and correctly. For example, if you want to insert a function that calculates the maximum value present in the interval of cells displayed, you should select the Maximum function. When you click OK, another window opens where you just have to enter the arguments that the function you selected needs, based on instructions provided in the window itself. At the end, you can check the expression that Excel has created in the formula bar and the result of the executed expression in the final cell! There are other ways to insert functions. For example the Insert function window can also be opened by clicking on the fx symbol on the formula bar or by clicking the button shown with the Σ (Sigma) symbol in the Home tab within the multifunction bar. In the relevant drop-down menu we find the More Functions item which opens the Insert function window, while clicking on other operations symbols like AVERAGE or MIN causes Excel to directly insert the formula in the cell, helping the user to write the expression. 9. THE "IF" FUNCTION There are really a lot of functions available and most of these are very technical and specific and you will probably never use them. But there are others that could really be very useful 4.4.2.2 if you knew about them! The IF function is one of these! We can get a better understanding of how it works by looking at an example. Let's suppose that we have a catalogue price list and we want to divide the articles into two price ranges: “cheap” and “expensive”. Using the IF function, we can have the program automatically assign each article to its price range. First, we position ourselves in the cell where we want the result to appear and, immediately after, we open the window that guides us in entering the IF function. The first piece of information to enter is the “logical_test”, which must be a simple © 2011 WebScience Srl. All rights reserved. Copy forbidden. Module 4: Spreadsheets equation: in this case, we want to know if a certain price is higher than another, so our condition is “D3>3000” The second value is used to tell the program what to write in the destination cell if the specified condition is TRUE; and, finally, the third tells it what to write in the case that it is FALSE. At this point, Excel runs the equation and automatically writes “expensive” in the destination cell, if the condition is true, and “cheap,” if it is not. Remember that, just like the example, you can also use text arguments in addition to numbers simply by remembering to put them in quotes! All this automatically, with a simple formula! The IF function is very widely used because it is very versatile; in fact, the individual arguments of the expression allow you to insert text (always enclosed within quotation marks), cell references or numeric values. For example you can write an expression similar to =IF(C5="Expensive";D2;60) to ensure that the value contained in cell D2 rather than the number 60 is carried forward into the cell. In case any of the function’s arguments needs to use some form of comparison calculation operator, from the ones which we list as follows. Comparison operator Meaning Example = (equal sign) Equal to A1=B1 > (greater than sign) Greater than A1>B1 < (less than sign) Less than A1<B1 >= (greater than or equal to sign) Greater than or equal to A1>=B1 <= (less than or equal to sign) Less than or equal to A1<=B1 <> (not equal to sign) Not equal to A1<>B1 10. ERROR MESSAGES Excel helps us to be more efficient by indicating any error with specific, well-defined error messages that explain how to correct the formulas! The main error messages that you're likely to see have to do with: 4.4.1.3 ##### An error that is displayed when a column is not wide enough to contain what was typed #DIV/0! An error displayed when a number is divided by zero: which is an impossible operation to perform #N/A An error that is displayed when one of the values required by a function or formula is not available © 2011 WebScience Srl. All rights reserved. Copy forbidden. Module 4: Spreadsheets #NAME? An error that is displayed when the text in a formula is not recognized #NUM! An error that is displayed when a formula or function contains invalid numeric values #REF! An error that is displayed when a reference to a cell is not valid #VALUE! An error that is displayed when the wrong type of argument is used Let us examine together a few examples of the causes behind some of the most frequent errors. The #REF! error is displayed in one or more cells of a worksheet when cells which other formulas were referring to are deleted or when moved cells are pasted over cells which other formulas were referring to. On the other hand the #NAME? error is displayed when a non-existent name is used, or when the spelling of the name is erroneous or more frequently, when the text is not enclosed between quotation marks within the formula. © 2011 WebScience Srl. All rights reserved. Copy forbidden.
© Copyright 2026 Paperzz