Sie sind auf Seite 1von 7

Function - IF

Basic Description

The Excel IF function tests a supplied condition and returns one result if the condition evaluates to
TRUE, and another result if the condition evaluates to FALSE.

The syntax of the function is:

IF( logical_test, value_if_true, value_if_false )

where the arguments are as follows:

logical_test - The condition that is to be tested and evaluated as either TRUE or FALSE.

value_if_true - The result that is to be returned if the supplied logical_test evaluates to TRUE.

value_if_false - The result that is to be returned if the supplied logical_test evaluates to FALSE.

Function -SUMIF

The Excel Sumif function finds the values in a supplied array, that satisfy a given criteria, and returns
the sum of the corresponding values in a second supplied array.

The syntax of the function is:

SUMIF( range, criteria, [sum_range] )

Where the function arguments are:

range - An array of values (or range of cells containing values) to be tested against the
supplied criteria.

criteria - The condition to be tested against each of the values in the supplied range.

[sum_range] - An optional array of numeric values (or cells containing numbers) which are to
be added together, if the corresponding range entry satisfies the supplied
criteria.

If the [sum_range] argument is omitted, the values from the range argument are
summed instead.
Excel Sumif Function Examples

Example 1
The spreadsheet below shows three examples of the Excel Sumif function used with text based
critia.

For each call to the Excel Sumif function the range argument (to be tested against the criteria) is
either the cell range A2 - A9 or the cell range B2 - B9, and the [sum_range] argument (containing the
values to be summed) is the cell range C2 - C9.

Formulas: Results:
A B C A B C

1 Month Team Sales 1 Month Team Sales

2 Jan North 1 $36,693 2 Jan North 1 $36,693

3 Jan North 2 $22,100 3 Jan North 2 $22,100

4 Jan South 1 $53,321 4 Jan South 1 $53,321

5 Jan South 2 $34,440 5 Jan South 2 $34,440

6 Feb North 1 $29,889 6 Feb North 1 $29,889

7 Feb North 2 $50,090 7 Feb North 2 $50,090

8 Feb South 1 $32,080 8 Feb South 1 $32,080

9 Feb South 2 $45,500 9 Feb South 2 $45,500

10 10

11 =SUMIF( A2:A9, "Feb", C2:C9 ) 11 $157,559 - sum of cells C6-C9

12 =SUMIF( B2:B9, "North 1", C2:C9 ) 12 $66,582 - sum of cells C2 & C6

13 =SUMIF( B2:B9, "North*", C2:C9 ) 13 $138,772 - sum of cells C2, C3, C6 & C7

FUNCTION COUNTIF

COUNTIF( range, criteria )

Where the function arguments are as follows:


range - The range of cells that should be tested against the supplied criteria and counted if
the criteria is satisfied.

criteria - A user-defined condition that is tested against each of the cells in the supplied range.

The supplied criteria can be either:

A numeric value (which may be an integer, decimal, date, time, or logical value) (e.g. 10,
01/01/2008, TRUE)
or

A text string (e.g. "Text", "Monday")


or

An expression (e.g. ">12", "<>0").

Note that if your criteria is a text string or an expression, this must be supplied to the function in
quotes.

Also note that the Excel Countif function is not case-sensitive. So, for example, the text strings
"TEXT" and "text" will be considered to be equal.

Excel Countif Function Examples

Countif Function Example 1


A B C D

1 Sunday 07-Sep-2008 0 TRUE

2 Monday 08-Sep-2008 2.1 TRUE

3 Wednesday 10-Sep-2008 2 TRUE

4 Thursday 11-Sep-2008 3 FALSE

5 Wednesday 17-Sep-2008 2.5 FALSE

6 Tuesday 23-Sep-2008 3 FALSE

7 Wednesday 24-Sep-2008 6 FALSE


8 Sunday 05-Oct-2008 4 FALSE

9 Saturday 11-Oct-2008 0 FALSE

The following example shows the Excel Countif function used to count cells containing text strings,
numeric values, dates or logical values within the data spreadsheet on the right.

The format and results of the functions are shown in the spreadsheets below.

Formulas: Results:

A A

11 =COUNTIF( A1:A9, "Wednesday" ) 11 3

12 =COUNTIF( A1:A9, "<>Wednesday" ) 12 6

13 =COUNTIF( B1:B9, ">01/10/2008" ) 13 2

14 =COUNTIF( C1:C9, 0 ) 14 2

15 =COUNTIF( C1:C9, ">=3" ) 15 4

16 =COUNTIF( D1:D9, TRUE ) 16 3

Function HLOOKUP

Basic Description

The Excel Hlookup function 'looks up' a given value in the top row of a data array (or table), and
returns the corresponding value from another row of the array.

The syntax of the function is:

HLOOKUP( lookup_value, table_array, row_index_num, [range_lookup] )

Where the function arguments are as follows:

lookup_value - The value that you want to search for, in the first row of the supplied data
array.

table_array - The data array or table, containing the data to be searched in the top row,
and the return values in any other row.
row_index_num - The row number, within the supplied table_array, that you want the
corresponding value to be returned from.

[range_lookup] - An optional logical argument, which can be set to TRUE or FALSE,


meaning:

TRUE - if the function cannot find an exact match to the


supplied lookup_value, it should use the closest
match below the supplied value.
Note: If [range_lookup] is set to TRUE, the top row
of the table_array must be in ascending order).

FALSE - if the function cannot find an exact match to the


supplied lookup_value, it should return an error.

Hlookup Example 1 - Exact Match Lookup


Cells A2-F6 of the spreadsheet below, show the exam scores for 5 students in 4 different subjects. If
you want to look up a specific score (e.g. Biology) for one of the students (e.g. Ed), this can be done
using the Hlookup function, as shown in cell B10 of the spreadsheet.

Formulas: Results:

In the above example, the Hlookup function searches through the top row of the table_array (the
range A2-F2), to find a match for the lookup_value (the name "Ed"). When the the name "Ed" is
found, the function returns the corresponding value from the 5th row of the table_array.
This is illustrated in the spreadsheet on the right. The function finds the name 'Ed' in the top row of
the table_array and then returns the value from the 5th row of the table_array.

If we change the name in cell A10 of the spreadsheet from 'Ed' to 'Cara', the Hlookup functions
would automatically recalculate the function to display the exam results for Cara.

Function VLOOKUP

Basic Description

The Excel VLOOKUP function 'looks up' a given value in the left-hand column of a data array (or
table), and returns the corresponding value from another column of the array.

The syntax of the function is:

VLOOKUP( lookup_value, table_array, col_index_num, [range_lookup] )

where the arguments are as follows:

lookup_value - The value that you want to look up.

table_array - The data array or table, containing the search values in the left hand columns
and the values to return in another column.

col_index_num - The column number, within the supplied table_array, that you want to return
a value from.

[range_lookup] - An optional logical argument, that describes what the function should return
in the event that it does not find an exact match to the lookup_value.

The [range_lookup] can be set to TRUE or FALSE, meaning:

TRUE - If the function cannot find an exact match to the supplied lookup_value, it should use
the closest match below the supplied value.
Note: if this option is used, the left-hand column of the table_array must be in
ascending order.

FALSE - If the function cannot find an exact match to the supplied lookup_value, it should
return an error.
Example 1 - Vlookup Requiring an Exact Match
Columns A and B of the spreadsheet below list an inventory of grocery items and their prices. Cell E2
of the spreadsheet shows a simple example of the Vlookup function being used to look up the price
of an item from the inventory.

A B C D E

1 Item Description Cost ($) Current Item: Current Item Cost ($)

- returns the
2 Tinned Tomatoes $0.90 Cornflakes =VLOOKUP( D2, A:B, 2, FALSE ) value $3.50

3 Tinned Tuna $1.50

4 Cornflakes $3.50

5 Shortcake Biscuits $1.00

6 Toothpaste $4.10

7 Tinned Baked Beans $0.99

8 White Sliced Bread $0.80

. .
. .
9 . .

The above Vlookup function returns the price for "Cornflakes", which is $3.50.

In this example:

The lookup_value is the text string "Cornflakes", which is located in cell D2;

The table_array is columns A-B of the spreadsheet;

The col_index_num is set to 2, to denote that the value returned should be taken from column 2 of
the table_array;

The [range_lookup] argument is set to FALSE, to indicate that we only want a result to be returned if
an exact match to the lookup_value is found.

Das könnte Ihnen auch gefallen