Forum Discussion
Complex Cell Format, Maybe!!!
alternatively you could just enter the 2 values in adjacent cells
if you need a 'report' you can then show it using = A1 & "/" & B1
Thanks for the good alternative, but it has a little challenge. You see the visual acuity (6/12...), they tend sometimes to have superscripts, and when I follow the method above, it returns the superscript to an ordinary number.
E.g.: 6/12-2, the -2 is supposed to be in superscript format.
How can I remedy that, or is it impossible???
Thanks for your assistance.
- JKPieterseOct 07, 2025Silver Contributor
If you are fine with a bit of VBA you can make this happen.
Right-click the worksheet's tab and choose "View Code". Paste this code in the window that opens:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count = 1 Then TurnIntoSuperScript Target End If End Sub
Next, from the menu, choose Insert, Module. Paste in this code:
Sub TurnIntoSuperScript(cl As Range) Dim val As Variant Dim pos As Long val = cl.Value pos = InStr(val, "-") If pos > 0 Then With cl.Characters(Start:=1, Length:=pos - 1).Font .Superscript = False End With With cl.Characters(Start:=pos, Length:=Len(val) - pos + 1).Font .Superscript = True End With Else cl.Font.Subscript = False End If End Sub
Now try entering a fraction into a cell on the worksheet.
- m_tarlerJun 30, 2025Bronze Contributor
there is no way to do that natively in excel (that I can think of) but you could implore a website to return an image...
so this website offers a free API that can be used to return an image based on LATEX formatting codes. So in the above I have a cell for each of the components and then in the equation I added the corresponding formatting needed. The image is then embedded in the cell and will scale based on the size of the cell or you can set the size. Here is the formula I used but more complex formatting is possible:
=IMAGE("https://latex.codecogs.com/png.image?&space;"&B1&"/"&B2&"_{"&B3&"}")