How to find and replace numbers with subscript in Excel?
Find and replace all numbers with subscript by VBA
Find and replace numbers with subscript in chemical formulas by Kutools for Excel
Subscript numbers in Chemical Formulas (subscript all numbers after each element in chemical formulas.)
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
In Excel, except to macro code, there is no method can help you find and replace text with subscript format.
1. Press Alt + F11 key to display Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste below code to the blank script.
VBA: Find and replace all numbers with subscript format
Sub SubscriptNumbers() 'UpdatebyExtendoffice20160705 Dim xRg As Range Dim xTxt As String Dim xCell As Range Dim xChar As String Dim I As Long On Error Resume Next If ActiveWindow.RangeSelection.Count > 1 Then xTxt = ActiveWindow.RangeSelection.AddressLocal Else xTxt = ActiveSheet.UsedRange.AddressLocal End If Set xRg = Application.InputBox("Select a range:", "Kutools for Excel", xTxt, , , , , 8) If xRg Is Nothing Then Exit Sub Application.ScreenUpdating = False For Each xCell In xRg xTxt = xCell.Value For I = 1 To Len(xTxt) xChar = Mid(xTxt, I, 1) If xChar >= "0" And xChar <= "9" Then xCell.Characters(I, 1).Font.Subscript = True End If Next Next Application.ScreenUpdating = True End Sub
3. Press F5 key, a Kutools for Excel dialog pops out to remind you select a working range. See screenshot:
4. After selecting, click OK, and the all numbers in the selection have been converted to be subscript.
In additional to macro code, actually, you can apply an easy utility called Subscript numbers in Chemical Formulas to quickly convert all normal numbers in chemical formulas to subscript format if you have installed Kutools for Excel.
|Kutools for Excel, with more than 120 handy Excel functions, enhance your working efficiency and save your working time.|
After free installing Kutools for Excel, please do as below:
Select the cells you want to format the numbers as subscript, click Kutools > Text > Subscript numbers in Chemical Formulas. See screenshot:
And a dialog pops out to remind you how many cells have been converted, and the numbers in selected chemical formulas have been formatted as subscript format.