Format text in formula line

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&"%."
 
H

Harlan Grove

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.
 
R

Rick Rothstein

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.
 
M

mge

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.
 
M

mge

Rick - regarding my previous, I inserted an extra space when I copied your
script. It works now.
 
T

Teethless mama

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&"%."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top