Function Problems

How to Hide Commas When Combining Blank Cells in Excel

Adam DavisAdam Davis Oct 23, 2026 870 views

Question details

The user needs a formula to combine first and last names from separate cells with a comma, while ensuring no orphaned comma is displayed if one or both source cells are blank.

How to Hide Commas When Combining Blank Cells in Excel
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Combining data entries like first and last names from different columns into a single cell using a comma as a separator.
Observed behavior
When using basic CONCAT or string concatenation, a comma remains visible in the result cell even when the source data cells are empty.
Before you start

Verify the exact cell references containing your first and last names, and check if your spreadsheet software version supports the TEXTJOIN function, which simplifies handling blank cells.

Solution 1Recommended

Use the TEXTJOIN Function to Ignore Blank Cells

The TEXTJOIN function is the most efficient way to combine text because it includes a built-in argument to automatically ignore blank cells, preventing extra delimiters like commas.

TEXTJOIN was introduced in newer versions of Excel and is fully supported in WPS Spreadsheet. It allows you to specify a delimiter, choose whether to ignore empty cells, and select the range of cells to combine.

1
Select the target cell

Click on the cell where you want the combined names to appear.

2
Enter the TEXTJOIN formula

Type the formula: =TEXTJOIN(", ", TRUE, DataSheet!B16, DataSheet!A16) into the formula bar.

3
Apply the formula

Press Enter. The 'TRUE' argument tells the formula to ignore any blank cells, so the comma separator will only appear if both names are present.

Use the TEXTJOIN Function to Ignore Blank Cells
Tip: You can replace 'DataSheet!B16' and 'DataSheet!A16' with the specific cell ranges matching your own dataset.
Advanced Formula Support in WPS

Easily Combine Text and Handle Blank Cells with WPS Spreadsheet

WPS Spreadsheet fully supports advanced text functions like TEXTJOIN, CONCAT, and IF, allowing you to seamlessly combine text, ignore blanks, and format your data without dealing with messy leftover commas.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the names.
  2. 2. Apply the TEXTJOIN function: Click on your target cell and type =TEXTJOIN(", ", TRUE, B2, A2).
  3. 3. Drag to fill: Press Enter, then drag the fill handle down to apply the clean formatting to your entire list automatically.
Fully compatible with Microsoft Excel formulas and .xlsx formatsBuilt-in support for advanced functions including TEXTJOIN, CONCAT, and IFSLightweight application that handles large datasets smoothlyFree and easy to use for daily professional spreadsheet tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why does CONCATENATE leave commas when cells are blank?

The older CONCATENATE function directly stitches together whatever values you provide, including hardcoded strings like commas ", ". It does not possess built-in logic to evaluate whether the adjacent cell is empty before inserting the text.

Can I hide the comma if only the last name is missing?

Yes, using the TEXTJOIN function with the 'ignore_empty' argument set to TRUE handles this automatically. It only places the delimiter between non-empty text strings, ensuring no trailing commas appear.

What if my spreadsheet version doesn't have the TEXTJOIN function?

You can use the IF function to evaluate the cells first. For example, using =IF(ISBLANK(B2), A2, A2 & ", " & B2) will check if B2 is blank and output just A2, otherwise it will output both separated by a comma.

How do I combine cells with a space instead of a comma?

Simply change the delimiter in your formula. For TEXTJOIN, replace ", " with " " in the first argument: =TEXTJOIN(" ", TRUE, A2, B2). This will insert a space between the values.