You are on page 1of 51

SYNTAX AND PURPOSE OF FUNCTIONS

1.
i.

Mathematical Functions

ABS: Returns the absolute value of a number. The absolute value of a number is the number without its
sign.

= ABS(number) Number: (Required) the real number of which you want the absolute value. Eg:
Formula =ABS(2) =ABS(-2) =ABS(A2) Description (Result) Absolute value of 2 (2) Absolute value of -2 (2) Absolute value of -4 (4) Suppose A2 contains - 4

ii. INT:
integer.

Rounds a number

down

to

the

nearest

=int(number) Number: (Required) the real number you want to round down to an integer. Eg:
Formula INT(8.9) =INT(-8.9) =A2-INT(A2) Description (Result) Rounds 8.9 down (8) Rounds -8.9 down (-9) Returns the decimal part of a positive real number in cell A2 (0.5) Suppose A2 contains 19.5

iii. MOD: Returns the remainder after number is divided by divisor. The result has the same sign as divisor.
The MOD function syntax has the following arguments: Number Required. The number for which you want to find the remainder. Divisor Required If divisor is 0, MOD returns the #DIV/0! error value. The MOD function can be expressed in terms of the INT function:
MOD(n, d) = n - d*INT(n/d)
Formula =MOD(3, 2) =MOD(-3, 2) =MOD(3, -2) =MOD(-3, -2) Description (Result) Remainder of 3/2 (1) Remainder of -3/2. The sign is the same as divisor (1) Remainder of 3/-2. The sign is the same as divisor (-1) Remainder of -3/-2. The sign is the same as divisor (-1)

iv.

Power: Returns the result of a number raised to a power.


POWER(number, power)
Number Required. The base number. It can be any real number. Power Required. The exponent to which the base number is raised. The "^" operator can be used instead of POWER to indicate to what power the base number is to be raised, such as in 5^2.
1 2 A Formula B Description (Result)

3 4

=POWER(5,2) =POWER(98.6,3.2) =POWER(4,5/4) 4

5 squared (25) 98.6 raised to the power of 3.2 (2401077) raised to the power of 5/4 (5.656854)

v. Product: The PRODUCT function multiplies all the numbers given as arguments and returns the product.
For example, if cells A1 and A2 contain numbers, you can use the formula =PRODUCT(A1, A2) to multiply those two numbers together. You can also perform the same operation by using the multiply (*) mathematical operator; for example, =A1 * A2. The PRODUCT function is useful when you need to multiply many cells together. For example, the formula =PRODUCT(A1:A3, C1:C3) is equivalent to =A1 * A2 * A3 * C1 * C2 * C3.

PRODUCT(number1, [number2], ...) number1 Required. The first number or range that you want to multiply. number2, ... Optional. Additional numbers or ranges that you want to multiply, up to a maximum of 255 arguments. NOTE If an argument is an array or reference, only numbers in the array or reference are multiplied. Empty cells, logical values, and text in the array or reference are ignored.
1 2 3 4 5 6 7 A Data 5 15 30 Formula =PRODUCT(A2:A4) =PRODUCT(A2:A4, 2) =A2*A3*A4 8 Description Multiplies the numbers in cells A2 through A4. Multiplies the numbers in cells A2 through A4, and then multiplies that result by 2. Multiplies the numbers in cells A2 through A4 by using mathematical operators instead of the PRODUCT function. Result 2250 4500 B C

Vi. Round: The ROUND function rounds a number to a specified number of digits. For example, if cell A1
contains 23.7825, and you want to round that value to two decimal places, you can use the following formula:

=ROUND(A1, 2) The result of this function is 23.78. ROUND(number, num_digits) The ROUND function syntax has the following arguments: number Required. The number that you want to round. num_digits Required. The number of digits to which you want to round the number argument. If num_digits is greater than 0 (zero), then number is rounded to the specified number of decimal places. If num_digits is 0, the number is rounded to the nearest integer. If num_digits is less than 0, the number is rounded to the left of the decimal point. To always round up (away from zero), use the ROUNDUP function. To always round down (toward zero), use the ROUNDDOWN function. To round a number to a specific multiple (for example, to round to the nearest 0.5), use the MROUND function.
1 A Formula B Description C Result

2 3 4 5

=ROUND(2.15, 1) =ROUND(2.149, 1) =ROUND(-1.475, 2) =ROUND(21.5, -1)

Rounds 2.15 to one decimal place Rounds 2.149 to one decimal place Rounds -1.475 to two decimal places Rounds 21.5 to one decimal place to the left of the decimal point

2.2 2.1 -1.48

VII. Sign: Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is
0, and -1 if the number is negative.

SIGN(number)
Number Required. Any real number.
1 2 3 4 A Formula =SIGN(10) =SIGN(4-4) =SIGN(-0.00001) B Description (Result) Sign of a positive number (1) Sign of zero (0) Sign of a negative number (-1)

VII.

SQRT: Returns a positive square root.


SQRT(number)

The SQRT function syntax has the following arguments: Number Required. The number for which you want the square root. If number is negative, SQRT returns the
1 2 3 4 5 6 A Data -16 Formula =SQRT(16) =SQRT(A2) =SQRT(ABS(A2)) Description (Result) Square root of 16 (4) B

#NUM!

error

value.

Square root of the number above. Because the number is negative, an error is returned (#NUM!) Square root of the absolute value of the number above (4)

VIII.

Subtotal : Returns a subtotal in a list or database. It is generally easier to create a list with subtotals
by using the Subtotal command in the Outline group on the Data tab. Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.

SUBTOTAL(function_num,ref1,[ref2],...])
The SUBTOTAL function syntax has the following arguments: Function_num Required. The number 1 to 11 (includes hidden values) or 101 to 111 (ignores hidden values) that specifies which function to use in calculating subtotals within a list.
Function_num (includes hidden values) 1 2 3 Function_num (ignores hidden values) 101 102 103 Function AVERAGE COUNT COUNTA

4 5 6 7 8 9 10 11

104 105 106 107 108 109 110 111

MAX MIN PRODUCT STDEV STDEVP SUM VAR VARP

Ref1 Required. The first named range or reference for which you want the subtotal. Ref2,... Optional. Named ranges or references 2 to 254 for which you want the subtotal. If there are other subtotals within ref1, ref2, (or nested subtotals), these nested subtotals are ignored to avoid double counting. For the function_num constants from 1 to 11, the SUBTOTAL function includes the values of rows hidden by the Hide Rows command under the Hide & Unhide submenu of the Format command in the Cells group on the Home tab. Use these constants when you want to subtotal hidden and nonhidden numbers in a list. For the function_Num constants from 101 to 111, the SUBTOTAL function ignores values of rows hidden by the Hide Rows command. Use these constants when you want to subtotal only nonhidden numbers in a list.

The SUBTOTAL function ignores any rows that are not included in the result of a filter, no matter which function_num value you use. The SUBTOTAL function is designed for columns of data, or vertical ranges. It is not designed for rows of data, or horizontal ranges. For example, when you subtotal a horizontal range using a function_num of 101 or greater, such as SUBTOTAL(109,B2:G2), hiding a column does not affect the subtotal. But, hiding a row in a subtotal of a vertical range does affect the subtotal. If any of the references are 3-D references, SUBTOTAL returns the #VALUE! error value.
1 2 3 4 5 6 7 8 A Data 120 10 150 23 Formula =SUBTOTAL(9,A2:A5) =SUBTOTAL(1,A2:A5) Description (Result) Subtotal of the column above using the SUM function (303) Subtotal of the column above using the AVERAGE function (75.75) B

IX.

Sum

The SUM function adds all the numbers that you specify as arguments. Each argument can be a range, a cell reference, an array, a constant, a formula, or the result from another function. For example, SUM(A1:A5) adds all the numbers that are contained in cells A1 through A5. For another example, SUM(A1, A3, A5) adds the numbers that are contained in cells A1, A3, and A5.

SUM(number1,[number2],...]) The SUM function syntax has the following arguments: number1 Required. The first number argument that you want to add. number2,,... Optional. Number arguments 2 to 255 that you want to add. If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, or text in the array or reference are ignored.

If any arguments are error values, or if any arguments are text that cannot be translated into numbers, Excel displays an error.
1 2 3 4 5 6 7 8 A Data -5 15 30 '5 TRUE Formula =SUM(3, 2) =SUM("5", 15, TRUE) 9 10 =SUM(A2:A4) =SUM(A2:A4, 15) =SUM(A5,A6, 2) Description Adds 3 and 2. Adds 5, 15 and 1. The text value "5" is first translated into a number, and the logical value TRUE is first translated into the number 1. Adds the values in cells A2 through A4. Adds the values in cells A2 through A4, and then adds 15 to that result. Adds the values in cells A5 and A6, and then adds 2 to that result. Because non-numeric values in references are not translated the value in cell A5 ('5) and the value in cell A6 (TRUE) are both treated as text the values in those cells are ignored. Result 5 21 40 55 B C

11

12

X.

Sumif

You use the SUMIF function to sum the values in a range that meet criteria that you specify. For example, suppose that in a column that contains numbers, you want to sum only the values that are larger than 5. You can use the following formula:

=SUMIF(B2:B25,">5") In this example, the criteria is applied the same values that are being summed. If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John." SUMIF(range, criteria, [sum_range]) The SUMIF function syntax has the following arguments: range Required. The range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. criteria Required. The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added. For example, criteria can be expressed as 32, ">32", B5, 32, "32", "apples", or TODAY(). IMPORTANT Any text criteria or any criteria that includes logical or mathematical symbols must be enclosed in double quotation marks ("). If the criteria is numeric, double quotation marks are not required. sum_range Optional. The actual cells to add, if you want to add cells other than those specified in the range argument. If the sum_range argument is omitted, Excel adds the cells that are specified in the range argument (the same cells to which the criteria is applied).
NOTES

The sum_range argument does not have to be the same size and shape as the range argument. The actual cells that are added are determined by using theupper leftmost cell in the sum_range argument

as the beginning cell, and then including cells that correspond in size and shape to the range argument. For example:
If range is A1:A5 A1:A5 A1:B4 A1:B4 And sum_range is B1:B5 B1:B3 C1:D4 C1:C2 Then the actual cells are B1:B5 B1:B5 C1:D4 C1:D4

You can use the wildcard characters the question mark (?) and asterisk (*) as the criteria argument. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.
1 2 3 4 5 6 7 8 9 =SUMIF(A2:A5,">" & C2,B2:B5) 10 1 2 3 4 5 6 7 8 9 10 =SUMIF(B2:B7,"*es",C2:C7) 11 12 =SUMIF(A2:A7,"",C2:C7) Vegetables Fruits Formula =SUMIF(A2:A7,"Fruits",C2:C7) =SUMIF(A2:A7,"Vegetables",C2:C7) A Category Vegetables Vegetables Fruits B Food Tomatoes Celery Oranges Butter Carrots Apples Description Sum of the sales of all foods in the "Fruits" category. Sum of the sales of all foods in the "Vegetables" category. Sum of the sales of all foods that end in "es" (Tomatoes, Oranges, and Apples). Sum of the sales of all foods that do not have a category specified. C Sales 2300 5500 800 400 4200 1200 Result 2000 12000 4300 A Property Value 100,000 200,000 300,000 400,000 Formula =SUMIF(A2:A5,">160000",B2:B5) =SUMIF(A2:A5,">160000") =SUMIF(A2:A5,300000,B2:B5) B Commission 7,000 14,000 21,000 28,000 Description Sum of the commissions for property values over 160,000. Sum of the property values over 160,000. Sum of the commissions for property values equal to 300,000. Sum of the commissions for property values greater than the value in C2. Result 63,000 900,000 21,000 49,000 C Data 250,000

Subtotal
Returns a subtotal in a list or database. It is generally easier to create a list with subtotals by using the Subtotal command in the Outline group on the Data tab. Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.

SUBTOTAL(function_num,ref1,[ref2],...]) The SUBTOTAL function syntax has the following arguments: Function_num Required. The number 1 to 11 (includes hidden values) or 101 to 111 (ignores hidden values) that specifies which function to use in calculating subtotals within a list.
Function_num (includes hidden values) 1 2 3 4 5 6 7 8 9 10 11 Function_num (ignores hidden values) 101 102 103 104 105 106 107 108 109 110 111 Function AVERAGE COUNT COUNTA MAX MIN PRODUCT STDEV STDEVP SUM VAR VARP

Example
1 2 3 4 5

Ref1 Required. The first named range or reference for which you want the subtotal. Ref2,... Optional. Named ranges or references 2 to 254 for which you want the subtotal. If there are other subtotals within ref1, ref2, (or nested subtotals), these nested subtotals are ignored to avoid double counting. For the function_num constants from 1 to 11, the SUBTOTAL function includes the values of rows hidden by the Hide Rows command under the Hide & Unhide submenu of the Format command in the Cells group on the Home tab. Use these constants when you want to subtotal hidden and nonhidden numbers in a list. For the function_Num constants from 101 to 111, the SUBTOTAL function ignores values of rows hidden by the Hide Rows command. Use these constants when you want to subtotal only nonhidden numbers in a list. The SUBTOTAL function ignores any rows that are not included in the result of a filter, no matter which function_num value you use. The SUBTOTAL function is designed for columns of data, or vertical ranges. It is not designed for rows of data, or horizontal ranges. For example, when you subtotal a horizontal range using a function_num of 101 or greater, such as SUBTOTAL(109,B2:G2), hiding a column does not affect the subtotal. But, hiding a row in a subtotal of a vertical range does affect the subtotal. If any of the references are 3-D references, SUBTOTAL returns the #VALUE! error value.

A Data 120 10 150 23

6 7 8

Formula =SUBTOTAL(9,A2:A5) =SUBTOTAL(1,A2:A5)

Description (Result) Subtotal of the column above using the SUM function (303) Subtotal of the column above using the AVERAGE function (75.75)

II.
i.

Statistical Functions

Average:

Returns the average (arithmetic mean) of the arguments. For example, if the range A1:A20 contains numbers, the formula =AVERAGE(A1:A20) returns the average of those numbers.

AVERAGE(number1, [number2], ...) The AVERAGE function syntax has the following arguments: Number1 Required. The first number, cell reference, or range for which you want the average. Number2, ... Optional. Additional numbers, cell references or ranges for which you want the average, up to a maximum of 255. Arguments can either be numbers or names, ranges, or cell references that contain numbers. Logical values and text representations of numbers that you type directly into the list of arguments are counted. If a range or cell reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included. Arguments that are error values or text that cannot be translated into numbers cause errors.
1 2 3 4 5 6 7 8 9 10 A Data 10 7 9 27 2 Formula =AVERAGE(A2:A6) =AVERAGE(A2:A6, 5) =AVERAGE(A2:C2) Description Average of the numbers in cells A2 through A6. Average of the numbers in cells A2 through A6 and the number 5. Average of the numbers in cells A2 through C2. Result 11 10 15 32 B C

ii.

Averagea: Calculates the average (arithmetic mean) of the values in the list of arguments. AVERAGEA(value1, [value2], ...) The AVERAGEA function syntax has the following arguments: Value1, value2, ... Value1 is required, subsequent values are optional. 1 to 255 cells, ranges of cells, or values for which you want the average. Arguments can be the following: numbers; names, arrays, or references that contain numbers; text representations of numbers; or logical values, such as TRUE and FALSE, in a reference.

Logical values and text representations of numbers that you type directly into the list of arguments are counted. Arguments that contain TRUE evaluate as 1; arguments that contain FALSE evaluate as 0 (zero). Array or reference arguments that contain text evaluate as 0 (zero). Empty text ("") evaluates as 0 (zero). If an argument is an array or reference, only values in that array or reference are used. Empty cells and text values in the array or reference are ignored. Arguments that are error values or text that cannot be translated into numbers cause errors. If you do not want to include logical values and text representations of numbers in a reference as part of the calculation, use the AVERAGE function.
1 2 3 4 5 6 7 A Data 10 7 9 2 Not available Formula =AVERAGEA(A2:A6) 8 =AVERAGEA(A2:A5,A7) 9 Description (Result) Average of the numbers above, and the text "Not Available". The cell with the text "Not available" is used in the calculation. (5.6) Average of the numbers above, and the empty cell. (7) B

iii.

MAX : MAX(number1,

[number2], ...)

The MAX function syntax has the following arguments: Number1, number2, ... Number1 is required, subsequent numbers are optional. 1 to 255 numbers for which you want to find the maximum value. Arguments can either be numbers or names, arrays, or references that contain numbers. Logical values and text representations of numbers that you type directly into the list of arguments are counted. If an argument is an array or reference, only numbers in that array or reference are used. Empty cells, logical values, or text in the array or reference are ignored. If the arguments contain no numbers, MAX returns 0 (zero). Arguments that are error values or text that cannot be translated into numbers cause errors.
1 2 3 4 5 6 7 8 9 A Data 10 7 9 27 2 Formula =MAX(A2:A6) =MAX(A2:A6, 30) Description (Result) Largest of the numbers above (27) Largest of the numbers above and 30 (30) B

iv.

MAXA:Returns the largest value in a list of arguments.


MAXA(value1,[value2],...)

The MAXA function syntax has the following arguments: Value1 Required. The first number argument for which you want to find the largest value. Value2,... Optional. Number arguments 2 to 255 for which you want to find the largest value. Arguments can be the following: numbers; names, arrays, or references that contain numbers; text representations of numbers; or logical values, such as TRUE and FALSE, in a reference. Logical values and text representations of numbers that you type directly into the list of arguments are counted. If an argument is an array or reference, only values in that array or reference are used. Empty cells and text values in the array or reference are ignored. Arguments that are error values or text that cannot be translated into numbers cause errors. Arguments that contain TRUE evaluate as 1; arguments that contain text or FALSE evaluate as 0 (zero). If the arguments contain no values, MAXA returns 0 (zero).

V. MIN
Returns the smallest value in the list of arguments.

MINA(value1, [value2], ...) The MINA function syntax has the following arguments: Value1, value2, ... Value1 is required, subsequent values are optional. 1 to 255 values for which you want to find the smallest value. Arguments can be the following: numbers; names, arrays, or references that contain numbers; text representations of numbers; or logical values, such as TRUE and FALSE, in a reference. If an argument is an array or reference, only values in that array or reference are used. Empty cells and text values in the array or reference are ignored. Arguments that contain TRUE evaluate as 1; arguments that contain text or FALSE evaluate as 0 (zero). Arguments that are error values or text that cannot be translated into numbers cause errors. If the arguments contain no values, MINA returns 0.
1 2 3 4 5 6 7 8 A Data FALSE 0.2 0.5 0.4 0.8 Formula =MINA(A2:A6) Description (Result) Smallest of the numbers above. FALSE evaluates to 0 (0) B

VI. STDEV
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).

STDEV(number1,[number2],...]) The STDEV function syntax has the following arguments: Number1 Required. The first number argument corresponding to a sample of a population. Number2, ... Optional. Number arguments 2 to 255 corresponding to a sample of a population. You can also use a single array or a reference to an array instead of arguments separated by commas. STDEV assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the standard deviation using STDEVP.

The standard deviation is calculated using the "n-1" method. Arguments can either be numbers or names, arrays, or references that contain numbers. Logical values and text representations of numbers that you type directly into the list of arguments are counted. If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored. Arguments that are error values or text that cannot be translated into numbers cause errors. If you want to include logical values and text representations of numbers in a reference as part of the calculation, use the STDEVA function. STDEV uses the following formula:

where x is the sample mean AVERAGE(number1,number2,) and n is the sample size.


1 2 3 4 5 6 7 8 9 10 11 12 13 A Strength 1345 1301 1368 1322 1310 1370 1318 1350 1303 1299 Formula =STDEV(A2:A11) Description (Result) Standard deviation of breaking strength (27.46392)

Vii. VAR
Estimates variance based on a sample.

VAR(number1,[number2],...]) The VAR function syntax has the following arguments: Number1 Required. The first number argument corresponding to a sample of a population. Number2, ... Optional. Number arguments 2 to 255 corresponding to a sample of a population. VAR assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the variance by using VARP. Arguments can either be numbers or names, arrays, or references that contain numbers. Logical values, and text representations of numbers that you type directly into the list of arguments are counted. If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored. Arguments that are error values or text that cannot be translated into numbers cause errors. If you want to include logical values and text representations of numbers in a reference as part of the calculation, use the VARA function. VAR uses the following formula:

where x is the sample mean AVERAGE(number1,number2,) and n is the sample size.

1 2 3 4 5 6 7 8 9 10 11 12 13

A Strength 1345 1301 1368 1322 1310 1370 1318 1350 1303 1299 Formula =VAR(A2:A11) Description (Result) Variance for the breaking strength of the tools (754.2667)

vii. Count
The COUNT function counts the number of cells that contain numbers, and counts numbers within the list of arguments. Use the COUNT function to get the number of entries in a number field that is in a range or array of numbers. For example, you can enter the following formula to count the numbers in the range A1:A20:

=COUNT(A1:A20) COUNT(value1, [value2], ...) The COUNT function syntax has the following arguments: value1 Required. The first item, cell reference, or range within which you want to count numbers. value2, ... Optional. Up to 255 additional items, cell references, or ranges within which you want to count numbers. Arguments that are numbers, dates, or a text representation of numbers (for example, a number enclosed in quotation marks, such as "1") are counted. Logical values and text representations of numbers that you type directly into the list of arguments are counted. Arguments that are error values or text that cannot be translated into numbers are not counted. If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are not counted. If you want to count logical values, text, or error values, use the COUNTA function. If you want to count only numbers that meet certain criteria, use the COUNTIF function or the COUNTIFS function.
1 2 3 4 5 6 7 A Data Sales 12/8/2008 19 22.24 TRUE B C

8 9 10

#DIV/0! Formula =COUNT(A2:A8) =COUNT(A5:A8) Description Counts the number of cells that contain numbers in cells A2 through A8. Counts the number of cells that contain numbers in cells A5 through A8. Counts the number of cells that contain numbers in cells A2 through A8, and the value 2 Result 3 2 4

11 =COUNT(A2:A8,2) 12

viii. COUNTA
The COUNTA function counts the number of cells that are not empty in a range.

COUNTA(value1, [value2], ...) The COUNTA function syntax has the following arguments: value1 Required. The first argument representing the values that you want to count. value2, ... Optional. Additional arguments representing the values that you want to count, up to a maximum of 255 arguments. The COUNTA function counts cells containing any type of information, including error values and empty text (""). For example, if the range contains a formula that returns an empty string, the COUNTA function counts that value. The COUNTA function does not count empty cells. If you do not need to count logical values, text, or error values (in other words, if you want to count only cells that contain numbers), use the COUNT function. If you want to count only cells that meet certain criteria, use the COUNTIF function or the COUNTIFS function.
1 2 3 4 5 6 7 8 9 10 A Data Sales 12/8/2008 19 22.24 TRUE #DIV/0! Formula =COUNTA(A2:A8) Description Counts the number of nonblank cells in cells A2 through A8. Result B C

ix. Countblank
Counts empty cells in a specified range of cells.

COUNTBLANK(range) The COUNTBLANK function syntax has the following arguments: Range Required. The range from which you want to count the blank cells. Cells with formulas that return "" (empty text) are also counted. Cells with zero values are not counted. 1.
1 A Data B Data

2 3 4 5 6 7

=IF(B4<30,"",B4) 27

4 Formula =COUNTBLANK(A2:B5)

34 Description (Result) Counts empty cells in the range above. The formula returns empty text. (4)

x. Countif
The COUNTIF function counts the number of cells within a range that meet a single criterion that you specify. For example, you can count all the cells that start with a certain letter, or you can count all the cells that contain a number that is larger or smaller than a number you specify. For example, suppose you have a worksheet that contains a list of tasks in column A, and the first name of the person assigned to each task in column B. You can use the COUNTIF function to count how many times a person's name appears in column B and, in that way, determine how many tasks are assigned to that person. For example:

=COUNTIF(B2:B25,"Nancy") COUNTIF(range, criteria) The COUNTIF function syntax has the following arguments: range Required. One or more cells to count, including numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. criteria Required. A number, expression, cell reference, or text string that defines which cells will be counted. For example, criteria can be expressed as 32, ">32", B4, "apples", or "32". You can use the wildcard characters the question mark (?) and the asterisk (*) in criteria. A question mark matches any single character, and an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character. Criteria are case insensitive; for example, the string "apples" and the string "APPLES" will match the same cells.
1 2 3 4 5 6 7 8 9 10 11 A Data apples oranges peaches apples Formula =COUNTIF(A2:A5,"apples") =COUNTIF(A2:A5,A4) =COUNTIF(A2:A5,A3)+COUNTIF(A2:A5,A2) =COUNTIF(B2:B5,">55") =COUNTIF(B2:B5,"<>"&B4) =COUNTIF(B2:B5,">=32")COUNTIF(B2:B5,">85") B Data 32 54 75 86 Description Number of cells with apples in cells A2 through A5. Number of cells with peaches in cells A2 through A5. Number of cells with oranges and apples in cells A2 through A5. Number of cells with a value greater than 55 in cells B2 through B5. Number of cells with a value not equal to 75 in cells B2 through B5. Number of cells with a value greater than or equal to 32 and less than or equal to 85 Result 2 1 3 2 3 3 C

12

in cells B2 through B5.

EXAMPLE 2: COUNTIF FORMULAS USING WILDCARD CHARACTERS AND HANDLING BLANK VALUES
1 2 3 4 5 6 7 8 A Data apples oranges peaches apples Formula =COUNTIF(A2:A7,"*es") =COUNTIF(A2:A7,"?????es") 9 =COUNTIF(A2:A7,"*") =COUNTIF(A2:A7,"<>"&"*") =COUNTIF(B2:B7,"No") / ROWS(B2:B7) 11 =COUNTIF(B2:B7,"Yes") / (ROWS(B2:B7) COUNTIF(B2:B7, "<>"&"*")) B Data Yes NO No yes Description Number of cells ending with the letters "es" in cells A2 through A7. Number of cells ending with the letters "les" and having exactly 7 letters in cells A2 through A7. Number of cells containing any text in cells A2 through A7. Number of cells not containing text in cells A2 through A7. The average number of No votes (including blank cells) in cells B2 through B7. The average number of Yes votes (excluding blank cells) in cells B2 through B7. Result 4 2 C

4 2 0.333333333

10

0.5

12

13

14

xi. Large
Returns the k-th largest value in a data set. You can use this function to select a value based on its relative standing. For example, you can use LARGE to return the highest, runner-up, or third-place score.

LARGE(array, k) The LARGE function syntax has the following arguments: Array Required. The array or range of data for which you want to determine the k-th largest value. K Required. The position (from the largest) in the array or cell range of data to return. If array is empty, LARGE returns the #NUM! error value. If k 0 or if k is greater than the number of data points, LARGE returns the #NUM! error value. If n is the number of data points in a range, then LARGE(array,1) returns the largest value, and LARGE(array,n) returns the smallest value. 1.

1 2 3 4 5 6 7 8 9

A Data 3 5 3 5 4 Formula =LARGE(A2:B6,3) =LARGE(A2:B6,7)

B Data 4 2 4 6 7 Description (Result) 3rd largest number in the numbers above (5) 7th largest number in the numbers above (4)

xii. Small
Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set.

SMALL(array, k) The SMALL function syntax has the following arguments: Array Required. An array or range of numerical data for which you want to determine the k-th smallest value. K Required. The position (from the smallest) in the array or range of data to return. If array is empty, SMALL returns the #NUM! error value. If k 0 or if k exceeds the number of data points, SMALL returns the #NUM! error value. If n is the number of data points in array, SMALL(array,1) equals the smallest value, and SMALL(array,n) equals the largest value.
1 2 3 4 5 6 7 8 9 10 11 12 13 A Data 3 4 5 2 3 4 6 4 7 Formula =SMALL(A2:A10,4) =SMALL(B2:B10,2) B Data 1 4 8 3 7 12 54 8 23 Description (Result) 4th smallest number in first column (4) 2nd smallest number in the second column (3)

Frequency

Calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula.

FREQUENCY(data_array, bins_array) The FREQUENCY function syntax has the following arguments: Data_array Required. An array of or reference to a set of values for which you want to count frequencies. If data_array contains no values, FREQUENCY returns an array of zeros. Bins_array Required. An array of or reference to intervals into which you want to group the values in data_array. If bins_array contains no values, FREQUENCY returns the number of elements in data_array. FREQUENCY is entered as an array formula after you select a range of adjacent cells into which you want the returned distribution to appear. The number of elements in the returned array is one more than the number of elements in bins_array. The extra element in the returned array returns the count of any values above the highest interval. For example, when counting three ranges of values (intervals) that are entered into three cells, be sure to enter FREQUENCY into four cells for the results. The extra cell returns the number of values in data_array that are greater than the third interval value. FREQUENCY ignores blank cells and text. Formulas that return arrays must be entered as array formulas.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A Scores 79 85 78 85 50 81 95 88 97 Formula =FREQUENCY(A2:A10, B2:B4) Description (Result) Number of scores less than or equal to 70 (1) Number of scores in the bin 71-79 (2) Number of scores in the bin 80-89 (4) Number of scores greater than or equal to 90 (2) B Bins 70 79 89

NOTE The formula in the example must be entered as an array formula. After copying the example to a blank worksheet, select the range A12:A15, press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, there will be only one result in cell A12 (1).

Transpose
The TRANSPOSE function returns a vertical range of cells as a horizontal range, or vice versa. The TRANSPOSE function must be entered as an array formula in a range that has the same number of rows and columns, respectively, as the source range has columns and rows. Use TRANSPOSE to shift the vertical and horizontal orientation of an array or range on a worksheet.

TRANSPOSE(array) The TRANSPOSE function syntax has the following argument: array Required. An array or range of cells on a worksheet that you want to transpose. The transpose of an array is created by using the first row of the array as the first column of the new array, the second row of the array as the second column of the new array, and so on.

EXAMPLE 1

1 2 3 4 5 6

Data 1 Formula =TRANSPOSE($A$2:$C$2)

Data 2 Description Value from first column Value from second column Value from third column

Data 3 Result 1 2 3

IMPORTANT The formula shown in the example must be entered as an array formula for the TRANSPOSE function to work as expected. After copying the example to a blank worksheet, select the range A4:A6, starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the single result is 1.

EXAMPLE 2

Some functions, such as LINEST, return horizontal arrays. The LINEST function returns a horizontal array of the slope and Y-intercept for a line. The following formula returns a vertical array of the slope and Y-intercept by using the LINEST function.
1 2 3 4 5 6 7 8 A Known y 1 9 5 7 Formula =TRANSPOSE(LINEST(A2:A5,B2:B5,,FALSE)) B Known x 0 4 2 3 Description Slope Y-intercept Result 2 1 C

IMPORTANT The formula shown in the example must be entered as an array formula for the TRANSPOSE function to work as expected. After copying the example to a blank worksheet, select the range A7:A8, starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the single result is 2.

Text Functions
a. LEN
LEN returns the number of characters in a text string. LEN always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

LEN(text) Text Required. The text whose length you want to find. Spaces count as characters.

Example
1 2 A Data B

3 4 5 6 7 8

Phoenix, AZ One Formula =LEN(A2) =LEN(A3) =LEN(A4) Description (Result) Length of the first string (11) Length of the second string (0) Length of the third string, which includes 5 spaces (8)

b.

LEFT

LEFT returns the first character or characters in a text string, based on the number of characters you specify. LEFT always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

LEFT(text, [num_chars]) Text Required. The text string that contains the characters you want to extract. Num_chars Optional. Specifies the number of characters you want LEFT to extract. Num_chars must be greater than or equal to zero. If num_chars is greater than the length of text, LEFT returns all of text. If num_chars is omitted, it is assumed to be 1. Num_bytes Optional. Specifies the number of characters you want LEFTB to extract, based on bytes.

Example
1 2 3 4 5 6

A Data Sale Price Sweden Formula =LEFT(A2,4) =LEFT(A3)

Description (Result) First four characters in the first string (Sale) First character in the second string (S)

c.

RIGHT

RIGHT returns the last character or characters in a text string, based on the number of characters you specify. RIGHT always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

RIGHT(text,[num_chars]) Text Required. The text string containing the characters you want to extract. Num_chars Optional. Specifies the number of characters you want RIGHT to extract. Num_chars must be greater than or equal to zero. If num_chars is greater than the length of text, RIGHT returns all of text. If num_chars is omitted, it is assumed to be 1.

Example
1 2 A Data B

3 4 5 6

Sale Price Stock Number Formula =RIGHT(A2,5) =RIGHT(A3) Description (Result) Last 5 characters of the first string (Price) Last character of the second string (r)

d.

MID

MID returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify. MID always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

MID(text, start_num, num_chars) Text Required. The text string containing the characters you want to extract. Start_num Required. The position of the first character you want to extract in text. The first character in text has start_num 1, and so on. Num_chars Required. Specifies the number of characters you want MID to return from text. If start_num is greater than the length of text, MID returns "" (empty text). If start_num is less than the length of text, but start_num plus num_chars exceeds the length of text, MID returns the characters up to the end of text. If start_num is less than 1, MID returns the #VALUE! error value. If num_chars is negative, MID returns the #VALUE! error value.

Example
1 2 3 4 5 6 A Data Fluid Flow Formula =MID(A2,1,5) =MID(A2,7,20) =MID(A2,20,5) Description (Result) Five characters from the string above, starting at the first character (Fluid) Twenty characters from the string above, starting at the seventh (Flow) Because the starting point is greater than the length of the string, empty text is returned () B

e.

Lower

Converts all uppercase letters in a text string to lowercase.

LOWER(text) The LOWER function syntax has the following arguments: Text Required. The text you want to convert to lowercase. LOWER does not change characters in text that are not letters.

Example
1 2 3 A Data E. E. Cummings B

4 5 6

Apt. 2B Formula =LOWER(A2) =LOWER(A3) Description (Result) Lower case of first string (e. e. cummings) Lower case of last string (apt. 2b)

f.

Upper

Converts text to uppercase.

UPPER(text) The UPPER function syntax has the following arguments: Text Required. The text you want converted to uppercase. Text can be a reference or text string.

Example
1 2 3 4 5 6 A Data total Yield Formula =UPPER(A2) =UPPER(A3) Description (Result) Upper case of first string (TOTAL) Upper case of second string (YIELD) B

g.

Proper

Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters.

PROPER(text) The PROPER function syntax has the following arguments: Text Required. Text enclosed in quotation marks, a formula that returns text, or a reference to a cell containing the text you want to partially capitalize.

Example
1 2 3 4 5 6 7 8 A Data this is a TITLE 2-cent's worth 76BudGet Formula =PROPER(A2) =PROPER(A3) =PROPER(A4) Description (Result) Proper case of first string (This Is A Title) Proper case of second string (2-Cent'S Worth) Proper case of third string (76Budget) B

h.

Search

The SEARCH and SEARCHB functions locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. For example, to find the position of the letter "n" in the word "printer", you can use the following function:

=SEARCH("n","printer") This function returns 4 because "n" is the fourth character in the word "printer." You can also search for words within other words. For example, the function =SEARCH("base","database") returns 5, because the word "base" begins at the fifth character of the word "database". You can use the SEARCH and SEARCHB functions to determine the location of a character or text string within another text string, and then use the MID and MIDB functions to return the text, or use the REPLACE and REPLACEB functions to change the text. These functions are demonstrated in Example 1 in this article. IMPORTANT The SEARCH function is intended for use with languages that use the single-byte character set (SBCS), whereas the SEARCHB function is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way: SEARCH always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is. SEARCH(find_text,within_text,[start_num]) The SEARCH function have the following arguments: find_text Required. The text that you want to find. within_text Required. The text in which you want to search for the value of the find_text argument. start_num Optional. The character number in the within_text argument at which you want to start searching.

Remark
The SEARCH functions is not case sensitive. If you want to do a case sensitive search, you can use FIND. You can use the wildcard characters the question mark (?) and asterisk (*) in the find_text argument. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character. If the value of find_text is not found, the #VALUE! error value is returned. If the start_num argument is omitted, it is assumed to be 1. If start_num is not greater than 0 (zero) or is greater than the length of the within_text argument, the #VALUE! error value is returned. Use start_num to skip a specified number of characters. Using the SEARCH function as an example, suppose you are working with the text string "AYF0093.YoungMensApparel". To find the position of the first "Y" in the descriptive part of the text string, set start_num equal to 8 so that the serial number portion of the text (in this case, "AYF0093") is not searched. The SEARCH function starts the search operation at the eighth character position, finds the character that is specified in the find_text argument at the next position, and returns the number 9. The SEARCH function always returns the number of characters from the start of the within_text argument, counting the characters you skip if the start_num argument is greater than 1.

Examples
1 2 3 4 5 6 A Data Statements Profit Margin Margin The "boss" is here. B C

Formula 7 =SEARCH("e",A2,6)

Description Position of first "e" in string in cell starting at sixth position. the the A2, the

Result 7

=SEARCH(A4,A3)

9 =REPLACE(A3,SEARCH(A4,A3),6,"Amount")

Position of "margin" (string for which to search is cell A4) in "Profit Margin" (cell in which to search is A3). Replaces "Margin" with "Amount" by first searching for the position of "Margin" in cell A3, and then replacing that character and the next five characters with the string "Amount." Returns the first four characters that follow the first space character in "Profit Margin" (cell A3). Position of the first double quotation mark (") in cell A5. Returns only the text enclosed in the double quotation marks in cell A5.

Profit Amount

10 11

12 =MID(A3,SEARCH(" ",A3)+1,4)

Marg

=SEARCH("""",A5)

=MID(A5,SEARCH("""",A5)+1,SEARCH("""",A5,SEARCH("""",A5)+1)SEARCH("""",A5)-1)

boss

i.

Find

FIND locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. FIND always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

FIND(find_text, within_text, [start_num]) The FIND function syntax has the following arguments: Find_text Required. The text you want to find. Within_text Required. The text containing the text you want to find. Start_num Optional. Specifies the character at which to start the search. The first character in within_text is character number 1. If you omit start_num, it is assumed to be 1. FIND is case sensitive and don't allow wildcard characters. If you don't want to do a case sensitive search or use wildcard characters, you can use SEARCH If find_text is "" (empty text), FIND matches the first character in the search string (that is, the character numbered start_num or 1).

Find_text cannot contain any wildcard characters. If find_text does not appear in within_text, FIND and FINDB return the #VALUE! error value. If start_num is not greater than zero, FIND and FINDB return the #VALUE! error value. If start_num is greater than the length of within_text, FIND and FINDB return the #VALUE! error value. Use start_num to skip a specified number of characters. Using FIND as an example, suppose you are working with the text string "AYF0093.YoungMensApparel". To find the number of the first "Y" in the descriptive part of the text string, set start_num equal to 8 so that the serial-number portion of the text is not searched. FIND begins with character 8, finds find_text at the next character, and returns the number 9. FIND always returns the number of characters from the start of within_text, counting the characters you skip if start_num is greater than 1.

Example
1 2 3 4 5 6 A Data Miriam McGovern Formula =FIND("M",A2) =FIND("m",A2) =FIND("M",A2,3) Description (Result) Position of the first "M" in the string above (1) Position of the first "m" in the string above (6) Position of the first "M" in the string above, starting with the third character (8) B

Concatenate
The CONCATENATE function joins up to 255 text strings into one text string. The joined items can be text, numbers, cell references, or a combination of those items. For example, if your worksheet contains a person's first name in cell A1 and the person's last name in cell B1, you can combine the two values in another cell by using the following formula:

=CONCATENATE(A1," ",B1) The second argument in this example (" ") is a space character. You must specify any spaces or punctuation that you want to appear in the results as an argument that is enclosed in quotation marks.

Syntax
CONCATENATE(text1, [text2], ...) The CONCATENATE function syntax has the following arguments: Text1 Required. The first text item to be concatenated. Text2, ... Optional. Additional text items, up to a maximum of 255 items. The items must be separated by commas. NOTE You can also use the ampersand (&) calculation operator instead of the CONCATENATE function to join text items. For example,
=A1 & B1

returns the same value as


=CONCATENATE(A1, B1)
1 2 3 4 5 A Data brook trout Species 32 Formula Description Result Andreas Fourth Hauser Pine B C

=CONCATENATE("Stream population for ", A2, " ", A3, " is ", A4, "/mile") 6 =CONCATENATE(B2, " ", C2) =CONCATENATE(C2, ", ", B2) 7 =CONCATENATE(B3, " & ", C3)

Creates a sentence by concatenating the data in column A with other text. Concatenates the string in cell B2, a space character, and the value in cell C2. Concatenates the string in cell C2, a string consisting of a comma and a space character, and the value in cell B2. Concatenates the string in cell B3, a string consisting of a space, an ampersand, another space, and the value in cell C3. Concatenates the same items as the previous example, but by using the ampersand (&) calculation operator instead of the CONCATENATE function.

Stream population for brook trout species is 32/mile Andreas Hauser Hauser, Andreas

Fourth & Pine

=B3 & " & " & C3

Replace
REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.

REPLACE(old_text, start_num, num_chars, new_text) REPLACEB(old_text, start_num, num_bytes, new_text) The REPLACE function syntax has the following arguments: Old_text Required. Text in which you want to replace some characters. Start_num Required. The position of the character in old_text that you want to replace with new_text. Num_chars Required. The number of characters in old_text that you want REPLACE to replace with new_text. Num_bytes Required. The number of bytes in old_text that you want REPLACEB to replace with new_text. New_text Required. The text that will replace characters in old_text.

Example
1 2 3 4 5 6 7 8 A Data abcdefghijk 2009 123456 Formula =REPLACE(A2,6,5,"*") =REPLACE(A3,3,2,"10") =REPLACE(A4,1,3,"@") Description (Result) Replaces five characters, starting with the sixth character (abcde*k) Replaces the last two digits of 2009 with 10 (2010) Replaces the first three characters with @ (@456) B

Substitute

Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.

Syntax
SUBSTITUTE(text, old_text, new_text, [instance_num]) The SUBSTITUTE function syntax has the following arguments: Text Required. The text or the reference to a cell containing text for which you want to substitute characters. Old_text Required. The text you want to replace. New_text Required. The text you want to replace old_text with. Instance_num Optional. Specifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.

Example
1 2 3 4 5 6 7 8 A Data Sales Data Quarter 1, 2008 Quarter 1, 2011 Formula =SUBSTITUTE(A2, "Sales", "Cost") =SUBSTITUTE(A3, "1", "2", 1) =SUBSTITUTE(A4, "1", "2", 3) B < < < < Description (Result) Substitutes Cost for Sales (Cost Data) Substitutes first instance of "1" with "2" (Quarter 2, 2008) Substitutes third instance of "1" with "2" (Quarter 1, 2012)

Trim
Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing. IMPORTANT The TRIM function was designed to trim the 7-bit ASCII space character (value 32) from text. In the Unicode character set, there is an additional space character called the nonbreaking space character that has a decimal value of 160. This character is commonly used in Web pages as the HTML entity, &nbsp;. By itself, the TRIM function does not remove this nonbreaking space character. For an example of how to trim both space characters from text, see Remove spaces and nonprinting characters from text.

Syntax
TRIM(text) The TRIM function syntax has the following arguments: Text Required. The text from which you want spaces removed.

Example
1 2 A Formula =TRIM(" First Quarter B Description (Result) Removes leading and trailing spaces from the text in the formula (First

Earnings ")

Quarter Earnings)

Code
Returns a numeric code for the first character in a text string. The returned code corresponds to the character set used by your computer.
Operating environment Macintosh Windows Character set Macintosh character set ANSI

Syntax
CODE(text) The CODE function syntax has the following arguments: Text Required. The text for which you want the code of the first character.
1 2 3 A Formula =CODE("A") =CODE("!") B Description (Result) Displays the numeric code for A (65) Displays the numeric code for ! (33)

Char
Returns the character specified by a number. Use CHAR to translate code page numbers you might get from files on other types of computers into characters.
Operating environment Macintosh Windows Character set Macintosh character set ANSI

Syntax
CHAR(number) The CHAR function syntax has the following arguments: Number Required. A number between 1 and 255 specifying which character you want. The character is from the character set used by your computer.

Example
1 2 3

A Formula =CHAR(65) =CHAR(33)

B Description (Result) Displays the 65 character in the set (A) Displays the 33 character in the set (!)

Look up Functions
Vlookup

You can use the VLOOKUP function to search the first column of a range of cells, and then return a value from any cell on the same row of the range. For example, suppose that you have a list of employees contained in the range A2:C10. The employees' ID numbers are stored in the first column of the range, as shown in the following illustration.

If you know the employee's ID number, you can use the VLOOKUP function to return either the department or the name of that employee. To obtain the name of employee number 38, you can use the formula =VLOOKUP(38, A2:C10, 3, FALSE). This formula searches for the value 38 in the first column of the range A2:C10, and then returns the value that is contained in the third column of the range and on the same row as the lookup value ("Axel Delgado"). The V in VLOOKUP stands for vertical. Use VLOOKUP instead of HLOOKUP when your comparison values are located in a column to the left of the data that you want to find.

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]) The VLOOKUP function syntax has the following arguments: lookup_value Required. The value to search in the first column of the table or range. The lookup_value argument can be a value or a reference. If the value you supply for the lookup_value argument is smaller than the smallest value in the first column of the table_array argument, VLOOKUP returns the #N/A error value. table_array Required. The range of cells that contains the data. You can use a reference to a range (for example, A2:D8), or a range name. The values in the first column of table_array are the values searched by lookup_value. These values can be text, numbers, or logical values. Uppercase and lowercase text are equivalent. col_index_num Required. The column number in the table_array argument from which the matching value must be returned. A col_index_num argument of 1 returns the value in the first column in table_array; a col_index_num of 2 returns the value in the second column in table_array, and so on. If the col_index_num argument is: Less than 1, VLOOKUP returns the #VALUE! error value. Greater than the number of columns in table_array, VLOOKUP returns the #REF! error value. range_lookup Optional. A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match: If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned. If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value. If range_lookup is FALSE, the values in the first column of table_array do not need to be sorted. If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned. When searching text values in the first column of table_array, ensure that the data in the first column of table_array does not contain leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and curly ( or ) quotation marks, or nonprinting characters. In these cases, VLOOKUP might return an incorrect or unexpected value.

For more information, see CLEAN function and TRIM function. When searching number or date values, ensure that the data in the first column of table_array is not stored as text values. In this case, VLOOKUP might return an incorrect or unexpected value. If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters the question mark (?) and asterisk (*) in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.
1 2 3 4 5 6 7 8 9 10 11 A Density 0.457 0.525 0.606 0.675 0.746 0.835 0.946 1.09 1.29 Formula =VLOOKUP(1,A2:C10,2) B Viscosity 3.55 3.25 2.93 2.75 2.57 2.38 2.17 1.95 1.71 Description Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A which is 0.946, and then returns the value from column B in the same row. Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A, which is 0.946, and then returns the value from column C in the same row. Using an exact match, searches for the value 0.7 in column A. Because there is no exact match in column A, an error is returned. Using an approximate match, searches for the value 0.1 in column A. Because 0.1 is less than the smallest value in column A, an error is returned. Using an approximate match, searches for the value 2 in column A, finds the largest value less than or equal to 2 in column A, which is 1.29, and then returns the value from column B in the same row. C Temperature 500 400 300 250 200 150 100 50 0 Result 2.17

12

=VLOOKUP(1,A2:C10,3,TRUE)

100

=VLOOKUP(0.7,A2:C10,3,FALSE) 13 =VLOOKUP(0.1,A2:C10,2,TRUE) 14 =VLOOKUP(2,A2:C10,2,TRUE)

#N/A

#N/A

Hlookup
Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find.

The H in HLOOKUP stands for "Horizontal."

HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]) The HLOOKUP function syntax has the following arguments: Lookup_value Required. The value to be found in the first row of the table. Lookup_value can be a value, a reference, or a text string. Table_array Required. A table of information in which data is looked up. Use a reference to a range or a range name. The values in the first row of table_array can be text, numbers, or logical values. If range_lookup is TRUE, the values in the first row of table_array must be placed in ascending order: ...-2, -1, 0, 1, 2,... , A-Z, FALSE, TRUE; otherwise, HLOOKUP may not give the correct value. If range_lookup is FALSE, table_array does not need to be sorted. Uppercase and lowercase text are equivalent. Sort the values in ascending order, left to right. For more information, see Sort data in a range or table. Row_index_num Required. The row number in table_array from which the matching value will be returned. 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. If row_index_num is less than 1, HLOOKUP returns the #VALUE! error value; if row_index_num is greater than the number of rows on table_array, HLOOKUP returns the #REF! error value. Range_lookup Optional. A logical value that specifies whether you want HLOOKUP to find an exact match or an approximate match. If TRUE or 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. If FALSE, HLOOKUP will find an exact match. If one is not found, the error value #N/A is returned.

Remark
If HLOOKUP can't find lookup_value, and range_lookup is TRUE, it uses the largest value that is less than lookup_value. If lookup_value is smaller than the smallest value in the first row of table_array, HLOOKUP returns the #N/A error value. If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
1 2 3 4 5 A Axles 4 5 6 Formula 6 =HLOOKUP("Axles", A1:C4, 2, TRUE) =HLOOKUP("Bearings", 3, FALSE) 7 A1:C4, B Bearings 4 7 8 Description (Result) Looks up Axles in row 1, and returns the value from row 2 that's in the same column. (4) Looks up Bearings in row 1, and returns the value from row 3 that's in the same column. (7) Looks up B in row 1, and returns the value from row 3 that's in the same column. Because B is not an exact match, the next largest value that is less than B is used: Axles. (5) Looks up Bolts in row 1, and returns the value from row 4 that's in the same column. (11) Looks up 3 in the first row of the array constant, and returns the value from row 2 in same column. (c) C Bolts 9 10 11

=HLOOKUP("B", A1:C4, 3, TRUE)

=HLOOKUP("Bolts", A1:C4, 4) =HLOOKUP(3, {1, 2, 3, "a", "b", "c", "d", "e", "f"}, 2, TRUE)

10

Logical Functions
i. If

The IF function returns one value if a condition you specify evaluates to TRUE, and another value if that condition evaluates to FALSE. For example, the formula =IF(A1>10,"Over 10","10 or less") returns "Over 10" if A1 is greater than 10, and "10 or less" if A1 is less than or equal to 10.

Syntax
IF(logical_test, [value_if_true], [value_if_false]) The IF function syntax has the following arguments: logical_test Required. Any value or expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. This argument can use any comparison calculation operator. value_if_true Optional. The value that you want to be returned if the logical_test argument evaluates to TRUE. For example, if the value of this argument is the text string "Within budget" and the logical_test argument evaluates to TRUE, the IF function returns the text "Within budget." If logical_test evaluates to TRUE and the value_if_true argument is omitted (that is, there is only a comma following the logical_test argument), the IF function returns 0 (zero). To display the word TRUE, use the logical value TRUE for the value_if_true argument. value_if_false Optional. The value that you want to be returned if the logical_test argument evaluates to FALSE. For example, if the value of this argument is the text string "Over budget" and the logical_test argument evaluates to FALSE, the IF function returns the text "Over budget." If logical_test evaluates to FALSE and the value_if_false argument is omitted, (that is, there is no comma following the value_if_true argument), the IF function returns the logical value FALSE. If logical_test evaluates to FALSE and the value of the value_if_false argument is omitted (that is, in the IF function, there is no comma following the value_if_true argument), the IF function returns the value 0 (zero).

Remarks
Up to 64 IF functions can be nested as value_if_true and value_if_false arguments to construct more elaborate tests. Alternatively, to test many conditions, consider using the LOOKUP, VLOOKUP, HLOOKUP, or CHOOSE functions. (See Example 4 for a sample of the LOOKUP function.) If any of the arguments to IF are arrays, every element of the array is evaluated when the IF statement is carried out. Excel provides additional functions that can be used to analyze your data based on a condition. For example, to count the number of occurrences of a string of text or a number within a range of cells, use the COUNTIF or the COUNTIFS worksheet functions. To calculate a sum based on a string of text or a number within a range, use the SUMIF or the SUMIFS worksheet functions.

EXAMPLE
1 2 3

A Data 50 Formula =IF(A2<=100,"Within

23 Description If the number in cell A2 is less than or equal to 100, the Result Within

budget","Over budget") 4 =IF(A2=100,A2+B2,"")

formula returns "Within budget." Otherwise, the function displays "Over budget." If the number in cell A2 is equal to 100, A2 + B2 is calculated and returned. Otherwise, empty text ("") is returned.

budget Empty text ("")

EXAMPLE
1 2 3 4 5 6 7 A Actual Expenses 1500 500 500 Formula =IF(A2>B2,"Over Budget","OK") =IF(A3>B3,"Over Budget","OK") B Predicted Expenses 900 900 925 Description Checks whether the expenses in row 2 are over budget Checks whether the expenses in row 3 are over budget Result Over Budget OK C

EXAMPLE
1 2 3 4 5 6 7 8 A Score 45 90 78 Formula =IF(A2>89,"A",IF(A2>79,"B", IF(A2>69,"C",IF(A2>59,"D","F")))) =IF(A3>89,"A",IF(A3>79,"B", IF(A3>69,"C",IF(A3>59,"D","F")))) =IF(A4>89,"A",IF(A4>79,"B", IF(A4>69,"C",IF(A4>59,"D","F")))) Description Assigns a letter grade to the score in cell A2 Assigns a letter grade to the score in cell A3 Assigns a letter grade to the score in cell A4 B C

Result F A C

The preceding example demonstrates how you can nest IF statements. In each formula, the fourth IF statement is also the value_if_false argument to the third IF statement. Similarly, the third IF statement is the value_if_false argument to the second IF statement, and the second IF statement is the value_if_false argument to the first IF statement. For example, if the first logical_test argument (Average>89) evaluates to TRUE, "A" is returned. If the first logical_test argument evaluates to FALSE, the second IF statement is evaluated, and so on. You can also use other functions as arguments. The letter grades are assigned to numbers, using the following key.
If Score is Greater than 89 From 80 to 89 From 70 to 79 From 60 to 69 Less than 60 Then return A B C D F

1 2 3 4 5

A Score 45 90 78 Formula

Description Assigns a letter grade to the score in cell A2 Assigns a letter grade to the score in cell A3 Assigns a letter grade to the score in cell A4

Result F

=LOOKUP(A2,{0,60,63,67,70,73,77,80,83,87,90,93,97},{"F","D","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"}) =LOOKUP(A3,{0,60,63,67,70,73,77,80,83,87,90,93,97},{"F","D","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"}) =LOOKUP(A4,{0,60,63,67,70,73,77,80,83,87,90,93,97},{"F","D","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"})

A-

ii.

AND

Returns TRUE if all its arguments evaluate to TRUE; returns FALSE if one or more arguments evaluate to FALSE. One common use for the AND function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the AND function as the logical_test argument of the IF function, you can test many different conditions instead of just one.

AND(logical1, [logical2], ...) The AND function syntax has the following arguments: logical1 Required. The first condition that you want to test that can evaluate to either TRUE or FALSE. logical2, ... Optional. Additional conditions that you want to test that can evaluate to either TRUE or FALSE, up to a maximum of 255 conditions.
The arguments must evaluate to logical values, such as TRUE or FALSE, or the arguments must be arrays or references that contain logical values. If an array or reference argument contains text or empty cells, those values are ignored. If the specified range contains no logical values, the AND function returns the #VALUE! error value.

Examples
1 2 3 4 A Formula =AND(TRUE, TRUE) =AND(TRUE, FALSE) =AND(2+2=4, 2+3=5) B Description All arguments are TRUE One argument is FALSE All arguments evaluate to TRUE C Result TRUE FALSE TRUE

EXAMPLE 2
1 2 A Data B C

3 4

50 104 Formula Description Displays TRUE if the number in cell A2 is between 1 and 100. Otherwise, it displays FALSE. Displays the number in cell A3, if it is between 1 and 100. Otherwise, it displays the message "The value is out of range." Displays the number in cell A2, if it is between 1 and 100. Otherwise, it displays a message. Result TRUE The value is out of range.

=AND(1<A2, A2<100) =IF(AND(1<A3, A3<100), A3, "The value is out of range.")

=IF(AND(1<A2, A2<100), A2, "The value is out of range.")

OR
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.

Syntax
OR(logical1, [logical2], ...) The OR function syntax has the following arguments: Logical1, logical2, ... Logical1 is required, subsequent logical values are optional. 1 to 255 conditions you want to test that can be either TRUE or FALSE.

Remarks
The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays or references that contain logical values. If an array or reference argument contains text or empty cells, those values are ignored. If the specified range contains no logical values, OR returns the #VALUE! error value. You can use an OR array formula to see if a value occurs in an array. To enter an array formula, press CTRL+SHIFT+ENTER.

Example
1 2 3 4 A Formula =OR(TRUE) =OR(1+1=1,2+2=5) =OR(TRUE,FALSE,TRUE) B Description (Result) One argument is TRUE (TRUE) All arguments evaluate to FALSE (FALSE) At least one argument is TRUE (TRUE)

NOT
Reverses the value of its argument. Use NOT when you want to make sure a value is not equal to one particular value.

Syntax

NOT(logical) The NOT function syntax has the following arguments: Logical Required. A value or expression that can be evaluated to TRUE or FALSE.

Remark
If logical is FALSE, NOT returns TRUE; if logical is TRUE, NOT returns FALSE.

Example
1 2 3 A Formula =NOT(FALSE) =NOT(1+1=2) B Description (Result) Reverses FALSE (TRUE) Reverses an equation that evaluates to TRUE (FALSE)

Date and Time Functions


DATE
The DATE function returns the sequential serial number that represents a particular date. For example, the formula =DATE(2008,7,8) returns 39637, the serial number that represents 7/8/2008. NOTE If the cell format was General before the function was entered, the result is formatted as a date instead of a number. If you want to view the serial number, or if you want to change the formatting of the date, select a different number format in the Number group of the Home tab. The DATE function is most useful in situations where the year, month, and day are supplied by formulas or cell references. For example, you might have a worksheet that contains dates in a format that Excel does not recognize, such as YYYYMMDD. You can use the DATE function in conjunction with other functions to convert the dates to a serial number that Excel recognizes. See the table in the Example section of this article for more information.

Syntax
DATE(year,month,day) The DATE function syntax has the following arguments: Year Required. The value of the year argument can include one to four digits. Excel interprets the year argument according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system; Microsoft Excel for the Macintosh uses the 1904 date system. TIP We recommend using four digits for the year argument to prevent unwanted results. For example, using "07" returns "1907" as the year value. If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example,
DATE(108,1,2)

returns January 2, 2008 (1900+108). If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example,
DATE(2008,1,2)

returns January 2, 2008. If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value. Month Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December). If month is greater than 12, month adds that number of months to the first month in the year specified. For example,
DATE(2008,14,2)

returns the serial number representing February 2, 2009. If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example,
DATE(2008,-3,2)

returns the serial number representing September 2, 2007. Day Required. A positive or negative integer representing the day of the month from 1 to 31. If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example,
DATE(2008,1,35)

returns the serial number representing February 4, 2008. If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example,
DATE(2008,1,-15)

returns the serial number representing December 16, 2007. NOTE Excel stores dates as sequential serial numbers so that they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Example
1 2 3 5 6 A Year 2008 Data 20081125 Formula =DATE(A2,B2,C2) Description Serial date for the date derived by using cells A2, B2, and C2 as the arguments for the DATE function, and using the 1900 date system. Serial date for the last day of the current year. Result 1/1/2008 or 39448 B Month 1 C Day 1

7 =DATE(YEAR(TODAY()),12,31)

12/31/nnnn or the equivalent sequential serial number (actual value depends on current year) 11/25/2008 or 39777

=DATE(LEFT(A4,4),MID(A4,5,2), RIGHT(A4,2))

A formula that converts a date from the YYYYMMDD format to a serial date.

NOTE To view the number as a serial number, select the cell and then, on the Home tab, in the Number group, click the arrow next to Number Format, and then click Number.

Today
Returns the serial number of the current date. The serial number is the date-time code used by Excel for date and time calculations. If the cell format was General before the function was entered, Excel changes the cell format to Date. If you want to view the serial number, you must change the cell format to General or Number. The TODAY function is useful when you need to have the current date displayed on a worksheet, regardless of when you open the workbook. It is also useful for calculating intervals. For example, if you know that someone was born in 1963, you might use the following formula to find that person's age as of this year's birthday: =YEAR(TODAY())-1963

This formula uses the TODAY function as an argument for the YEAR function to obtain the current year, and then subtracts 1963, returning the person's age. NOTE If the TODAY function does not update the date when you expect it to, you might need to change the settings that control when the workbook or worksheet recalculates. On the File tab, click Options, and then in the Formulas category under Calculation options, make sure that Automatic is selected.

Syntax
TODAY() The TODAY function syntax has no arguments. NOTE Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Example
1 2 A Formula =TODAY() =TODAY()+5 3 =DATEVALUE("1/1/2030")TODAY() 4 5 =DAY(TODAY()) =MONTH(TODAY()) 6 B Description Returns the current date. Returns the current date plus 5 days. For example, if the current date is 1/1/2008, this formula returns 1/6/2008. Returns the number of days between the current date and 1/1/2030. Note that cell A4 must be formatted as General or Number for the result to display correctly. Returns the current day of the month (1 - 31). Returns the current month of the year (1 - 12). For example, if the current month is May, this formula returns 5.

DAY
Returns the day of a date, represented by a serial number. The day is given as an integer ranging from 1 to 31.

DAY(serial_number) The DAY function syntax has the following arguments: Serial_number Required. The date of the day you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Example
1 2 3 4 A Date 15-Apr-2008 Formula =DAY(A2) Description (Result) Day of the date above (15) B

Month
Returns the month of a date represented by a serial number. The month is given as an integer, ranging from 1 (January) to 12 (December).

Syntax
MONTH(serial_number) The MONTH function syntax has the following arguments: Serial_number Required. The date of the month you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Example.
1 2 3 4 A Date 15-Apr-2008 Formula =MONTH(A2) Description (Result) Month of the date above (4) B

Year
Returns the year corresponding to a date. The year is returned as an integer in the range 1900-9999.

Syntax
YEAR(serial_number) The YEAR function syntax has the following arguments: Serial_number Required. The date of the year you want to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text. .
1 2 3 4 5 6 A Date 7/5/2008 7/5/10 Formula =YEAR(A2) =YEAR(A3) Description (Result) Year of the first date (2008) Year of the second date (2010) B

Now
Returns the serial number of the current date and time. If the cell format was General before the function was entered, Excel changes the cell format to the same date and time format that is specified in the regional date and time settings in Control Panel. You can change the date and time format for the cell by using the commands in the Number group of the Home tab on the Ribbon. The NOW function is useful when you need to display the current date and time on a worksheet or calculate a value based on the current date and time, and have that value updated each time you open the worksheet. NOTE If the NOW function does not update cell values when you expect it to, you might need to change settings that control when the workbook or worksheet recalculates.

Syntax
NOW() The NOW function syntax has no arguments.

Time
Returns the decimal number for a particular time. If the cell format was General before the function was entered, the result is formatted as a date. The decimal number returned by TIME is a value ranging from 0 (zero) to 0.99999999, representing the times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.).

Syntax
TIME(hour, minute, second) The TIME function syntax has the following arguments: Hour Required. A number from 0 (zero) to 32767 representing the hour. Any value greater than 23 will be divided by 24 and the remainder will be treated as the hour value. For example, TIME(27,0,0) = TIME(3,0,0) = .125 or 3:00 AM. Minute Required. A number from 0 to 32767 representing the minute. Any value greater than 59 will be converted to hours and minutes. For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM. Second Required. A number from 0 to 32767 representing the second. Any value greater than 59 will be converted to hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM

Remark
Microsoft Excel for Windows and Microsoft Excel for the Macintosh use different date systems as their default. Time values are a portion of a date value and represented by a decimal number (for example, 12:00 PM is represented as 0.5 because it is half of a day).
1 2 3 4 5 6 A Hour 12 16 Formula =TIME(A2,B2,C2) =TIME(A3,B3,C3) B Minute 0 48 Description (Result) Decimal part of a day, for the first time above (0.5) Decimal part of a day, for the second time above (0.700115741) C Second 0 10

Hour
Returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Syntax
HOUR(serial_number) The HOUR function syntax has the following arguments: Serial_number Required. The time that contains the hour you want to find. Times may be entered as text strings within quotation marks (for example, "6:45 PM"), as decimal numbers (for example,

0.78125, which represents 6:45 PM), or as results of other formulas or functions (for example, TIMEVALUE("6:45 PM")).

Remark
Microsoft Excel for Windows and Excel for the Macintosh use different date systems as their defaults. Time values are a portion of a date value and represented by a decimal number (for example, 12:00 PM is represented as 0.5 because it is half of a day).
1 2 3 4 5 6 7 8 A Time 3:30:30 AM 3:30:30 PM 15:30 Formula =HOUR(A2) =HOUR(A3) =HOUR(A4) Description (Result) Hour of first time (3) Hour of second time (15) Hour of third time (15) B

Minute
Returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.

Syntax
MINUTE(serial_number) The MINUTE function syntax has the following arguments: Serial_number Required. The time that contains the minute you want to find. Times may be entered as text strings within quotation marks (for example, "6:45 PM"), as decimal numbers (for example, 0.78125, which represents 6:45 PM), or as results of other formulas or functions (for example, TIMEVALUE("6:45 PM")).
1 2 3 4 A Time 4:48:00 PM Formula =MINUTE(A2) Description (Result) Minutes of the time above (48) B

Second
Returns the seconds of a time value. The second is given as an integer in the range 0 (zero) to 59.

SECOND(serial_number) The SECOND function syntax has the following arguments: Serial_number Required. The time that contains the seconds you want to find. Times may be entered as text strings within quotation marks (for example, "6:45 PM"), as decimal numbers (for example, 0.78125, which represents 6:45 PM), or as results of other formulas or functions (for example, TIMEVALUE("6:45 PM")).
1 2 A Time B

3 4 5 6

4:48:18 PM 4:48 PM Formula =SECOND(A2) =SECOND(A3) Description Seconds in the first time (18) Seconds in the second time (0)

Weeknum
Returns the week number of a specific date. For example, the week containing January 1 is the first week of the year, and is numbered week 1. There are two systems used for this function: System 1 The week containing January 1 is the first week of the year, and is numbered week 1. System 2 The week containing the first Thursday of the year is the first week of the year, and is numbered as week 1.

WEEKNUM(serial_number,[return_type]) The WEEKNUM function syntax has the following arguments: Serial_number Required. A date within the week. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text. Return_type Optional. A number that determines on which day the week begins. The default is 1.
Return_type 1 or omitted 2 11 12 13 14 15 16 17 21 Week begins on Sunday Monday Monday Tuesday Wednesday Thursday Friday Saturday Sunday Monday System 1 1 1 1 1 1 1 1 1 2

Remark
Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. If serial_number is out of range for the current date base value, a #NUM! error is returned. If return_type is out of the range specified in the table above, a #NUM! error is returned.

Example 1
1 2 3 4 A

Data March 9, 2008 Formula =WEEKNUM(A2,1) Description (Result) Number of the week in the year, with a week beginning on Sunday (11)

=WEEKNUM(A2,2) 5

Number of the week in the year, with a week beginning on Monday (10)

NOTE March 9, 2008 is a Sunday.

Example 2
1 2 3 4 5 A Formula =WEEKNUM(DATE(2006,1,1)) =WEEKNUM(DATE(2006,1,1),1) =WEEKNUM(DATE(2006,1,1),17) =WEEKNUM(DATE(2006,2,1),1) =WEEKNUM(DATE(2006,2,1),2) =WEEKNUM(DATE(2006,2,1),11) B Description (Result) Number of the week in the year, with a week beginning on Sunday (1) Number of the week in the year, with a week beginning on Sunday (1) Number of the week in the year, with a week beginning on Sunday (1) Number of the week in the year, with a week beginning on Sunday (5) Number of the week in the year, with a week beginning on Monday (6) Number of the week in the year, with a week beginning on Monday (6)

Weekday
Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.

WEEKDAY(serial_number,[return_type]) The WEEKDAY function syntax has the following arguments: Serial_number Required. A sequential number that represents the date of the day you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text. Return_type Optional. A number that determines the type of return value.
Return_type 1 or omitted 2 3 11 12 13 14 15 16 17 Number returned Numbers 1 (Sunday) through 7 (Saturday). Behaves like previous versions of Microsoft Excel. Numbers 1 (Monday) through 7 (Sunday). Numbers 0 (Monday) through 6 (Sunday). Numbers 1 (Monday) through 7 (Sunday). Numbers 1 (Tuesday) through 7 (Monday). Numbers 1 (Wednesday) through 7 (Tuesday). Numbers 1 (Thursday) through 7 (Wednesday). Numbers 1 (Friday) through 7 (Thursday). Numbers 1 (Saturday) through 7 (Friday). Numbers 1 (Sunday) through 7 (Saturday).

Remark
Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. If serial_number is out of range for the current date base value, a #NUM! error is returned. If return_type is out of the range specified in the table above, a #NUM! error is returned.

Example

1 2 3 4 5 6

A Data 2/14/2008 Formula =WEEKDAY(A2) =WEEKDAY(A2, 2) =WEEKDAY(A2, 3)

Description (Result) Day of the week, with numbers 1 (Sunday) through 7 (Saturday) (5) Day of the week, with numbers 1 (Monday) through 7 (Sunday) (4) Day of the week, with numbers 0 (Monday) through 6 (Sunday) (3)

NOTE 2/14/2008 is a Thursday.

Data Base Functions


Function DAVERAGE function DCOUNT function DCOUNTA function DGET function DMAX function DMIN function DPRODUCT function DSTDEV function DSTDEVP function DSUM function DVAR function DVARP function Ddayescription Returns the average of selected database entries Counts the cells that contain numbers in a database Counts nonblank cells in a database Extracts from a database a single record that matches the specified criteria Returns the maximum value from selected database entries Returns the minimum value from selected database entries Multiplies the values in a particular field of records that match the criteria in a database Estimates the standard deviation based on a sample of selected database entries Calculates the standard deviation based on the entire population of selected database entries Adds the numbers in the field column of records in the database that match the criteria Estimates variance based on a sample from selected database entries Calculates variance based on the entire population of selected database entries

Dsum
Adds the numbers in a field (column) of records in a list or database that match conditions that you specify.

Syntax
DSUM(database, field, criteria) The DSUM function syntax has the following arguments: Database Required. The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column. Field Required. Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on. Criteria Required. Is the range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Remarks
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label for specifying the condition. For example, if the range G1:G2 contains the column label Income in G1 and the amount $10,000 in G2, you could define the range as MatchIncome and use that name as the criteria argument in the database functions. Although the criteria range can be located anywhere on the worksheet, do not place the criteria range below the list. If you add more information to the list, the new information is added to the first row below the list. If the row below the list is not blank, Microsoft Excel cannot add the new information. Make sure that the criteria range does not overlap the list. To perform an operation on an entire column in a database, enter a blank line below the column labels in the criteria range.

Examples
1.
1 2 3 4 5 6 7 8 9 10 11

.
A Tree ="=Apple" ="=Pear" Tree Apple Pear Cherry Apple Pear Apple Formula 12 =DSUM(A4:E10, "Profit", A1:A2) =DSUM(A4:E10, "Profit", A1:F2) 13 Height 18 12 13 14 9 8 Description (Result) The total profit from apple trees. (225) The total profit from apple trees with a height between 10 and 16. (75) Age 20 12 14 15 8 9 Yield 14 10 9 10 8 6 Profit 105.00 96.00 105.00 75.00 76.80 45.00 B Height >10 C Age D Yield E Profit F Height <16

CRITERIA EXAMPLES
IMPORTANT

Because the equal sign is used to indicate a formula when you type text or a value in a cell, Microsoft Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range: =''=entry'' Where entry is the text or value you want to find. For example:
What you type in the cell ="=Davolio" ="=3000" What Excel evaluates and displays =Davolio =3000

When filtering text data, Excel does not distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search. For an example, see Filtering for text by using a case-sensitive search. The following sections provide examples of complex criteria.

Multiple criteria in one column Boolean logic: (Salesperson = "Davolio" OR Salesperson = "Buchanan") To find rows that meet multiple criteria for one column, type the criteria directly below each other in separate rows of the criteria range. In the following data range (A6:C10), the criteria range (B1:B3) displays the rows that contain either "Davolio" or "Buchanan" in the Salesperson column (A8:C10).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type B Salesperson =Davolio =Buchanan C Sales

Multiple criteria in multiple columns where all criteria must be true Boolean logic: (Type = "Produce" AND Sales > 1000) To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same row of the criteria range. In the following data range (A6:C10), the criteria range (A1:C2) displays all rows that contain "Produce" in the Type column and a value greater than $1,000 in the Sales column (A9:C10).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type =Produce B Salesperson C Sales >1000

Multiple criteria in multiple columns where any criteria can be true Boolean logic: (Type = "Produce" OR Salesperson = "Davolio") To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type the criteria in different rows of the criteria range. In the following data range (A6:C10), the criteria range (A1:B3) displays all rows that contain "Produce" in the Type column or "Davolio" in the Salesperson column (A8:C10).
A 1 2 3 4 Type =Produce =Davolio B Salesperson C Sales

5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544

Multiple sets of criteria where each set includes criteria for multiple columns Boolean logic: ( (Salesperson = "Davolio" AND Sales >3000) OR (Salesperson = "Buchanan" AND Sales > 1500) ) To find rows that meet multiple sets of criteria, where each set includes criteria for multiple columns, type each set of criteria in separate rows. In the following data range (A6:C10), the criteria range (B1:C3) displays the rows that contain both "Davolio" in the Salesperson column and a value greater than $3,000 in the Sales column, or displays the rows that contain "Buchanan" in the Salesperson and a value greater than $1,500 in the Sales column (A9:C10).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type B Salesperson =Davolio =Buchanan C Sales >3000 >1500

Multiple sets of criteria where each set includes criteria for one column Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) ) To find rows that meet multiple sets of criteria, where each set includes criteria for one column, include multiple columns with the same column heading. In the following data range (A6:C10), the criteria range (C1:D3) displays rows that contain values between 6,000 and 6,500 and values less than 500 in the Sales column (A8:C10).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type B Salesperson C Sales >6000 <500 D Sales <6500

Criteria to find text values that share some characters but not others To find text values that share some characters but not others, do one or more of the following:

Type one or more characters without an equal sign (=) to find rows with a text value in a column that begin with those characters. For example, if you type the text Dav as a criterion, Excel finds "Davolio," "David," and "Davis." Use a wildcard character. The following wildcard characters can be used as comparison criteria.
Use ? (question mark) * (asterisk) ~ (tilde) followed by ?, *, or ~ To find Any single character For example, sm?th finds "smith" and "smyth" Any number of characters For example, *east finds "Northeast" and "Southeast" A question mark, asterisk, or tilde For example, fy91~? finds "fy91?"

In the following data range (A6:C10), the criteria range (A1:B3) displays rows with "Me" as the first characters in the Type column or rows with the second character equal to "u" in the Salesperson column (A7:C9).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type Me =?u* B Salesperson C Sales

Criteria created as the result of a formula You can use a calculated value that is the result of a formula as your criterion. Remember the following important points: The formula must evaluate to TRUE or FALSE. Because you are using a formula, enter the formula as you normally would, and do not type the expression in the following way: =''=entry'' Do not use a column label for criteria labels; either keep the criteria labels blank or use a label that is not a column label in the range (in the examples below, Calculated Average and Exact Match). If you use a column label in the formula instead of a relative cell reference or a range name, Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion. You can ignore this error because it does not affect how the range is filtered. The formula that you use for criteria must use a relative reference to refer to the corresponding cell in the first row (in the examples below, C7 and A7). All other references in the formula must be absolute references. The following subsections provide specific examples of criteria created as the result of a formula.
FILTERING FOR VALUES GREATER THAN THE AVERAGE OF ALL VALUES IN THE DATA RANGE

In the following data range (A6:D10), the criteria range (D1:D2) displays rows that have a value in the Sales column greater than the average of all the Sales values (C7:C10). In the formula, "C7" refers to the filtered column (C) of the first row of the data range (7).
A 1 2 3 Type B Salesperson C Sales D Calculated Average =C7>AVERAGE($C$7:$C$10)

4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544

FILTERING FOR TEXT BY USING A CASE-SENSITIVE SEARCH

In the data range (A6:D10), the criteria range (D1:D2) displays rows that contain "Produce" in the Type column by using the EXACT function to perform a case-sensitive search (A10:C10). In the formula, "A7" refers to the filtered column (A) of the first row of the data range (7).
A 1 2 3 4 5 6 7 8 9 10 Type Beverages Meat produce Produce Salesperson Suyama Davolio Buchanan Davolio Sales $5122 $450 $6328 $6544 Type B Salesperson C Sales D Exact Match =EXACT(A7, "Produce")

Information function

Each of these functions, referred to collectively as the IS functions, checks the specified value and returns TRUE or FALSE depending on the outcome. For example, the ISBLANK function returns the logical value TRUE if the value argument is a reference to an empty cell; otherwise it returns FALSE.

You can use an IS function to get information about a value before performing a calculation or other action with it. For example, you can use the ISERROR function in conjunction with the IF function to perform a different action if an error occurs:

=IF(ISERROR(A1), "An error occurred.", A1 * 2)

This formula checks to see if an error condition exists in A1. If so, the IF function returns the message "An error occurred." If no error exists, the IF function performs the calculation A1*2.

Syntax
ISBLANK(value) ISERR(value) ISERROR(value) ISLOGICAL(value) ISNA(value) ISNONTEXT(value) ISNUMBER(value) ISREF(value) ISTEXT(value)
The IS function syntax has the following argument:

value Required. The value that you want tested. The value argument can be a blank (empty cell), error, logical value, text, number, or reference value, or a name referring to any of these.
Function ISBLANK ISERR ISERROR ISLOGICAL ISNA ISNONTEXT Returns TRUE if Value refers to an empty cell. Value refers to any error value except #N/A. Value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!). Value refers to a logical value. Value refers to the #N/A (value not available) error value. Value refers to any item that is not text. (Note that this function returns TRUE if the value refers to a blank cell.) Value refers to a number. Value refers to a reference. Value refers to text.

ISNUMBER ISREF ISTEXT

Remarks
The value arguments of the IS functions are not converted. Any numeric values that are enclosed in double quotation marks are treated as text. For example, in most other functions where a number is required, the text value "19" is converted to the number 19. However, in the formula

ISNUMBER("19"), "19" is not converted from a text value to a number value, and the ISNUMBER function returns FALSE. The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, these functions provide a method for locating errors in formulas (see the following examples).

Example

EXAMPLE 1
A Formula =ISLOGICAL(TRUE) =ISLOGICAL("TRUE") =ISNUMBER(4) =ISREF(G8) =ISREF(XYZ1) B Description Checks whether TRUE is a logical value Checks whether "TRUE" is a logical value Checks whether 4 is a number Checks whether G8 is a valid reference Checks whether XYZ1 is a valid reference C Result TRUE FALSE TRUE TRUE FALSE

1 2 3 4 5 6

EXAMPLE 2
1 2 3 4 5 6 7 8 A Data Gold Region1 #REF! 330.92 #N/A Formula =ISBLANK(A2) 9 =ISERROR(A4) =ISNA(A4) Description Checks whether cell A2 is blank. Checks whether the value in cell A4, #REF!, is an error. Checks whether the value in cell A4, #REF!, is the #N/A error. Result FALSE TRUE FALSE B C

10

=ISNA(A6) =ISERR(A6) =ISNUMBER(A5)

Checks whether the value in cell A6, #N/A, is the #N/A error. Checks whether the value in cell A6, #N/A, is an error. Checks whether the value in cell A5, 330.92, is a number. Checks whether the value in cell A3, Region1, is text.

TRUE FALSE TRUE TRUE

11

12

=ISTEXT(A3)

13

14

You might also like