Superscript part value in a cell

This tutorial shows how to superscript (above the line) only some characters in a cell using Excel or VBA


METHOD 1. Superscript part value in a cell

EXCEL

Select character(s) > Right-click in cell > Format Cells > Check Superscript > Click OK

1. Select the character(s) in a cell that you want to superscript.
Note: in this example we are intending to superscript the number 4 in cell B2.
Select character in a cell

2. Right-click in the cell where you have selected the character(s) and select Format Cells. Right-click in cell and select Format Cells

3. Check the Superscript checkbox.
4. Click OK
Check Superscript checkbox

This image shows the result of this process, which has applied a superscript format to only one character in a cell. Superscript format applied to character

METHOD 1. Superscript part value in a cell

VBA

Sub Superscript_part_value()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'superscript a character in a cell
ws.Range("B2").Characters(Start:=2, Length:=1).Font.Superscript = True

End Sub

ADJUSTABLE PARAMETERS
Worksheet Selection: Select the worksheet in which you want to apply a restriction to a cell by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
Start position of superscript: Select the position in the cell to apply the superscript format by changing the Start value (2) in the VBA code. In this example we are starting with the second position.
Number of values to superscript: Select the number of character to superscript, relative to the Start position by changing the Length value (1) in the VBA code. In this example given we only want to superscript one character, we have assigned a value of 1 against the Length item.
Cell Reference: Select the cell that contains the value that you want to superscript by changing the cell reference ("B2") in the VBA code.

Explanation about how to superscript part value in a cell

EXPLANATION

EXPLANATION

This tutorial shows how to superscript (above the line) only some characters in a cell using Excel or VBA.
This tutorial provides one Excel method and one VBA method that can be applied to superscript only a selected number of characters in a single cell. Using the Excel method this can be achieved in four steps by using the Format Cells options. The VBA method uses Characters function to identify against which characters to apply the superscript format and then uses the Font.Superscript function to apply the superscript format.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to superscript (above the line) all of the characters in a cell
How to clear formatting in cells