Microsoft Office Tutorials and References

In Depth Information

=LEFT(A1,3)

Expressions as arguments

You can also use expressions as arguments. Think of an
expression
as a formula within a formula (but without

the leading equal sign). When Excel encounters an expression as a function's argument, it evaluates the expres-

sion and then uses the result as the argument's value. Here's an example:

=SQRT((A1^2)+(A2^2))

This formula uses the SQRT function, and its single argument consists of the following expression:

(A1^2)+(A2^2)

When Excel evaluates the formula, it first evaluates the expression in the argument and then computes the

square root of the result. This expression squares the value in cell A1 and adds it to the square of the value in

cell A2.

Other functions as arguments

Because Excel can evaluate expressions as arguments, it shouldn't surprise you that these expressions can in-

clude other functions. Writing formulas that have functions within functions is sometimes known as
nesting

functions. Excel starts by evaluating the most deeply nested expression and works its way out.

Here's an example of a nested function:

=SIN(RADIANS(B9))

The RADIANS function converts degrees to
radians,
the unit used by all Excel trigonometric functions. If cell

B9 contains an angle in degrees, the RADIANS function converts it to radians, and then the SIN function com-

putes the sine of the angle.

A formula can contain up to 64 levels of nested functions — a limit that will probably never be a factor.

Arrays as arguments

A function can also use an array as an argument. An
array
is a series of values separated by a comma and en-

closed in curly brackets. The formula below uses the OR function with an array as an argument. The formula re-

turns TRUE if cell A1 contains 1, 3, or 5.

=OR(A1={1,3,5})

See Part IV of this book for more information about working with arrays.