How to Clean Smart Quotes in Excel Using the SUBSTITUTE Function

📅 Aug 12, 2026 📝 Sarah Miller

Importing external data into clean databases often fails because "smart" (curly) quotes break critical syntax. While standard funding sources for IT modernization focus on macro-level system integrations rather than these micro-level formatting hurdles, data analysts require immediate, cost-effective remedies. Fortunately, masterfully structuring your spreadsheets grants complete automation over character sanitization, saving hours of manual correction. As a key stipulation, this method specifically targets Unicode characters 147 and 148, so source encoding variations must be monitored. Implementing nested SUBSTITUTE functions to convert curly quotes to straight quotes serves as a proven blueprint. Below, we examine the exact formula syntax and step-by-step setup.

How to Clean Smart Quotes in Excel Using the SUBSTITUTE Function

If you have ever copy-pasted data from Microsoft Word, a PDF document, an email, or a web page into Excel, you have likely encountered the headache of "smart quotes." Also known as curly quotes (“ ” and ‘ '), these stylized punctuation marks look great in prose but are a complete nightmare in data management, programming, and Excel formulas.

Excel formulas, CSV parsers, database engines, and programming languages do not recognize smart quotes as valid text delimiters. To Excel, only the standard, straight double quotes (") and straight single quotes (') can define text strings. If your data contains smart quotes, your lookup formulas might fail, your data imports might break, and your SQL queries will throw syntax errors. Fortunately, you can clean these troublesome characters using Excel's SUBSTITUTE function. This guide will walk you through building a robust, reusable formula to purge smart quotes from your datasets.

The Anatomy of the SUBSTITUTE Function

To clean data in Excel, the SUBSTITUTE function is your primary tool. It searches a specific text string for a defined character or substring and replaces it with another. The syntax is straightforward:

=SUBSTITUTE(text, old_text, new_text, [instance_num])
  • text: The reference to the cell containing the text you want to clean.
  • old_text: The specific character or text you want to remove (e.g., a smart quote).
  • new_text: The character you want to replace it with (e.g., a straight quote).
  • instance_num (Optional): Specifies which occurrence of old_text to replace. If omitted, every occurrence is replaced.

The Challenge with Straight Quotes in Formulas

Before building the formula, there is a technical hurdle to address: how to write a straight double quote inside an Excel formula. Because Excel uses double quotes to start and end text strings, you cannot simply write " inside your formula to represent a double quote. Excel will think you are trying to open or close a string, resulting in a formula error.

There are two ways to solve this:

  1. The Quadruple Quote Trick: To represent a single straight double quote as a text string in Excel, you must write four of them in a row: """". The outer two quotes tell Excel this is a text string, and the inner two tell Excel to treat it as a literal double quote.
  2. The CHAR Function: A cleaner, less confusing method is to use the CHAR function. Every character on your computer has a corresponding character code. The standard straight double quote is code 34, and the straight single quote is code 39. Therefore, CHAR(34) returns a straight double quote, and CHAR(39) returns a straight single quote.

Building the Master Cleaning Formula Step-by-Step

To completely clean a cell, we must address four distinct smart quote characters:

  • Left Double Curly Quote ()
  • Right Double Curly Quote ()
  • Left Single Curly Quote ()
  • Right Single Curly Quote (')

We can clean all of these by nesting multiple SUBSTITUTE functions inside one another. Let's build this step-by-step, assuming the dirty text is in cell A2.

Step 1: Replace Double Curly Quotes with Straight Quotes

First, we nest two SUBSTITUTE functions to target both the opening and closing double curly quotes, replacing them with a straight double quote (using CHAR(34)):

=SUBSTITUTE(SUBSTITUTE(A2, "“", CHAR(34)), "”", CHAR(34))

Step 2: Add Single Curly Quotes to the Formula

Next, we nest two more SUBSTITUTE functions around our existing formula to target the single curly quotes, replacing them with a straight single quote (using CHAR(39)):

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, "“", CHAR(34)), "”", CHAR(34)), "‘", CHAR(39)), "'", CHAR(39))

This single, nested formula systematically scans the text in cell A2 and replaces all four variations of curly quotes with their standard, data-friendly straight equivalents.

A More Reliable Approach: Using CHAR Codes for Smart Quotes

While the formula above works perfectly, typing or copy-pasting curly quotes directly into the Excel formula bar can sometimes fail. Depending on your system language, regional settings, or keyboard layouts, Excel may not interpret the pasted curly quote correctly.

To make your formula bulletproof across all devices and locales, you can use the exact character codes for the smart quotes themselves. Here is the translation table of the character codes involved:

Character Name Visual Symbol ASCII/ANSI Code Straight Replacement Code
Left Single Curly Quote CHAR(145) CHAR(39) ( ' )
Right Single Curly Quote ' CHAR(146) CHAR(39) ( ' )
Left Double Curly Quote CHAR(147) CHAR(34) ( " )
Right Double Curly Quote CHAR(148) CHAR(34) ( " )

Using these codes, we can rewrite our nested formula to be completely immune to copy-paste issues and keyboard variations:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, CHAR(147), CHAR(34)), CHAR(148), CHAR(34)), CHAR(145), CHAR(39)), CHAR(146), CHAR(39))

This formula requires no hardcoded curly quotes. It is highly readable for advanced Excel users and can be safely shared across global teams without risk of breaking.

Alternative Method: Using Power Query for Bulk Cleaning

If you are working with millions of rows of data, writing complex formulas can slow down your workbook's performance. For large-scale data transformation, Power Query is a much faster and more sustainable solution.

To replace smart quotes using Power Query, follow these steps:

  1. Select your data range, navigate to the Data tab, and click From Sheet (or From Table/Range).
  2. Once the Power Query Editor opens, right-click the column header containing the dirty text and select Replace Values....
  3. In the "Value To Find" field, paste the opening double curly quote (). In the "Replace With" field, type a standard double quote ("). Click OK.
  4. Repeat this step for the closing double curly quote () and the single curly quotes ( and ').
  5. Go to the Home tab and click Close & Apply to load your pristine data back into Excel.

Pro Tip: Prevent Smart Quotes from Re-entering Your Workbook

Cleaning your data is great, but preventing the issue at the source is even better. Excel actually has an auto-correct setting that converts straight quotes to smart quotes automatically as you type. If you want to disable this feature globally across Microsoft Office, follow these steps:

  1. In Excel, go to File > Options.
  2. Select Proofing on the left-side menu.
  3. Click the AutoCorrect Options... button.
  4. Navigate to the AutoFormat As You Type tab.
  5. Under the "Replace as you type" section, uncheck the box for "Straight quotes" with “smart quotes”.
  6. Click OK to save your preferences.

Conclusion

Smart quotes can cause silent, frustrating errors in your data pipelines. By utilizing the nested SUBSTITUTE function with robust CHAR codes, you can instantly cleanse your text, ensuring absolute compatibility with external applications, databases, and core Excel operations. For persistent projects, adjusting your Microsoft Office AutoCorrect preferences or utilizing Power Query can save you hours of troubleshooting down the line.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.