Use IF and Concatenation to Add Text Only When a Cell Has a Value in WPS Spreadsheets
Question details
Add a label or combine cells only when an input cell contains a value other than ordinary spaces.

- 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.
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.
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.
Click an empty cell outside B3 where you want the result to appear.
Type =IF(TRIM(B3)="","","VLAN "&B3) and press Enter. Replace VLAN and B3 as needed.
Enter a value in B3 to display the label and value. Clear B3 or enter only ordinary spaces to display an empty result.

Combine Two Cells Only When the Second Cell Has a Value
Use this option when A3 contains a label and B3 contains the value to append.
Add a Value Inside a VLAN Label
Use this variation to display a value in the format VLAN #(123).
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. Open a spreadsheet: Open WPS Spreadsheets and create or open a workbook.
- 2. Select an output cell: Click an empty cell that is separate from the input cell B3.
- 3. Enter the formula: Type =IF(TRIM(B3)="","","VLAN "&B3) and press Enter.
- 4. Test with a value: Enter a value in B3 and check that the output shows VLAN followed by that value.

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.




