Make an Excel Formula Return a Blank Unless a Cell Contains X
Question details
Show a formula result only when another cell contains an uppercase or lowercase X.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A control cell determines whether a calculated result should appear.
- Observed behavior
- The calculated cell should display its result when the control cell contains X or x and appear blank otherwise.
Identify the cell that controls the result and the calculation you want to show. The example below uses C2 as the control cell and checks for X or x as the entire cell value.
Use IF and UPPER to Check for X in Excel
Wrap an existing calculation in an IF formula to display it only when the control cell contains X or x.
Click the cell where you want the calculated result to appear.
In the formula bar, enter =IF(UPPER(C2)="X",A2+B2,""). Replace A2+B2 with your calculation, without its leading equals sign, and replace C2 if your control cell is different.
Press Enter, then type X or x in C2 to show the calculation. Clear C2 or enter another value to make the result appear blank.

Show Conditional Results in WPS Spreadsheets
Use the same IF and UPPER formula in WPS Spreadsheets to display a calculation only when a control cell contains X or x.
- 1. Open the spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Select the result cell: Click the cell where you want to display the conditional calculation.
- 3. Enter the formula: In the formula bar, enter =IF(UPPER(C2)="X",A2+B2,""). Replace C2 and A2+B2 with your control cell and calculation.
- 4. Check the condition: Press Enter, then type X or x in C2 to check that the result appears.

Frequently Asked Questions
Does the formula work with both X and x?
Yes. UPPER(C2) converts lowercase x to uppercase X before the IF formula compares it with "X".
Why does a cell containing other text with X not trigger the calculation?
The formula checks whether the entire value in C2 is X or x. For an X anywhere in the cell, use =IF(ISNUMBER(SEARCH("X",C2)),A2+B2,"") and replace A2+B2 with your calculation.
Is the result cell truly empty when the condition is false?
No. The cell contains the IF formula, which returns an empty string displayed as blank.
How do I use my existing calculation in the formula?
Replace A2+B2 in =IF(UPPER(C2)="X",A2+B2,"") with your calculation, omitting the calculation's leading equals sign.




