Wednesday, February 28, 2018

Combine text from two or more cells into one cell

Combine text from two or more cells into one cell

You can combine text from two or more cells into one cell. For example, if you have one cell in your worksheet with a person's first name and one cell with their last name, you can combine them in another cell. In this topic, we'll discuss several different methods for doing this.

Flash Fill

Let's say column A contains first names, column B has last names, and you want to fill column C with first and last names combined. If you establish a pattern by typing the full name in column C, Excel's Flash Fill feature will fill in the rest for you based on the pattern you provide.

  1. Enter the full name in cell C2, and press ENTER.

  2. Start typing the next full name in cell C3. Excel will sense the pattern you provide, and show you a preview of the rest of the column filled in with your combined text.

  3. To accept the preview, press ENTER.

    Concatenate data with Flash Fill

    If Flash Fill doesn't generate the preview, it might not be turned on. You can go to Data > Flash Fill to run it manually. To turn Flash Fill on, go to Tools > Options > Advanced > Editing Options > check the Automatically Flash Fill box.

Note: Flash Fill is only available for Excel 2013 for Windows and later.

Using the Ampersand symbol, which you can enter with Shift+7, is the simplest way of joining cell contents. In the following example, we'll use =A2&" "&B2 to join first and last names.

  1. Click the cell where you want to put the combined text.

  2. Type =, then click the cell that contains the first text you want to combine, such as a person's first name.

  3. Type &" "& (a space enclosed in quotation marks).

  4. Click the next cell with the text that you want to combine, such as the person's last name, then press Enter.

    Use =A2&" "&B2 to concatenate text like First and Last Name

    Tip:  To combine the text from more than two cells, continue selecting cells, and typing &" "& after each cell you select. If you don't want to add a space between the combined text, type & instead of &" "&. To add a comma, type &", "& (a comma followed by a space, both enclosed in quotation marks).

    use =B2&", "&A2 to concatenate text, like Last Name, First Name

Instead of using the Ampersand (&), you can use the CONCAT function.

Note: CONCAT is only available for Excel 2016 and later. For earlier versions, you can use the CONCATENATE function.

Example

The example may be easier to understand if you copy it to a blank worksheet.

  1. Select the text in the example, starting with "First name" and ending with the phone number in the last row.

  2. Press Ctrl+C to copy the text.

  3. In a blank worksheet, select cell A1, and press Ctrl+V.

First name

Last name   

Phone

Steve

Riley

555-1875 ext. 2007

Terry

Adams

555-2306

Jim

Hance

555-1896

Wendy

Wheeler

555-2307 ext. 705

Function

=CONCAT(A2," ",B2," ",C2)

Result:

Steve Riley 555-1875 ext. 2007

The formula in the Function column of the preceding example table uses the CONCAT function to combine the contents of three cells in columns A, B, and C. In the function, you separate the cells or strings that you want combined by commas. To add a space between the strings, include a space enclosed in quotation marks (" "). If you look at the CONCAT function in the formula, you'll see that the contents of A2 are combined with a space, the contents of B2, another space, and the contents of C2.

After you paste the example into your worksheet, drag the formula in D2 down to cells D3:D5 to combine the contents of those cells.

Note: Some browsers put an apostrophe (') in front of copied formulas, which makes Excel see them as text. If the formula displays as text instead of the result after you paste it, select the formula cell, then press F2, delete the apostrophe and press Enter.

Here's a similar example that uses the CHAR function to insert a new line. These results are better suited for a mailing label.

First name

Last name   

Street address

City

State

Zip code

Steve

Riley

4567 Main St.

Buffalo

NY

98052

Function:

=CONCAT("The ",B2," Family",CHAR(10),C2,CHAR(10),D2,", ",E2," ",F2)

Description:

Combines the last name with the words "The" and "Family" and then combines the address with it. CHAR(10) is used to insert a new line. You will need to set the cells to wrap text for the new line to display properly.

Result:

The Riley Family
4567 Main St.
Buffalo, NY 98052

Similar to the CONCAT function, you can use the TEXTJOIN function. The TEXTJOIN function combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined. If the delimiter is an empty text string, this function will effectively concatenate the ranges.

Example

City

State

Postcode

Country

Tulsa

OK

74133

US

Seattle

WA

98109

US

Iselin

NJ

08830

US

Fort Lauderdale

FL

33309

US

Tempe

AZ

85285

US

end

,

,

,

;

Function

=TEXTJOIN(A8:D8,TRUE,A2:D7)

Result:

Tulsa,OK,74133,US;Seattle,WA,98109,US;Iselin,NJ,08830,US;Fort Lauderdale,FL,33309,US;Tempe,AZ,85285,US;end

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

See Also

Overview of formulas in Excel

How to avoid broken formulas

Find and correct errors in formulas

Excel keyboard shortcuts and function keys

TEXT functions (reference)

Excel functions (alphabetical)

Excel functions (by category)

1 comment:

  1. Microsoft Office Tutorials: Combine Text From Two Or More Cells Into One Cell >>>>> Download Now

    >>>>> Download Full

    Microsoft Office Tutorials: Combine Text From Two Or More Cells Into One Cell >>>>> Download LINK

    >>>>> Download Now

    Microsoft Office Tutorials: Combine Text From Two Or More Cells Into One Cell >>>>> Download Full

    >>>>> Download LINK 6B

    ReplyDelete