There are various reasons why superscript formatting may not be working as expected in Excel. In this tutorial, we will discuss these reasons and provide solutions for them.
In the following image, we have a dataset where our superscripts are not working due to incorrect number formats. We will demonstrate how to fix this issue and display superscripts properly.
We can manually set a character as superscript when the cell formatting is General, Text, or Currency. If any other number format is used, the characters will not be displayed as superscripts. If we try to insert superscripts using their Unicode values or via the CHAR function, we will get a #VALUE! error for superscript characters other than 1, 2 & 3.
If superscripts are set using the Format Cells dialog box in the source data, they will not appear in Excel charts.
Note: We used Microsoft 365 to prepare this article. However, the features and functions used in this tutorial will work in Excel 2021, Excel 2019, Excel 2016, and Excel 2013 versions as well.
Reason 1 – Superscript Is Not Working Due to Incorrect Number Format in Cells
In the following simple dataset, we have set some characters as superscripts from the Font tab of the Format Cells dialog box. However, the superscripts are still displayed as normal characters.
Let’s check whether the Superscript format is still enabled.
- Select the range D6:D11 => Go to the Home tab.
The Format Cells dialog box launcher icon is situated under the Font group of commands.
After clicking the dialog box launcher icon, the Format Cells dialog box opens on the Font tab. The Superscript effect is still enabled.
The reason for the Superscript effect not working here is incorrect number formatting. If you check the Number Format of the range D6:D11, the cells are formatted as Accounting.
Solution 1 – Change the Number Format to General, Text, or Currency
For the Superscript effect to work, we have to set the Number Format to General, Text, or Currency. Other number formats will usually display inaccurate results.
Let’s set the proper number format to show the superscripts.
Steps:
- Select the range D5:D11 => go to the Home tab => click the Format Cells dialog box launcher.
- After clicking the dialog box launcher icon, in the Number tab of the Format Cells dialog box, set the Category to General, Text, or Currency.
Here, we set set the Category to Text.
- Click the OK button.
As the Number Format is now set to Text, the superscripts will display properly.
Read More: How to Write 1st 2nd 3rd in Excel
Solution 2 – Apply VBA Code to Generate Superscripts
We can also apply VBA code to change the number format of a range of cells and apply the Superscript effect as well.
- Go to the Developer tab.
- Select the Visual Basic option from the Code group of commands.
The Visual Basic Editor window will open.
- Click the Insert menu, then the Module option.
Note: If the Developer tab is not available in your Excel ribbon, use the keyboard shortcut Alt + F11 to open the Visual Basic Editor window.
After selecting the Module option, a window called Module1 will appear.
- Insert the following code in the module and click the Save button.
Sub CreateSuperscript()
Set ws = ThisWorkbook.ActiveSheet
Dim base_col As Integer
Dim superscript_col As Integer
Dim result_range As Range
On Error Resume Next
base_col = InputBox("Index of the Base Column:")
On Error GoTo 0
If base_col <= 0 Then
MsgBox "Invalid Base Column Index!"
Exit Sub
End If
On Error Resume Next
superscript_col = InputBox("Index of the Superscript Column:")
On Error GoTo 0
If superscript_col <= 0 Then
MsgBox "Invalid Superscript Column Index"
Exit Sub
End If
On Error Resume Next
Set result_range = Application.InputBox("Select the output range:", "Select Range", Type:=8)
On Error GoTo 0
If Not result_range Is Nothing = False Or result_range.Columns.Count > 1 Then
MsgBox "Invalid Output Range!"
Exit Sub
End If
Dim i As Integer
Dim base As String
Dim super_script As String
Dim adrs As String
For Each cell In result_range
base = ws.Cells(cell.Row, base_col).Text
super_script = ws.Cells(cell.Row, superscript_col).Text
cell.NumberFormat = "@"
cell.Value = base & super_script
cell.Characters(Start:=Len(base) + 1, Length:=Len(super_script)).Font.Superscript = True
Next cell
End Sub
Step 2:
After clicking the Run button, an Input Box like the following will open.
- Enter the index of the Base column. Since the Base values are in Column B here, we enter 2 in the Input Box.
After clicking the OK button, another Input Box opens.
- Enter the index of the Superscript column here. Since the Superscript values are in Column C, we enter 3 in the Input Box.
After clicking the OK button, one final Input Box for selecting the output range opens.
- Select the range D6:D11.
- Click OK.
- After clicking the OK button, return to the worksheet.
The output cells have the desired superscripts now.
Reason 2 – The CHAR Function Cannot Generate Superscripts for All Characters
You may want to insert superscripts by using the CHAR function. But the CHAR function in Excel takes ASCII codes as its argument, so its arguments are limited to between 1 and 255 only. As a result, the CHAR function can only return the 1, 2 & 3 superscript characters, and will show a #VALUE! error for all other characters.
For example, consider the following dataset where we have a list of bases, superscripts, and Unicodes for the superscripts.
We can use the following formula in cell E6 to apply superscripts here:
=B6&CHAR(D6)
After pressing Enter and dragging down the Fill Handle icon, we will get the following output:
The 1, 2 & 3 superscripts display properly, but we have a #VALUE! Error for the other characters. We can resolve this problem by using the UNICHAR function or a VBA code instead.
Solution 1 – Use the UNICHAR Function Instead
Because the UNICHAR function takes Unicode values as its argument, it can return a wide range of superscripts.
- To apply superscripts with the UNICHAR function, insert the following formula in cell E6:
=B6&UNICHAR(D6)
- Press Enter and drag down the Fill Handle icon.
Now we have superscripts for all required characters.
Solution 2 – Use Multiple UNICHAR Functions
Although we can generate a wide range of superscripts using Unicodes in the UNICHAR function, there aren’t any Unicodes available for multi-character superscripts. If your superscript contains more than one character or number, you can use multiple UNICHAR functions.
For example, consider the following dataset where the superscript is 25.
As there is no Unicode for 25, we’ll have to apply two UNICHAR functions with the Unicodes for 2 and 5 respectively.
- Insert the following formula in cell D6 and press Enter to get the required superscript:
=B6&UNICHAR(178)&UNICHAR(8309)
Here, 178 and 8309 are the Unicodes for 2 and 5 respectively.
Solution 3 – Combine the REPT and UNICHAR Functions
If the required superscript has one character multiple times in a sequence, we can combine the REPT and UNICHAR functions. For example, consider the following dataset where the superscript is 777. We can use the REPT function to repeat the 7 character 3 times.
- Enter the following formula in cell D6 and press Enter to get the required superscript:
=B6&REPT(UNICHAR(8311),3)
Here, 8311 represents the Unicode of the 7 character.
The following image contains a list of the Unicodes of the frequently used superscript characters. You can find this list in the practice workbook as well.
Solution 4 – Use VBA to Generate Superscripts
Using the UNICHAR function requires knowledge of the Unicode of each superscript character. If the superscript contains multiple characters, we have to insert multiple UNICHAR functions. To simplify this process, we can create a custom VBA function that generates superscripts for frequently used superscript characters.
Step 1:
- Apply the first step of Reason 1 Solution 2 to insert a module.
- Insert the following code in the module:
Function ApplySuperscript(base As String, super_script As String) As String
Dim char_array() As String
Dim unicode_array() As String
char_array = Split("0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z", ",")
unicode_array = Split("8304,185,178,179,8308,8309,8310,8311,8312,8313,7491,7495,7580,7496,7497,7584,7501,688,7588,690,7503,737,7504,8319,7506,7510,691,738,7511,7512,7515,695,739,696,7611", ",")
Dim i As Integer
Dim j As Integer
Dim result As String
Dim match As Integer
Dim super_string
result = base
For i = 1 To Len(super_script)
match = -1
super_string = Mid(super_script, i, 1)
For j = LBound(char_array) To UBound(char_array)
If char_array(j) = super_string Then
match = j
Exit For
End If
Next j
If match = -1 Then
result = "Superscript not available"
Exit For
End If
result = result & ChrW(unicode_array(match))
Next i
ApplySuperscript = result
End Function
Step 2:
Return to the worksheet and apply the following formula in cell D6.
=ApplySuperscript(B6,C6)
Here, ApplySuperscript is the custom VBA function. The first argument refers to the base and the second argument refers to the superscript.
- Press Enter and use the Fill Handle tool to get the other values.
What to Do If Superscript Is Not Working in Excel Charts?
Sometimes you may try to load superscripts from source data in chart titles, axis titles, legends, or labels, but get normal characters instead. For example, consider the following dataset where the superscript from the dataset doesn’t appear in the chart.
In the dataset, we had “Density in Kg/m3”, but in the chart title it shows “Density in Kg/m3”.
This usually happens if the superscript in the dataset is inserted by enabling the Superscript effect from the Font tab of the Format Cells dialog box.
We can insert superscripts from the Symbol feature instead to get rid of this issue.
Solution – Insert Superscripts from the Symbol Feature to Bring Superscript from Source Data into a Chart
In the Symbols feature, the superscripts are located under the Latin-1 Supplement, Superscripts and Subscripts, Cyclic Extended-B, Modifier Tone Letters, and other Subsets. Let’s add the superscript 3 (3) value from the Symbol feature.
Steps:
- Select cell C5 => go to the Insert tab => click the Symbols dropdown.
The Symbol option is visible.
- Click the Symbol option to open the Symbols tab of the Symbol dialog box.
- For the superscript 3 (3) character, set the Subset to Latin-1 Supplement => select the 3 symbol => click the Insert button.
We have the 3 symbol in cell C5.
- Click the Close button.
The required superscript from the source data will appear in the Chart as well.
Read More: [Solved:] Excel Subscript Not Working
Download Practice Workbook
Back to Learn Excel > Formatting Text > Subscript and Superscript
<< Go Back to Subscript and Superscript | Text Formatting | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!