Vous êtes sur la page 1sur 5

Advanced Excel Formulas

Cell and Range References


Most formulas reference one or more cells by using the cell or range address (or name if it has one). Cell references come in four styles; the dollar sign differentiates them. Relative: The reference is fully relative. When the formula is copied the cell reference adjusts to its new location. Eg A1 Absolute: The reference is fully absolute. When the Formula is copied the cell reference does not change. Example $A$1 Row Absolute: The cell reference is partially absolute. When the formula is copied, the column part adjusts, but the row part does not change. Example $A$1 NB: The F4 key will toggle through the above styles for selected cell references

IF Statements
If x is true do y if not do z. If statements follow the logic displayed above. They are split into 3 sections, known as the logical test, value if true and value if false..

Examples

=if(c3>b3,Over,Under) = Over
C3 > B3 is the Logical Test. The only criterion for this test is that is a statement which Excel can verify is either true or false. It can be any formula(s) or function(s) and can refer to cells in the same sheet, another sheet in the same workbook or in a different workbook. -1-

Over = The value if true. This is the text, value, function or formula that will be returned when the logical statement is true. Under = The value if false. This is the text, value function or formula that will be returned when the logical statement is false.

VLookups
The VLOOKUP function looks up the value in the first column of a lookup table and returns the corresponding value in a specified table column.. The Lookup table is arranged. The syntax for the VLOOKUP function is VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) Lookup_value The value to be looked up in the first column of the lookup table. Table_array The range that contains the lookup table Col_index_num The column number from within the table from which the matching value is returned. Range_lookup Optional. If TRUE or emitted then where an exact match is not found , the next largest value that is less than the lookup_value is returned. If FALSE, VLOOKUP will search for an exact match. If VLOOKUP cannot find and exact match the function returns #N/A.

Example

To find the price of product code B04 in cell C14 =vlookup(a14,A2:C11,3,false). Result 260 -2-

Lookup Reference = A14. Looks up the value B04 against cells A2:A11. Table Array = A2:C11. The first column of this table must contain the values that the lookup reference is compared against. The table must also include the column with the values that need to be returned. Column Index Number = 3. This number represents the position of the column that is going to return the values to be displayed. In this case as column A is 1, Column B is 2 and C is therefore 3. To display the product name change the index no. to 2. Range lookup = false. We only want a value a result returned in Cell C14 if there is an exact match between cell A14 and one of the cells in the range A2:A11

The HLOOKUP Function


The HLOOKUP Function works just like the VLOOKUP function except that the look lookup table is arranged horizontally instead of vertically.. The HLOOKUP function looks up the value in the first row of the lookup table and returns the corresponding value in the specified table row. HLOOKUP (lookup_value, table_array,row_index,range_lookup) Lookup_value The value to be looked up in the first column of the lookup table. Table_array The range that contains the lookup table Row_index_num The column number from within the table from which the matching value is returned. Range_lookup Optional. If TRUE or emitted then where an exact match is not found , the next largest value that is less than the lookup_value is returned. If FALSE, VLOOKUP will search for an exact match. If VLOOKUP cannot find an exact match the function returns #N/A. The following tax rate example uses a horizontal lookup table (in the range E1:J3). The formula in the cell D3 is =HLOOKUP(B9,C1:H3,3)

-3-

Lookup_value B9. Table_array C1:H3 Row_index_num 3 the tax rate row Range_lookup Left blank so this equals true. Therefore is no exact match is found the next largest value less than the lookup value is found.

-4-

Naming a cell or a group of cells


Rather than specify cells individually every time you want to use the data they contain, you can define those cells as a range (also called a named range). 1. Select the cell or cells in question. 2. Click in the Name box above column A 3. Give the cells a name. In this case Ive called it data. See below

To select this are in future click the drop down beside the cell reference and choose the appropriate named range (see below).

-5-

Vous aimerez peut-être aussi