Unicode and diacritic characters

The primary role of Excel is analysis and visualization of data, which put less emphasis on the use of special text characters. Nonetheless, there will always be some need for special characters, both Unicode characters and diacritics in Excel.

A diacritic in English is a glyph that modifies the sound of the character to which it is attached. Examples are naïve, résumé, and saké. In other fields, glyphs modify a letter to convey a specific meaning. Examples include:

· In Statistics the sample mean is denoted by x-bar (x̄) and the sample proportion by p-hat (p̂). Examples of Unicode characters are the population mean (the lowercase Greek letter mu, μ) and the population standard deviation (the lower case Greek letter sigma, σ).
· In Economics, profit is denoted by the Greek letter pi (π).
· In Mathematics, well, in Mathematics, there are a plethora of symbols including the capital sigma (Σ) for sum and ∫ for an integral.
· Currencies are denoted by symbols such as the US Dollar ($), the Euro (€), the Japanese Yen (¥), the Chinese Yuan (元), and the Indian Rupee (₹).

For a version in a page by itself (i.e., not in a scrollable iframe as below) visit http://www.tushar-mehta.com/publish_train/xl_vba_cases/0123%20Unicode%20and%20diacritics.shtml

Tushar Mehta

6 thoughts on “Unicode and diacritic characters

  1. Tushar –

    The Yuan is in the “Arial Unicode MS” font.

    Another way to get Unicode to Excel spreadsheets is via VBA.

    Function CHARW(code As Variant) As String
    'Use a Leading "U" or "u" to indicate Unicode values
    code = VBA.Replace(code, "+", "", 1, 1, vbTextCompare)
    If UCase(Left$(code, 1)) = "U" Then code = VBA.Replace(code, "U", "&H", 1, 1, vbTextCompare)
    CHARW = ChrW(code)
    End Function

    So CHARW(U+5143) or CHARW(20803) = 元

    … mrt

  2. As Michael said, to get Unicode use ChrW function in the range -32768 through 65535.
    Last year I wrote a post on my blog about Unicode character sets and published a Unicode character generator in the range 0 through 65535 in Excel to generate a 256×256 cells array.
    Search on Google for “characters pedrowave”

  3. Hi Michael: Thanks for the tip and the function.

    Of course, the still open concern is that Excel’s Insert Symbol requires a selection of the font before selecting a symbol or entering a hex code. :(

  4. Hi Tushar Mehta,

    Regarding your remark as to why an ‘x’ in front of the hex string doesn’t work. That’s actually a feature of Word.
    It’s explained in the following link:

    http://office.microsoft.com/en-gb/word-help/type-characters-by-using-unicode-and-code-page-values-HP003084929.aspx

    Everything from the preceding ‘x’ to the insertion point is interpreted as a codepage value.
    Hope that’ll explain it.

    Your concern that Excel’s Insert Symbol requires a font selection: I’m guessing that Excel regards itself a worksheet application not a word processing application, so instead of searching every font for a non empty entry for that code point Excel lets it be up to us to find the right font :-) This might by a little far fetched, though

  5. Hi guys, I need help. I’m analyzing past financial statements as well as projected ones. the problem I have is that I’m putting these data into a dashboard comparing the two, using the IF function. now the result that I want is for the cell to show the amount by witch the differences are, the symbols (thick green arrow on increase, yellow dot when equal and red downwards arrow when less than).


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.