If you wish to convert subcript/superscript text to corresponding HTML markup, create a VBA function(press ALT+F11 to go to the editor) with this code:
Function SubToHtml(rng As Range)
Dim c, ns As String
For i = 1 To Len(rng.Value) Step 1
c = rng.Characters(i, 1).Text
If rng.Characters(i, 1).Font.Subscript Then
ns = ns & "<sub>" & c & "</sub>"
ElseIf rng.Characters(i, 1).Font.Superscript Then
ns = ns & "<sup>" & c & "</sup>"
ns = ns & c
'to take care of adjacent sub/superscript characters
ns = Replace(ns, "</sub><sub>", "")
ns = Replace(ns, "</sup><sup>", "")
SubToHtml = ns
Assuming A1 contains the string C2O3. Enter this formula into a blank cell:
It should show this in the cell as a result:
Replace the function name if you wish. I couldn't think of a fancier one. :D
AFAIK, there isn't a solution that doesn't involve VBA; since you would have to go through each character in the cell and check its case or font format.
I assumed your texts won't contain any adjacent sub/superscript characters. Just in case they do, I inserted some code that would take care of strings that have adjacent sub/superscript characters, such as CO20.