Monday, July 21, 2008

CONCATENATE() or &

CONCATENATE() - This function combines several text strings into one string.

Syntax

CONCATENATE(Text 1;...;Text 30)

Text 1; text 2; ... represent up to 30 text passages which are to be combined into one string.


Example: Look at the screen shot below.

Column A contains the last name of a person and column B contains the first name of person. I want to combine these into one cell.


Cell C2 contains the formula =CONCATENATE(B2;A2) which returns TreyCook
Notice the above result does not put a space between the first and last names.

Cell D2 contains the formula =CONCATENATE(B2;" ";A2) which returns Trey Cook
This result put a space between the first and last name. Notice the difference in the formulas. The second one has " ". Note the double quotes has a space between them.

Another approach to combine several text strings into on string is to use "&" without the quotes.

Cell E2 contains the formula =B2&A2 which returns TreyCook
You can see this gives the same result as in cell C2.

Cell F2 contains the formula =B2&" "&A2 which returns Trey Cook
This gives the same result as in cell D2.

Screen Shot


No comments:

Relax. Kick your shoes off and watch a video.