Function Problems

Use IF and Concatenation to Add Text Only When a Cell Has a Value in WPS Spreadsheets

Khadija KhanKhadija Khan Dec 2, 2026 869 views

Question details

Add a label or combine cells only when an input cell contains a value other than ordinary spaces.

Add Text Only When a Cell Has a Value in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
A spreadsheet needs to display a label or combined text only when the input cell has a value.
Observed behavior
Blank cells and cells containing only ordinary spaces should produce an empty result; cells with values should display the requested text.
Before you start

Identify the input cell and choose a separate cell for the formula. The examples use B3 or B4 as the input; replace those references with the cells in your worksheet.

Solution 1Recommended

Use IF and TRIM to Add a Label to a Nonblank Cell

Use this formula to display a label only when the input contains more than ordinary spaces.

1
Select an output cell

Click an empty cell outside B3 where you want the result to appear.

2
Enter the formula

Type =IF(TRIM(B3)="","","VLAN "&B3) and press Enter. Replace VLAN and B3 as needed.

3
Test the result

Enter a value in B3 to display the label and value. Clear B3 or enter only ordinary spaces to display an empty result.

Use IF and TRIM to Add a Label to a Nonblank Cell
How spaces are handled: TRIM checks for ordinary spaces, but the displayed value comes from the original B3, so spaces around a nonblank value remain in the result. TRIM does not remove all special whitespace, such as nonbreaking spaces.
WPS Spreadsheets

Create Conditional Text Labels in WPS Spreadsheets

Use IF, TRIM, and the concatenation operator in WPS Spreadsheets to show a label only when an input cell contains a value.

  1. 1. Open a spreadsheet: Open WPS Spreadsheets and create or open a workbook.
  2. 2. Select an output cell: Click an empty cell that is separate from the input cell B3.
  3. 3. Enter the formula: Type =IF(TRIM(B3)="","","VLAN "&B3) and press Enter.
  4. 4. Test with a value: Enter a value in B3 and check that the output shows VLAN followed by that value.
Build conditional labels with familiar spreadsheet formulasOpen and save Microsoft Excel formats such as XLSXAdjust cell references and labels for your worksheet
microsoft office alternative - wps office

Frequently Asked Questions

How can I combine A3 and B3 only when B3 is not blank?

Enter =IF(TRIM(B3)="","",A3&" "&B3) in a separate cell. It combines A3 and B3 with a space when B3 contains a value.

Will the formula treat a cell containing only spaces as blank?

Yes. TRIM(B3) returns an empty string when B3 contains only ordinary spaces. It does not remove every special whitespace character.

Does the formula remove spaces from the displayed value?

No. The formula uses TRIM only for the blank check and displays the original B3 value. Use TRIM(B3) in the concatenated portion too if you want to remove leading and trailing ordinary spaces.

Will a zero in B3 be treated as a value?

Yes. A numeric zero is not blank, so the formula displays the label followed by 0.