Formula Errors

How to Use Excel IF Formula with Text Containing Square Brackets

Adam DavisAdam Davis Nov 11, 2026 869 views

Question details

The user needs to construct an Excel IF formula that correctly evaluates text containing square brackets, quotation marks, and commas, typically generated by external tools like Power Automate.

How to Use Excel IF Formula with Text Containing Square Brackets
Product
Excel
Device & OS
not provided
Scenario
Comparing imported or pasted string data containing brackets and quotes from external sources to verify if it matches an expected text pattern.
Observed behavior
The formula may fail or return incorrect results if the exact spacing, punctuation, and specific quotation mark types (smart vs. straight) do not exactly match the source text.
Before you start

Verify the exact format of your imported text, taking special note of any hidden spaces or curly 'smart' quotation marks that might differ from standard straight quotes.

Solution 1Recommended

Use Exact String Matching in the IF Formula

Embed the exact target string directly inside the IF function, ensuring all brackets and punctuation match perfectly.

Square brackets are treated as standard text characters in Excel when enclosed in double quotes. The most common cause of failure is mismatched quotation mark styles or invisible spacing.

1
Select the result cell

Click on the cell where you want the IF formula result to be displayed.

2
Write the IF formula

Type the IF function, wrapping your entire target string in straight double quotes. For example: =IF(A1="[“water”,”stone”,”plants”]", 1, 0)

3
Verify inner quotes

Ensure that the inner quotation marks (such as “ ”) in your formula exactly match the type of quotes generated by Power Automate.

4
Evaluate the formula

Press Enter to calculate the result. If the text is an exact match, the formula will output your specified true value.

Use Exact String Matching in the IF Formula
Watch the Quote Styles: Excel treats standard straight quotes (") differently from smart or curly quotes (“ ”). Ensure your formula uses the exact type present in your source data.

Handle Complex Formulas Easily with WPS Spreadsheet

WPS Spreadsheet is a robust, free alternative for managing data, handling complex text strings, and executing logical formulas like IF. It seamlessly processes imported data from tools like Power Automate and offers a highly compatible environment for your daily data analysis.

  1. 1. Open your spreadsheet: Launch WPS Spreadsheet and open the document containing your imported Power Automate data.
  2. 2. Enter the IF formula: Select an empty cell and input your IF formula to compare your data against the expected text string with brackets.
  3. 3. Evaluate and apply: Press Enter to see the result, and drag the fill handle to apply the logic down your entire data column.
Fully compatible with Microsoft Excel formulas, functions, and data formats (.xlsx)Easily evaluate complex text strings containing brackets, arrays, and special charactersFree, lightweight, and user-friendly interface designed for fast data processing
microsoft office alternative - wps office

Frequently Asked Questions

Why does my IF formula return false even when the text looks identical?

This usually happens due to hidden trailing spaces, leading spaces, or differing quotation mark types (straight vs. curly). You can use the TRIM function to remove extra spaces or copy the exact text from the source to ensure a perfect match.

Do I need to escape square brackets in Excel formulas?

No, square brackets inside a text string (when enclosed in outer double quotes) are treated as regular text characters. They do not need to be escaped in an IF function's text comparison.

How do I handle quotation marks within a string in an IF formula?

If the text contains standard straight quotes, you must double them up to escape them (e.g., """water"""). If the string uses smart quotes (“”), you can include them normally as long as the entire string is wrapped in standard straight quotes.