Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Superscripts in Find and Replace.

Superscripts in Find and Replace

Written by Allen Wyatt (last updated March 30, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Kirk needs to search for things like "yd2" and replace it with "yd2" where the "2" is superscripted. He wonders if there is a way to do that in Excel.

The find and replace capabilities of Excel are more limited than those of Word, where such replacements are relatively easy. While you could export your information to Word, do the replacements, and then import it back into Excel, there are some things you can do without ever leaving Excel.

First, however, let's examine something that you might reasonably think would work, but doesn't really. Note that the Replace tab of the Find and Replace dialog box seems to provide a way to specify attributes for the text you want to use as the replacement. This might lead you to think that you could do the following:

  1. Replace all instances of yd2 with yd$*$
  2. Replace all instances of $*$ with a superscripted 2.

While this sounds good in theory, it won't work. You can follow the steps, including making sure that the replacement 2 is set to be superscript. The problem, however, is that Excel applies the superscript format to the entire cell, not just to the 2. Thus, you end up with yd2 completely as superscript.

You could, if you wanted, skip superscripting all together and just use a typeface character that appears superscripted. If you use the Symbol dialog box, you can find the digits 0 through 3 that appear superscripted. If you use the superscripted digit 2 (ASCII 178) in your replacement text, then you can get the desired appearance. Follow these steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box. (See Figure 1.)
  2. Figure 1. The Replace tab of the Find and Replace dialog box.

  3. In the Find What box enter yd2.
  4. In the Replace With box enter yd and then hold down the Alt key as you type 0178 on the numeric keypad.
  5. Click Replace All.

Finally, if you really want to use superscripts, your best bet is going to be using a macro to do the formatting. The simplest method is tied to the specific example provided—making the 2 in yd2 superscript.

Sub DoConvert()
    Dim c As Range

    For Each c In Selection.Cells
        If c.Value = "yd2" Then
            c.Characters(3, 1).Font.Superscript = True
        End If
    Next
End Sub

To use the macro, select the cells you want to modify, then run the macro. Each cell in the selection is stepped through and checked to see if it contains the text yd2. If it does, then the third character (the 2) is made superscript; the rest of the cell is undisturbed.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12605) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Superscripts in Find and Replace.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Determining a Simple Moving Average

A moving average can be a great way to analyze a series of data points that you've collected over time. Setting up a ...

Discover More

Copying Formats

Want to copy a format from one place to another without taking your hands off the keyboard? It's easy to do if you apply ...

Discover More

Modifying Behavior of the Open Dialog Box

The Open dialog box is one that few of us think about, but you can control how it behaves with a little bit of macro ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

A Fast Find-Next

Tired of the Find and Replace dialog box blocking the view of your worksheet when you are searching for information? Do ...

Discover More

Searching for Wildcards

Wildcard characters can be used within the Find and Replace tool, but what if you want to actually search for those ...

Discover More

Counting the Results of a Formula Using Find and Replace

Need to get a count of a particular result from a formula? You can use Find and Replace (as described in this tip), but ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.