Text & Google Sheets cleanup · 4 min read

Combine Cells in Excel Without Losing Data: TEXTJOIN, Spaces, and Blank Fields

A report needs one display name, but the source stores first, middle, and last names separately. Cell merging changes layout and can discard content; create a new result column when the task is to combine values.

Prepare a safe output column

Use Excel 2019, 2021, 2024, or Microsoft 365 with TEXTJOIN available. Put the sample in A1:C4 and type display_name in D1. Do not select Merge & Center for this task. Keep the original fields so later exports can still distinguish first and last names.

These are synthetic label fields, not a universal model of personal names. The desired display order is an explicit choice for this example. A different system may need last name first or separate sorting fields.

Join the fields with a single separator

Enter the formula below in D2, press Enter, and fill to D4. The delimiter is one ordinary space. TRUE requests that empty cells be ignored; it does not mean that all whitespace inside nonempty cells is removed.

Check the second row as well as the first: Omar has a middle initial that must survive. For Mei, the first field is empty and the other two still produce a useful label. The formula should not move data between source columns.

Join a row of fields
=TEXTJOIN(" ",TRUE,A2:C2)
Join content while retaining the source: Ada | blank | Lane; Omar | K | Reed → Ada Lane; Omar K Reed
Illustrated example. Illustrative synthetic example; not an application screenshot.

Use a version-compatible fallback

If TEXTJOIN returns #NAME?, first check spelling and whether the installed edition supports it. For a small, fixed set of fields the fallback below makes the separators explicit. It is intentionally limited to these three columns and uses TRIM to remove extra ordinary spaces.

TRIM also collapses repeated ordinary spaces inside the assembled text. If internal spacing is significant, do not use that cleanup indiscriminately. Neither approach restores leading zeros or date formatting that were already lost during import.

Inspect blanks and hidden spaces

A genuinely empty field differs from a field containing a space or a nonbreaking space. In a copy, add a trailing ordinary space to Ada and see why simply skipping empty cells is not full cleanup. If unwanted spaces originate upstream, clean selected source columns with a documented rule before joining.

For the fixed three-field sample, the fallback gives the same outputs as TEXTJOIN. English formulas below use commas between arguments; installations using another list separator may require adjusted punctuation.

Fallback for older Excel, where ordinary-space cleanup is acceptable
=TRIM(A2&" "&B2&" "&C2)

Preserve number and date presentation deliberately

Joining a date or number can expose its underlying value rather than its displayed format. If a report label needs a date string, specify it with TEXT, for example ="Run "&TEXT(F2,"yyyy-mm-dd") for a real numeric date in F2. Keep that label separate from the numeric date used for calculations.

Likewise, retain identifiers as text at import time. A custom number format that displays 00123 does not make the underlying number an original text identifier. If leading zeros are required, verify the source before building a label.

Expected output checkpoint: 3 source records; 1 missing middle field → 3 display names; Sources A:C retained
Illustrated example. Illustrative synthetic example; not an application screenshot.

Export only after checking each output

Verify the three exact output strings against the expected download. If downstream users need fixed text, copy D2:D4 to a separate destination using Paste Special > Values, then inspect it before removing anything. Keeping the live formula and a values-only export in separate places makes the boundary clear.

TEXTJOIN is for assembling labels, not a CSV writer. Names containing commas, quotes, or line breaks require proper CSV escaping when exported. Preserve the workbook and use the spreadsheet's export process, then inspect the resulting file before uploading it elsewhere.

Common questions

Will Merge & Center concatenate text?

Use a formula in a new column to combine values; merging is a layout operation and can lose cell contents.

Why are there extra spaces?

A nonempty source may contain spaces. Inspect and clean the intended fields rather than assuming ignore_empty trims them.

Can I delete source columns immediately?

First preserve a copy and, if needed, paste verified results as values elsewhere so formulas do not lose their references.

Sources & method

Examples and diagrams use synthetic data. Application instructions follow the linked documentation; available menus and options can vary. Our sample checks do not establish behavior in every Excel or Google Sheets version. Read our AI-assisted editorial method.

Browse all field guides →