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: [TABLE="class: table table-list table-striped table-auto"]
<thead>[TR]
[TH="colspan: 2"]Encodings[/TH]
[/TR]
</thead><tbody>[TR="class: row1"]
[TD]HTML Entity (decimal)[/TD]
[TD="align: right"]⁽[/TD]
[/TR]
[TR="class: row0"]
[TD]HTML Entity (hex)[/TD]
[TD="align: right"]⁽[/TD]
[/TR]
[TR="class: row1"]
[TD]How to type in Microsoft Windows[/TD]
[TD="align: right"]Alt +207D
[/TD]
[/TR]
[TR="class: row0"]
[TD]UTF-8 (hex)[/TD]
[TD="align: right"]0xE2 0x81 0xBD (e281bd)[/TD]
[/TR]
[TR="class: row1"]
[TD]UTF-8 (binary)[/TD]
[TD="align: right"]11100010:10000001:10111101[/TD]
[/TR]
[TR="class: row0"]
[TD]UTF-16 (hex)[/TD]
[TD="align: right"]0x207D (207d)[/TD]
[/TR]
[TR="class: row1"]
[TD]UTF-16 (decimal)[/TD]
[TD="align: right"]8,317 [/TD]
[/TR]
[TR="class: row0"]
[TD]UTF-32 (hex)[/TD]
[TD="align: right"]0x0000207D (207d)[/TD]
[/TR]
[TR="class: row1"]
[TD]UTF-32 (decimal)[/TD]
[TD="align: right"]8,317[/TD]
[/TR]
[TR="class: row0"]
[TD]C/C++/Java source code[/TD]
[TD="align: right"]"\u207D"[/TD]
[/TR]
[TR="class: row1"]
[TD]Python source code[/TD]
[TD="align: right"]u"\u207D"[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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.
 
Upvote 0
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:


Excel 2007
A
1I'd like there to be "(" and ")" in the superscript
2Superscript left ( and right ) parenthesis
3
Sheet1


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:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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"?
 
Upvote 0
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:
Upvote 0
clout90265,

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

Sample raw data:


Excel 2007
A
1I'd like there to be "(" and ")" in the superscript
2Superscript left ( and right ) parenthesis
3test ( a ) ( bb ) ( cde )
Sheet1


After the macro:


Excel 2007
A
1I'd like there to be "[sup]([/sup]" and "[sup])[/sup]" in the superscript
2Superscript left [sup]([/sup] and right [sup])[/sup] parenthesis
3test [sup]([/sup] a [sup])[/sup] [sup]([/sup] bb [sup])[/sup] [sup]([/sup] cde [sup])[/sup]
4
Sheet1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,103
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top