Excel Function - CONCATENATE / CANCAT (new)

Use CONCATENATE, one of the text functions, to join two or more text strings into one string.

Syntax: CONCATENATE(text1, [text2], ...)

For example:

  • =CONCATENATE("Stream population for ", A2, " ", A3, " is ", A4, "/mile.")

  • =CONCATENATE(B2, " ",C2)

Argument name

Description

text1    (required)

The first item to join. The item can be a text value, number, or cell reference.

Text2, ...    (optional)

Additional text items to join. You can have up to 255 items, up to a total of 8,192 characters.

Examples

To use these examples in Excel, copy the data in the table below including the Data header, and paste it in cell A1 of a new worksheet.

Data

brook trout

Andreas

Hauser

species

Fourth

Pine

32

Formula

Description

=CONCATENATE("Stream population for ", A2, " ", A3, " is ", A4, "/mile.")

Creates a sentence by joining the data in column A with other text. The result is Stream population for brook trout species is 32/mile.

=CONCATENATE(B2, " ", C2)

Joins three things: the string in cell B2, a space character, and the value in cell C2. The result is Andreas Hauser.

=CONCATENATE(C2, ", ", B2)

Joins three things: the string in cell C2, a string with a comma and a space character, and the value in cell B2. The result is Andreas, Hauser.

=CONCATENATE(B3, " & ", C3)

Joins three things: the string in cell B3, a string consisting of a space with ampersand and another space, and the value in cell C3. The result is Fourth & Pine.

=B3 & " & " & C3

Joins the same items as the previous example, but by using the ampersand (&) calculation operator instead of the CONCATENATE function. The result is Fourth & Pine.

Common Problems

Problem

Description

Quotation marks appear in result string.

Use commas to separate adjoining text items. For example: Excel will display =CONCATENATE("Hello ""World") as Hello"World with an extra quote mark because a comma between the text arguments was omitted.

Numbers don't need to have quotation marks.

Words are jumbled together.

Without designated spaces between separate text entries, the text entries will run together. Add extra spaces as part of the CONCATENATE formula. There are two ways to do this:

  • Add double quotation marks with a space between them " ". For example: =CONCATENATE("Hello", " ", "World!").

  • Add a space after the Text argument. For example: =CONCATENATE("Hello ", "World!"). The string "Hello " has an extra space added.

The #NAME? error appears instead of the expected result.

#NAME? usually means there are quotation marks missing from a Text argument.

Best practices

Do this

Description

Use the ampersand & character instead of the CONCATENATE function.

The ampersand (&) calculation operator lets you join text items without having to use a function.

For example, =A1 & B1 returns the same value as =CONCATENATE(A1,B1). In many cases, using the ampersand operator is quicker and simpler than using CONCATENATE to create strings.

Learn more about using operation calculators.

Use the TEXT function to combine and format strings.

The TEXT function converts a numeric value to text and combines numbers with text or symbols.

For example, if cell A1 contains the number 23.5, you can use the following formula to format the number as a dollar amount:

=TEXT(A1,"$0.00")

Result: $23.50


=====================

The CONCAT function combines the text from multiple ranges and/or strings, but it doesn't provide delimiter or IgnoreEmpty arguments. 

CONCAT replaces the CONCATENATE function. However, the CONCATENATE function will stay available for compatibility with earlier versions of Excel. 

Syntax

CONCAT(text1, [text2],…)

Argument

Description

text1(required)

Text item to be joined. A string, or array of strings, such as a range of cells.

[text2, ...](optional)

Additional text items to be joined. There can be a maximum of 253 text arguments for the text items. Each can be a string, or array of strings, such as a range of cells.

For example, =CONCAT("The"," ","sun"," ","will"," ","come"," ","up"," ","tomorrow.") will return The sun will come up tomorrow.

Tip: To include delimiters (such as spacing or ampersands (&)) between the text you want to combine, and to remove empty arguments you don't want to appear in the combined text result, you can use the TEXTJOIN function.

Remarks

  • If the resulting string exceeds 32767 characters (cell limit), CONCAT returns the #VALUE! error.

Examples

Copy the example data in each of the following tables, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Example 1

=CONCAT(B:B, C:C)

A's

B's

a1

b1

a2

b2

a4

b4

a5

b5

a6

b6

a7

b7

Because this function allows full column and row references, it returns this result: A’sa1a2a4a5a6a7B’sb1b2b4b5b6b7

Example 2

=CONCAT(B2:C8)

A's

B's

a1

b1

a2

b2

a4

b4

a5

b5

a6

b6

a7

b7

Result: a1b1a2b2a4b4a5b5a6b6a7b7

Example 3

Data

First Name

Last name

brook trout

Andreas

Hauser

species

Fourth

Pine

32

Formula

Description

Result

=CONCAT("Stream population for ", A2," ", A3, " is ", A4, "/mile.")

Creates a sentence by joining the data in column A with other text.

Stream population for brook trout species is 32/mile.

=CONCAT(B2," ", C2)

Joins three things: the string in cell B2, a space character, and the value in cell C2.

Andreas Hauser

=CONCAT(C2, ", ", B2)

Joins three things: the string in cell C2, a string with a comma and a space character, and the value in cell B2.

Hauser, Andreas

=CONCAT(B3," & ", C3)

Joins three things: the string in cell B3, a string consisting of a space with ampersand and another space, and the value in cell C3.

Fourth & Pine

=B3 & " & " & C3

Joins the same items as the previous example, but by using the ampersand (&) calculation operator instead of the CONCAT function.

Fourth & Pine

Comments

Popular posts from this blog

[Topic] Relation between two people in different stages

why spring onions sold in UK withers very quickly upon regrowing in water

關閉 pagefile.sys 與 hiberfil.sys