Function Problems

Insert Cell Values into IF Formula Text in Excel

Anum MushtaqAnum Mushtaq Nov 18, 2026 870 views

Question details

Combine numbers from cells with text returned by an IF formula for use in documents or mail merges.

Insert Cell Values into IF Formula Text in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Create a conditional text passage that includes a share count and a dollar amount from worksheet cells.
Observed behavior
When the condition is met, the formula should return the text with the cell values inserted; otherwise, it should return an empty string.
Before you start

Identify the condition cell and the cells containing the values you want to insert. In the example below, D1 contains the condition, C2 contains the share count, and P2 contains the dollar amount.

Solution 1Recommended

Use an ampersand to combine IF formula text and cell values

Use this approach to insert cell values into a text passage only when the IF condition is met.

1
Select an output cell

In Excel, click an empty cell where you want the completed text to appear.

2
Enter the IF formula

Enter =IF(D1="Applicable","and "&C2&" restricted common shares of Company Ltd. (as traded on the New York Stock Exchange under the symbol CPY, the Company Stock), calculated by dividing $"&P2&" by the Volume Weighted Average Price of the Company Stock, payable at closing.","") and press Enter.

3
Format numbers if needed

In the formula bar, replace C2 with TEXT(C2,"#,##0") for a whole-number share count, or replace P2 with TEXT(P2,"#,##0.00") to show two decimal places after the dollar sign.

4
Check the result

Enter Applicable in D1 and verify that the output includes the values from C2 and P2. Change D1 to another value to confirm that the formula returns an empty string.

Use an ampersand to combine IF formula text and cell values
Number formatting: Concatenation does not necessarily preserve the source cell's displayed number format. Use TEXT when the output needs a specific format. Depending on your regional settings, Excel may require semicolons instead of commas between function arguments.
Work with conditional text in WPS

Build conditional text with WPS Spreadsheets

Use IF, ampersands, and TEXT in WPS Spreadsheets to combine worksheet values with a conditional text passage.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Select an output cell: Click an empty cell where the conditional passage should appear.
  3. 3. Enter the formula: Type =IF(D1="Applicable","and "&C2&" shares, calculated by dividing $"&TEXT(P2,"#,##0.00"),"") and press Enter. Adjust the text and cell references for your worksheet.
  4. 4. Check and save: Set D1 to Applicable, check the result, and use File > Save to save the workbook.
Combine cell values and text with an IF formula.Control displayed number formats with the TEXT function.Open and save Microsoft Excel XLSX workbooks.Work with a familiar spreadsheet interface.
microsoft office alternative - wps office

Frequently Asked Questions

How do I add a space between text and a cell value?

Include the space inside the quoted text. For example, ="Shares: "&C2 adds a space after the colon before inserting C2.

Why did my currency formatting disappear in the combined text?

Concatenation uses the underlying value rather than necessarily preserving the cell's display format. Use a formula such as ="$"&TEXT(P2,"#,##0.00") to show two decimal places.

How do I include quotation marks inside the returned text?

Double each quotation mark inside a formula string. For example, ="the ""Company Stock""" returns the text the "Company Stock".

Can I use the formula result in a Word mail merge?

Yes. Save the Excel workbook with a header for the formula column, then in Word select Mailings > Select Recipients > Use an Existing List and choose the workbook. Insert the column as a merge field and preview the results.