The TextGlue function

The TextGlue function combines text from multiple ranges, inserting a delimiter you specify between each text value that is combined.

The TextGlue function combines the text from multiple ranges and/or strings into a single text string. If you specify a delimiter, it is inserted between each text value that is combined.

Example: If the function references a cell range with four cells that contain “Jisoo”, “Jennie”, “Rosé” and “Lisa”, and the delimiter is “-“, the resulting string will be

Jisoo-Jennie-Rosé-Lisa

If a delimiter is not provided, the TextGlue function will effectively concatenate the ranges.

JisooJennieRoséLisa

An identical function is provided by Excel 2019 or later under the name TextJoin.

Function reference

Example

=TextGlue("&",TRUE, "Fleet=800", "", "Car=5", "", “Unit=200")

In the example above, the TextGlue function would return

Fleet=800&Car=5&Unit=200

The empty strings are ignored when the second parameter is TRUE.

Format and parameters

=TextGlue(delimiter, ignore_empty, text1, [text2], …)

delimiter (required)

A text string enclosed by double quotes, or a cell reference to one or more valid text strings. If a number is supplied, it will be treated as text. If you don’t wish to add a delimiter, enter “” (two consecutive double quotes representing an empty string).

ignore_empty (required)

There can be up to 16 arguments for the TextGlue function, either provided in the function call or through cell references. If some of these are empty, and you set this parameter to FALSE, the resulting string will contain duplicate delimiters, because it also contains the empty strings, e.g.

Jisoo--Rosé-

In most cases, you don’t want to include empty strings in the result, and then you should enter TRUE for this parameter.

Jisoo-Rosé

text1 (required)

The first text item to be joined. This can be a text string, a single cell reference, or a cell range.

[text2, …] (optional)

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