Superscript left and right parenthesis -- help is appreciated. Thanks!

clout90265

New Member
Joined
Dec 11, 2014
Messages
14
I know the superscript is =char(185), but I'd like there to be "(" and ")" in the superscript as well...I pulled the below codes from online:
Encodings
HTML Entity (decimal)
HTML Entity (hex)
How to type in Microsoft WindowsAlt +207D
UTF-8 (hex)0xE2 0x81 0xBD (e281bd)
UTF-8 (binary)11100010:10000001:10111101
UTF-16 (hex)0x207D (207d)
UTF-16 (decimal)8,317
UTF-32 (hex)0x0000207D (207d)
UTF-32 (decimal)8,317
C/C++/Java source code"\u207D"
Python source codeu"\u207D"

<thead>
</thead><tbody>
</tbody>
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

clout90265

New Member
Joined
Dec 11, 2014
Messages
14
I just don't know how to convert the above codes into something usable in excel. Am aware of the hex2dec, hex2bi etc.. But do not know how to implement.
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
clout90265,

Welcome to the MrExcel forum.

1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?


Here are some strings that contain the (, and, ) characters:

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">I'd like there to be "(" and ")" in the superscript</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Superscript left ( and right ) parenthesis</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />

I can not display the results because the MrExcel HTML Maker will not show the Superscript ( ) characters correctly.

Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Code:
Sub SuperscriptLeftAndRightParenthesis()
' hiker95, 12/11/2014, ME823748
Dim c As Range
Dim i As Long
Application.ScreenUpdating = False
For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))
  If InStr(c, "(") Or InStr(c, ")") Then
    For i = 1 To Len(c)
      If Mid(c, i, 1) = "(" Then
        c.Characters(i, 1).Font.Superscript = True
      ElseIf Mid(c, i, 1) = ")" Then
        c.Characters(i, 1).Font.Superscript = True
      End If
    Next i
  End If
Next c
Application.ScreenUpdating = True
End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the SuperscriptLeftAndRightParenthesis macro.
 
Last edited:

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
clout90265,

Here is a shorter version of the macro that will do the same thing.

Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Sub SuperscriptLeftAndRightParenthesis_V2()
' hiker95, 12/11/2014, ME823748
Dim c As Range
Dim i As Long
Application.ScreenUpdating = False
For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))
  If InStr(c, "(") Or InStr(c, ")") Then
    For i = 1 To Len(c)
      If Mid(c, i, 1) = "(" Or Mid(c, i, 1) = ")" Then
        c.Characters(i, 1).Font.Superscript = True
      End If
    Next i
  End If
Next c
Application.ScreenUpdating = True
End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the SuperscriptLeftAndRightParenthesis_V2 macro.
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
clout90265,

Here is a shorter version of the macro that will do the same thing.

Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Sub SuperscriptLeftAndRightParenthesis_V2()
' hiker95, 12/12/2014, ME823748
Dim c As Range
Dim i As Long
Application.ScreenUpdating = False
For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))
  If InStr(c, "(") Or InStr(c, ")") Then
    For i = 1 To Len(c)
      If Mid(c, i, 1) = "(" Or Mid(c, i, 1) = ")" Then
        c.Characters(i, 1).Font.Superscript = True
      End If
    Next i
  End If
Next c
Application.ScreenUpdating = True
End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the SuperscriptLeftAndRightParenthesis_V2 macro.
 

clout90265

New Member
Joined
Dec 11, 2014
Messages
14
Thanks. I ran the macro on a blank worksheet (saved down as .xlsm), and nothing happened. To be sure, I'm using =char(185) for my superscripts (since they need to be part of formulas). I'd like there to be small parenthesis around this superscript. Your macro runs through all the superscripts and adds parenthesis, correct? But will it recognize =char(185) as a superscript since it is a so-called "special character"?
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
clout90265,

You are very welcome.

I ran the macro on a blank worksheet (saved down as .xlsm), and nothing happened.
In order for the macro to work your worksheet can not be blank?????

Did you see the screenshot in my reply #3?

I may have mis-understood what you are trying to accomplish.


In order to continue, and, so that we can get it right on the next try:

It would help if we had a screenshot with some raw data, and, what the results should look like.


1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?


Can you post a screenshot of the actual raw data worksheet?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post a small screen shot try one of the following:

Excel Jeanie
Download

MrExcel HTML Maker
https://onedrive.live.com/?cid=8cffdec0ce27e813&sc=documents&id=8CFFDEC0CE27E813!189

Borders-Copy-Paste
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

To test the above:
Test Here


Or, you can upload your workbook to Box Net,

sensitive data changed

mark the workbook for sharing

and provide us with a link to your workbook.
 
Last edited:

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
clout90265,

PeterSS_s has supplied me with a way so the Superscript text will display correctly - thank you PeterSS_s.

Sample raw data:

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">I'd like there to be "(" and ")" in the superscript</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Superscript left ( and right ) parenthesis</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">test ( a ) ( bb )  ( cde )</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />

After the macro:

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">I'd like there to be "(" and ")" in the superscript</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Superscript left ( and right ) parenthesis</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">test ( a )  ( bb  )  ( cde )</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />
 
Last edited:

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,800
Office Version
2010
Platform
Windows
clout90265,

PeterSS_s has supplied me with a way so the Superscript text will display correctly - thank you PeterSS_s.
Where did PeterSS_s do that at (I don't see any posts by him in this thread)?
 

Watch MrExcel Video

Forum statistics

Threads
1,095,188
Messages
5,442,922
Members
405,206
Latest member
Neetish_93

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top