icon

Feb 22, 2022

Excel textjoin() add-in for 2013


Steps:

1. Open a blank workbook

2. Press ALT+F11 to open the VBA editor

3. In the Project window on the left, right-click on the workbook name and choose Insert ->Module

4. Paste this code in the resultant window

Option Explicit
Function TEXTJOIN(delimiter As String, ignore_empty As String, ParamArray textn() As Variant) As String
    Dim i As Long
    For i = LBound(textn) To UBound(textn) - 1
        If Len(textn(i)) = 0 Then
            If Not ignore_empty = True Then
                TEXTJOIN = TEXTJOIN & textn(i) & delimiter
            End If
        Else
            TEXTJOIN = TEXTJOIN & textn(i) & delimiter
        End If
    Next
    TEXTJOIN = TEXTJOIN & textn(UBound(textn))
End Function

5. Save the workbook as an add-in type (.xlam)

6. Load the add-in into Excel (File ->Options ->Addins)


Syntax


TEXTJOIN( delimiter, ignore_empty, text1, [ text2, ... text_n ] )

Parameters or Arguments

delimiter

A string inserted between each text value in the resulting string. Most commonly, you would use a delimiter such as a comma or space character.

ignore_empty

Determines whether empty values are included in the resulting string. TRUE ignores empty values and FALSE includes empty values in the result.

text1, text2, ... text_n

The strings that you wish to join together. There can be up to 252 strings that are joined together.

Returns

The TEXTJOIN function returns a string/text value.