Format text in formula line

  • Thread starter Thread starter mge
  • Start date Start date
M

mge

Is there a way to format specific text in a formula line. For example, can I
make the 1 superscript in the following formula line.

="The current tax rate1 is "&F19*100&"%."
 
mge said:
Is there a way to format specific text in a formula line. For example, can I
make the 1 superscript in the following formula line.

="The current tax rate1 is "&F19*100&"%."

No.
 
No, not with a formula, but it is possible to do what you want with VB event
code. Give this a try and see if you can use it or not. Right click on the
tab at the bottom of the worksheet, select View Code from the popup menu
that appears, copy/paste this code into the code window that appeared...

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column = 6 Then 'Monitor changes in Column F
With .Offset(, 1) 'Puts output in Column G (one to right of Column F)
.Value = "The current tax rate1 is " & 100 * Target.Value & "%"
.Characters(21, 1).Font.Superscript = True
End With
End If
End With
End Sub

Now, go back to your worksheet and enter a value in Column F... the output
will be placed in Column G. The above code assumes values are placed in
Column F manually as opposed to having its values derived from formulas.
 
After playing with this a bit I used the following.

="The current tax rate"&CHAR(185)&" is "&F19*100&"%."

Using the CHAR function gave me the superscript 1.

I do like Rick's response and will try it in the future when I need special
formating within a cell.
 
Rick - regarding my previous, I inserted an extra space when I copied your
script. It works now.
 
can I make the 1 superscript in the following formula line.

Oh yes you can

Try this:
="The current tax rate"&CHAR(185)& " is "&F19*100&"%."
 
Back
Top