Page 176 - Excel Data Analysis
P. 176
10 537547 Ch09.qxd 3/4/03 12:13 PM Page 162
EXCEL DATA ANALYSIS
AN INTRODUCTION TO MACROS (CONTINUED)
UNDERSTANDING VBA (CONTINUED)
Concatenation Operator
You can use the concatenation operator (&) to join use the + operator for concatenating strings, but for
together two or more strings. For example, ap & ple consistency purposes you should always use the &
creates a new string, apple. VBA also enables you to operator with strings.
Comparison Operators
You use comparison operators between two If you compare two string expressions, Excel looks at
expressions to determine if the expressions are equal, the characters in the string and not the string length. For
greater than, or less than each other. example, if you compare abcd with cd, cd is
considered to be greater because the letter C comes
VBA uses these operators to compare numerical or after A. This is true even though cd has fewer
string values. If comparison operators compare a characters.
numerical and string value, Excel always evaluates the
numeric expression as less than the string expression. The following table lists comparison operators:
OPERATOR PURPOSE
= Determines if the expressions are equal.
> Determines if the first expression is greater than the second expression.
< Determines if the first expression is less than the second expression.
<> Determines if the expressions are not equal.
>= Determines if the first expression is greater than or equal to the second expression.
<= Determines if the first expression is less than or equal to the second expression.
162