Skip to main content
ExcelTEXTJOINTextString ManipulationData CleaningConcatenation

The Problem

Are you staring at a spreadsheet filled with data spread across multiple columns – perhaps an address broken into street, city, state, and zip, or product specifications listed individually? The challenge often lies in merging these disparate pieces into one coherent, readable string for reports, labels, or further analysis. Manually concatenating cells using the & operator or the CONCAT function can become tedious, especially when dealing with many cells or needing a consistent separator. It's even more frustrating when some cells might be empty, leading to unsightly extra delimiters.

What is TEXTJOIN? TEXTJOIN is an Excel function designed to combine text from multiple ranges or items into a single string, separating each item with a specified delimiter. It is commonly used to clean data, create custom reports, or format addresses by efficiently concatenating various text components. It’s a powerful tool that simplifies what used to be a complex, multi-step process for many Excel users.

Imagine needing to combine first and last names, or product codes with descriptions, all while ensuring that commas, spaces, or hyphens appear exactly where they should. That’s where the TEXTJOIN function steps in, offering an elegant solution to these common data manipulation headaches. It saves countless hours of manual data entry and formula adjustments.

The Ingredients: Understanding TEXTJOIN's Setup

To truly master the TEXTJOIN function, you need to understand its core components. Think of these as the fundamental ingredients in your Excel recipe. The syntax is straightforward, yet incredibly versatile:

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

Let’s break down each parameter, much like a chef explains the purpose of each item in a pantry. Understanding these will help you craft perfect text strings every time.

| Parameter | Description The world's first Excel course creator. |
| textN: The cell or range containing text to be concatenated. 2. ignore_empty: TRUE if you want to skip empty cells and not add a delimiter before/after them. FALSE if you want to include empty cells in the joined string, meaning delimiters will appear even if the cell is empty.
| text1: The first item of text or a range of cells that you want to join. This is a required argument.
| [text2], ...: Additional text items or ranges that you want to join. You can specify up to 252 text arguments.

In our experience, ignore_empty is a game-changer. Setting it to TRUE will prevent those awkward double commas or leading/trailing delimiters when you have missing data, which is a common scenario in real-world datasets. This small detail dramatically improves the cleanliness and readability of your combined strings.

The Recipe: Step-by-Step Instructions

Let’s apply the TEXTJOIN function to a practical example. Imagine you have customer address details spread across several columns and you need to combine them into a single, properly formatted address string for mailing labels or a customer database.

Here’s our sample data:

Customer ID Street Address City State Zip Code Email
101 123 Maple Street Springfield IL 62704 john.doe@example.com
102 45 Pine Lane Shelbyville 62565 jane.smith@example.com
103 789 Oak Avenue Capital City WA 98501 bob.johnson@example.com
104 10 Elmwood Drive NY 10001 alice.brown@example.com

Our goal is to create a full address in a new column, formatted like: "Street Address, City, State Zip Code".

  1. Select Your Output Cell: Click on cell F2, where you want the first combined address to appear. This is where we'll start building our TEXTJOIN formula.

  2. Define Your Delimiter: We want a comma and a space (, ) between the street and city, and between the city and state. We'll also want a space between the state and zip code. For simplicity in this first step, let's target just a comma and a space for all major separations. Our primary delimiter will be ", ".

  3. Choose Your Empty Handling: Notice Customer 102 has no "State" and Customer 104 has no "City". If we want to avoid extra delimiters like "Shelbyville, , 62565", we should set ignore_empty to TRUE.

  4. Enter the TEXTJOIN Formula: Type the beginning of your formula into cell F2:
    =TEXTJOIN(", ", TRUE,

    Now, we'll select the cells containing the address components in the desired order. Remember, TEXTJOIN can handle individual cell references or ranges.

  5. Add Your Text Arguments:

    • First, click on B2 (Street Address).
    • Then, click on C2 (City).
    • Next, click on D2 (State).
    • Finally, click on E2 (Zip Code).

    Your formula should now look like this:
    =TEXTJOIN(", ", TRUE, B2, C2, D2, E2)

    Press Enter.

The result in F2 will be: 123 Maple Street, Springfield, IL, 62704.

Now, drag the fill handle (the small square at the bottom-right corner of cell F2) down to F5 to apply the formula to the other addresses.

Let's look at the result for Customer 102 (Row 3): 45 Pine Lane, Shelbyville, 62565. Notice how TEXTJOIN intelligently skipped the empty State cell (D3), preventing an unnecessary , , in the output. This demonstrates the power of setting ignore_empty to TRUE.

For Customer 104 (Row 5), the result is: 10 Elmwood Drive, NY, 10001. Again, the empty city cell (C5) was skipped, maintaining a clean address string. This is why many experienced Excel users prefer TEXTJOIN over older concatenation methods when dealing with variable data.

Pro Tips: Level Up Your Skills

Beyond the basic application, TEXTJOIN offers several ways to enhance your data manipulation workflow. These tips will help you use the function like a true Excel professional.

  • Set 'ignore_empty' to TRUE to avoid unnecessary delimiters when combining text from potentially empty cells. This is arguably the most crucial best practice for TEXTJOIN. It ensures your output strings remain clean and professional, even when your source data is inconsistent. Always consider whether your data might have blanks, and if so, leverage this powerful argument.

  • Use Named Ranges for Consistency: For complex formulas or when you're joining a large range of cells that might change, consider creating a named range for your text arguments. For instance, if B2:E2 is named AddressLine1, your formula could be =TEXTJOIN(", ", TRUE, AddressLine1). This makes formulas more readable and easier to update.

  • Combine with IF or other logical functions: You can embed IF statements within TEXTJOIN to conditionally include text. For example, =TEXTJOIN(", ", TRUE, B2, C2, IF(D2<>"", D2&" "&E2, E2)) could combine City, State, and Zip more precisely, ensuring the state and zip always stick together with a space, but only if the state exists. This allows for nuanced formatting that goes beyond simple concatenation.

  • Dynamic Delimiters: While our example used a static delimiter, you can make your delimiter dynamic by referencing a cell or using another function that generates text. For instance, if cell A1 contained "; ", your delimiter argument could be A1. This offers immense flexibility when you need to change separators across many formulas.

Troubleshooting: Common Errors & Fixes

Even the most seasoned Excel chefs occasionally run into a snag. Understanding common TEXTJOIN errors and their fixes will save you time and frustration.

1. #VALUE! Error

  • What it looks like: #VALUE! displayed in the cell where your TEXTJOIN formula resides.
  • Why it happens: This error typically occurs if the delimiter argument or the ignore_empty argument are not of the correct data type. The delimiter must be a text string (enclosed in double quotes or a reference to a cell containing text), and ignore_empty must be a logical value (TRUE or FALSE). You cannot use a number where TRUE or FALSE is expected.
  • How to fix it: Double-check your formula's first two arguments. Ensure your delimiter is properly quoted (e.g., ", " or " - ") or refers to a cell with text. Confirm that your ignore_empty argument is explicitly TRUE or FALSE (without quotes), not a number like 0 or 1 (which Excel sometimes auto-converts but is best avoided for clarity).

2. Empty Strings if ignore_empty is FALSE

  • What it looks like: Your combined text has unnecessary delimiters, like "City, , Zip" or "Street,,State", indicating a blank space was treated as a valid text item.
  • Why it happens: This isn't technically an "error" in Excel's eyes, but it's a common output issue when ignore_empty is set to FALSE (or omitted, as FALSE is the default). When ignore_empty is FALSE, TEXTJOIN includes every cell you specify in its text arguments, even if those cells are empty, placing a delimiter for them.
  • How to fix it: Modify your formula to explicitly set the ignore_empty argument to TRUE. For example, change TEXTJOIN(", ", FALSE, B2,C2,D2,E2) to TEXTJOIN(", ", TRUE, B2,C2,D2,E2). This tells TEXTJOIN to intelligently skip over any empty cells in your specified range or list of arguments, resulting in cleaner, more professional output without extraneous delimiters.

Quick Reference

Here’s a concise summary to keep handy for your TEXTJOIN endeavors:

  • Syntax: TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
  • Most Common Use Case: Combining data from multiple columns (e.g., address components, names, product descriptions) into a single, delimited string.
  • Key Gotcha to Avoid: Forgetting to set ignore_empty to TRUE can lead to unwanted extra delimiters when source cells are blank.
  • Related Functions to Explore:
    • CONCAT: Joins text from multiple ranges/strings without a delimiter argument.
    • CONCATENATE (& operator): Joins text from individual cells/strings one by one.
    • SUBSTITUTE/REPLACE: Useful for cleaning up strings after joining, or for more advanced text manipulation.
    • TRIM: Removes extra spaces from text, often useful before or after using TEXTJOIN for cleaner results.
👨‍💻

Written by The Head Chef

Former 10-year Financial Analyst who survived countless month-end closes. I build these recipes to save you from weekend-ruining spreadsheet errors.

Read the full story →

You might also find these useful 💡