Microsoft Excel: Formulas
Microsoft Excel: Formulas
FORMULAS
Writing a Formula
2. Type the equal sign <=> which will also appear in the formula bar. All formulas must begin with
the equal sign.
3. Do one of the following:
type in a numeric value
select a cell or a range of cells
4. A coloured border will appear on each cell that you select.
5. You can drag the line border to move the selection.
7. Use the number pad to type in the mathematic operators (add, subtract, divide, etc.).
8. Press the <ENTER> key when finished.
1
Parentheses in Formulas
Formulas calculate values in a specific order. A formula in Excel always begins with an equal sign
<=>. Following the equal sign are the elements to be calculated (the operands), which are separated
by calculation operators (add, subtract, divide, etc.). Excel calculates the formula from left to right
according to a specific order for each operator in the formula.
Operator Precedence
If you combine several operators in a single formula, Excel performs the operations in the order as
listed in the following table:
If a formula contains operators with the same precedence, for example, if a formula contains both a
multiplication and division operator, Excel evaluates the operators from left to right.
2
Functions
A function is a predefined formula that operates on a value (or values) and returns a value (or
values). Many Excel functions are shorthand versions of frequently used formulas. All functions
consist of (1) a function name followed by (2) a set of arguments which are enclosed in parentheses.
3. Select the function you want from the Insert Function dialogue box.
3
The Function Arguments Box
3. As you click into each argument box, the “statement” will describe the required data.
4
Correcting a Function
3. Click in any argument box that you want to change, and type your corrections.
4. If you enter a wrong expression in an argument box, the tag “Invalid” will appear.
5
The Formula Ribbon
1. You can access functions from the Formulas ribbon by using the Function Library group.
6
Round Number Functions
There are various round numbers functions which allow you to round numbers:
to the nearest (or specified) decimal place(s)
to the nearest even or odd integer
to a specified ceiling or floor value.
1. The Number argument can be a number, a reference to a cell that contains a number, or a
formula that results in a number.
2. The Multiple argument (or Num-digits, Number, Significance as depends on which function) is
the number or decimal places you want to round to.
7
IF Function
Use IF function to perform a logical test on a cell value. If it finds the test to be true, then Excel will
return whatever value, formula, or function you specify. And if it finds the test to be false, Excel will
return whatever value, formula, or function you specify.
5. Value_if_true is the value that Excel enters on the spreadsheet if the Logical_test is TRUE.
This return value can be a number, a text string, a formula, or even another function. In the
example above, Excel will type the text <Pass>.
6. Value_if_false is the value that Excel enters on the spreadsheet if the Logical_test is FALSE.
This return value can be a number, a text string, a formula, or even another function. In the
example above, Excel will type the text <Fail>.
8
IF Functions (Nested)
As a general rule of thumb, the arguments of functions will allow you to enter a number, a cell
reference, a formula, a text string, or indeed another function (which is called: nesting).
9
6. A new IF Function Arguments box will open, and will be nested in the Value_if_true argument.
7. Fill in the Value_if_true IF function as required. But do not click the OK button.
8. Rather than clicking the OK button, go to the formula syntax and select the “original” IF function.
9. This will open the first (original) IF function. You will see the second IF function nested in the
Value_if_true argument box.
10. Click in the Value_if_false argument box and repeat steps #4 and #5 as outlined on page 9.
10
11. Fill in the third Value_if_false IF function as required.
14. To open any of the three IF Function Arguments boxes, select the IF in the formula
syntax, and then click on the Insert Function icon on the formula bar.
11
LOOKUP Functions
There are several functions that look up and return information that you have stored in a data table.
In the example of parking permits, we might wish to add a permit fee according to which college the
student is enrolled in.
4. Use the “HLOOKUP” function if the data table is stored horizontally across the columns. And use
the “VLOOKUP” function if the data table is stored vertically down the rows.
12
5. Lookup_value is the value to be found (to look up) in the first row of the data table.
6. Table_array is a table of information in which the lookup_value is found. Use a range reference
or a range name to designate the table. The values in the first row of table can be text, numbers,
or logical values.
7. Row_index_num is the row number in table_array from which the matching value will be
returned to the answer (or results) cell. A row_index_num of 1 returns the first row value in
table_array, a row_index_num of 2 returns the second row value in table_array, and so on.
8. Range_lookup is a logical value that specifies whether you want the LOOKUP function to find an
exact match or an approximate match. If you type in TRUE (or leave omitted), an approximate
match is returned. In other words, if an exact match is not found, the next largest value that is
less than lookup_value is returned. Therefore in the College Permit Fees Table a fee of 48 is
returned for a value of <T>.
This is because <T> (which is between the letters <S> and <W>) in the table array is “rounded
up” to the next largest value in the table which is <S>.
However, if you type in FALSE in the Range_lookup box, an exact match must be found. In the
illustration above, as there is no letter <T> in the table array, the error value <#N/A> is returned.
13
Special Paste as Values
There may be reasons to “erase” the function and leave only the results in the cell as a “value”. In
the diagram below, the contents of cell <F3> is not the number 32, but the results of the HLOOKUP
function as seen in the formula bar.
1. Select the “answer” cells that display the results from the function.
14
Further Help
15