Excel Formulas

advertisement
Excel Formulas
The following formulas have somewhat greater capabilities than described below. The
descriptions are designed for our purposes and to avoid unnecessary confusion.
Remember all formulas begin with equal sign (“=”).
SUMPRODUCT:
The function SUMPRODUCT(Array1,Array2) multiplies the entries in pairs of cells in
identical sized arrays (rectangular groups of cells) and sums the products.
Examples:
These examples refer to the partial spreadsheet below:
SUMPRODUCT(A1:E1,A3:E3) = 2*6 + 6*5 + 8*5 + 11*10 + 4*3 = 204
SUMPRODUCT(A1:A3,E2:E4) = 2*2 + 3*3 + 6*1 = 19
SUMPRODUCT(A1:C2,A3:C4) = 2*6 + 3* 4 + 6*5 + 4*6 + 8*5 + 1*9 = 127
1
2
3
4
5
A
2
3
6
4
B
6
4
5
6
C
8
1
5
9
D
11
7
10
2
E
4
2
3
1
MROUND:
The function MROUND(number,multiple) returns a number rounded to the desired
multiple. MROUND rounds up, away from zero, if the remainder of dividing number by
multiple is greater than or equal to half the value of multiple.
If this function is not available, run the Setup program to install the Analysis ToolPak.
After you install the Analysis ToolPak, you must enable it by using the Add-Ins
command on the Tools menu.
Examples:
Referring to the partial spreadsheet above
MROUND(D1,E1) = 12
MROUND(D3,D2) = 7
MROUND(B1,B2) = 8
MAX:
The function MAX(number1,number2) returns the larger of two values.
Examples:
Referring to the partial spreadsheet above
MAX(A1,A2) = 3
MAX(A3,E1) = 6
SQRT:
The function SQRT(number) returns the square root of number.
Examples:
Referring to the partial spreadsheet above
SQRT(B2) = 2
SQRT(A3) = 2.4495
IF:
The function IF(Logical_test, Value_if_true, Value_if_false) returns one of two values
depending on whether a logical test is TRUE or FALSE.
Logical_Test is 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 is the value that is returned if logical_test is TRUE. For example, if this
argument is the text string "Within budget" and the logical_test argument evaluates to
TRUE, then the IF function displays the text "Within budget". If logical_test is TRUE
and value_if_true is blank, this argument returns 0 (zero). To display the word TRUE,
use the logical value TRUE for this argument. Value_if_true can be another formula.
Value_if_false is the value that is returned if logical_test is FALSE. For example, if this
argument is the text string "Over budget" and the logical_test argument evaluates to
FALSE, then the IF function displays the text "Over budget". If logical_test is FALSE
and value_if_false is omitted, (that is, after value_if_true, there is no comma), then the
logical value FALSE is returned. If logical_test is FALSE and value_if_false is blank
(that is, after value_if_true, there is a comma followed by the closing parenthesis), then
the value 0 (zero) is returned. Value_if_false can be another formula.
Examples:
The table below illustrates the result of entering the formula
IF(A1 > B1,”YES”,”NO”)
in cell F1 and copying it the cells F2:F4 and entering the formula
IF(D1>9,SQRT(D1),””)
in cell G1 and copying it the cells G2:G4.
A
2
3
6
4
1
2
3
4
5
B
6
4
5
6
C
8
1
5
9
D
11
7
10
2
E
4
2
3
1
F
NO
NO
YES
NO
G
3.317
3.162
QUOTIENT:
Returns the integer portion of a division. Use this function when you want to discard the
remainder of a division.
If this function is not available, and returns the #NAME? error, install and load the
Analysis ToolPak add-in.
Syntax
QUOTIENT(numerator,denominator)
Numerator is the dividend.
Denominator is the divisor.
Remark
If either argument is nonnumeric, QUOTIENT returns the #VALUE! error value.
Example
A
B
1
Formula
Description (Result)
2
=QUOTIENT(5, 2)
Integer portion of 5/2 (2)
3
=QUOTIENT(4.5, 3.1) Integer portion of 4.5/3.1 (1)
4
=QUOTIENT(-10, 3)
Integer portion of -10/3 (-3)
MOD:
Returns the remainder after number is divided by divisor. The result has the same sign as
divisor.
Syntax
MOD(number,divisor)
Number is the number for which you want to find the remainder.
Divisor is the number by which you want to divide number.
Remarks
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)
Example
A
B
1
Formula
Description (Result)
2
=MOD(3, 2)
Remainder of 3/2 (1)
3
=MOD(-3, 2)
Remainder of -3/2. The sign is the same as divisor (1)
4
=MOD(3, -2)
Remainder of 3/-2. The sign is the same as divisor (-1)
5
=MOD(-3, -2) Remainder of -3/-2. The sign is the same as divisor (-1)
Download