On IBM compatible PC's, many characters that can't be typed on a keyboard can be entered by holding down the ALT key and then using the numeric keypad to type the ASCII or Unicode code for that character.
For example, holding down ALT and then typing 184 on the numeric keypad, prints ©, the copyright symbol.
Some History of ALT Codes
IBM PC's
On IBM PC's you could hold down the ALT key then type a number on the numeric keypad. The software running on the PC would interpret this as a key being pressed on the keyboard and would attempt to display the character corresponding to the numeric code you typed.
The numeric codes and characters (or glyphs) were stored in a table called a Code Page. For early IBM PC's they used what was called Code Page 437 (CP437).
CP437 was the default for some countries, including the USA. To support accented characters Code Page 850 was created and this is the default in Western Europe, and some English speaking countries like the UK, Ireland, Canada and Australia.
Other languages and locales use different code pages.
CP437 and CP850 both contained 256 characters, with the first 128 being the same. Beyond that the characters differ.
Windows
When Windows came along the use of these ALT codes was so widespread that Microsoft decided to continue support for them in their software.
Windows began using a different code page, CP1252 which varied a little from CP437 and CP850, but still only had 256 characters.
Unicode
In 1991 the Unicode Consortium was created to standardize the encoding, representation and handling of characters and symbols in all major operating systems and software.
Unicode allows for the encoding of over 1,000,000 characters/symbols, including letters and characters from many languages, mathematical symbols, geometric shapes, currency symbols and many others.
Using ALT Codes in Excel
To use an ALT code in Excel just hold down the ALT key then on the numeric keypad type the numeric code for the character you want.
For example, to display the registered trade mark symbol hold ALT and type 169.
Now, things can get a little confusing here so hang on.
Remember I said that Windows still supports the old CP437 and CP850 code pages from original IBM PC's? Excel also has support for the newer CP1252 code page used by Windows.
The first 128 characters in CP437, CP850 and CP1252 are the same. Once you get to characters beyond that you can encounter some differences.
If you want to use a character in the Windows CP1252 you precede your numeric code with a 0.
So typing ALT 0169 in Excel will actually give you a copyright symbol © rather than the ® you get if you type ALT 169.
By preceding the code with a 0, you tell Excel to load the character from the Windows CP1252 code page, not the old CP437/850 (whichever one your PC supports).
Download the Workbook With Examples and Codes
I've prepared a workbook with the numeric codes and corresponding characters for CP850 and CP1252, codes 1 to 255.
The workbook also has sheets with codes for some currency symbols, superscript and subscripts characters and the Greek alphabet. Useful if you are doing some maths ☺.
That smiley face was ALT1 by the way.
Enter your email address below to download the sample workbook.
CHAR() Function
The CHAR() function does the same thing as typing an ALT code, and uses the characters from Windows CP1252, but you don't need to use a preceding 0 like you do if you type the code.
CHAR() only works with numbers from 32 to 255.
CharMap (Character Map)
Another alternative to typing the ALT code is to use the CharMap program in Windows. This allows you to find the numeric codes for characters and symbols.
In the image I've clicked on the symbol for micro, µ.>
On the bottom left of the image you can see U+00B5 which is the Unicode code for µ. On the bottom right of the image you can see the ALT code which is ALT+0181. Note the leading 0.
If you click on a character in CharMap you can click on the Select button (or double click with your mouse) and then on the Copy button, to copy the character into your clipboard. Use CTRL+V to paste it into Excel.
You can Select (or double click) a series of characters and then copy/paste the entire string too.
Using Unicode Characters
As Unicode supports so many characters, and much of the Unicode documentation shows character codes in hexadecimal, rather than using decimal we must enter the Unicode character codes in hex.
The process described here works for Excel.
For other Office programs e.g. Word, Outlook, etc, you first type the Unicode code then press ALT X
For more info read this Microsoft article Entering Unicode in Office Programs
To do this in Windows we need to edit the registry.
WARNING : At this point I have to give you the usual warning about editing the registry and messing it up. The registry controls how your Windows PC operates and if you get it badly wrong, you can even prevent Windows from starting.
However as I'm sure you are pretty switched on, and the change that is needed is very minor, the risk of turning your PC into a large paperweight is low. That said, don't mess it up. You have been warned.
Editing the Registry
You need to run the Registry Editor, which in Windows 10 is Regedit. In other versions of Windows you may also have RegEdt32.
Once the Registry Editor is running, navigate your way to the folder called Input Method under HKEY_CURRENT_USER\Control Panel and with Input Method highlighted, right click on it and then choose New -> StringValue.
This creates a new entry on the right hand side of the Registry Editor window with the default name New Value #1. Just type over this and rename it EnableHexNumpad.
If you accidentally clicked off the new entry, or mistyped the name, just right click on it and choose Rename to rename it.
Next you have to give the entry a value. Double click on it and it will open up a small window where you can enter a value into the Value data box.
Enter 1 and then click on OK.
Things should look like this now. Bear in mind the other entries in your Input Method folder may be different to mine. All we are working with here is the EnableHexNumpad entry.
If everything looks good, close the Registry Editor and reboot your PC. I'll still be here when you get back.
If you've rebooted your PC you can now use Unicode codes to enter characters. Remember that you need to enter these in hex. You can use the letters and numbers above the letters, or a combination of letters and numbers off the numeric keypad.
There is one other little thing to remember when using Unicode codes, you must precede the number with a +, so to display the symbol for a 3 dimensional angle, ⟀ , type ALT+27C0. Don't forget you actually have to type the + on the numeric keypad.
Unicode Website and Charts
The Unicode website lists all the characters it supports and you can download the various character/symbol charts in PDF format.
Subrata
Hi, This is Subrata from India.
While using ALT Codes in Excel, What Font should be selected.
Mynda Treacy
They work with most fonts.
John Mann
Interesting article. I’ve been using ALT+num pad codes for a long time, and often use CharMap as a quick look up for the code to use. I then make a note on a sticky note attached to a convenient spot on the compurter. I find that I tend to be using the same character frequently for a short period of time (a few days or a week or two) then don’t need it again.
The history was interesting, not very often encounterd, and I’ve never seen any explanation of code pages other than they exist and in the DOS days it might have been specified in Autoexe.bat
When ediiting the registry, I have a safegard procedure. First I make a backup copy of either the section I’m editing, or the whole thing. Have care, though. Regedit will try to save the copy as a *.REG file, which if accidentaly double clicked will be executed imediately, restoring the settings being changed – rather anoying if you didn’t intend to do it. I always make my backup a *.TXT file, which Regedit can import, but won’t trigger Regedit if accidentally executed – it loads Notepad instead so you can read the thing!.
Philip Treacy
Thanks John. I regularly had to use ALT+0163 for the Pound Sterling symbol. It’s still burned into my brain.
I know what you mean about reg files. Would be good if double clicking them didn’t do that.
ALWAYS make a backup before editing.
Cheers
Phil
DEBASHIS CHAKRABORTY
Very useful .Techniques are useful for doing the work more faster.
Philip Treacy
Thanks
Nitish Sharma
very helpful for me,
Please share more videos and excel dashboard.
nice…
and thanks,
Mynda Treacy
Glad you liked it, Nitish 🙂
mo
i just love it thank you soooooooooo much
Philip Treacy
You’re welcome 🙂
Alex B
Great article.
I have known about the Excel functions Char() & Code() and the vba functions Chr() & Asc() for a while but have only recently found out about the vba Unicode functions ChrW() & AscW().
I don’t if there is an Excel function to handle the Unicode.
Philip Treacy
Thanks Alex.
You could write your own function to handle Unicode like so
then call it in the worksheet :
=charw(923)
which will print Λ (Upper case Lambda).
This simple function requires you to convert the Unicode hex values to decimal (039B to 923), but you could rewrite it to accept hex values.
Cheers
Phil
Alex B
Thanks Phil,
I am not really likely to need a UDF for this but having said that I am not really a fan of using them either.
Making a UDF volatile seems like a bad idea but without that I have never been comfortable that they recalculate at the right times.
For example if you hand a UDF the first and last cell to sum a range, I don’t think it recalculates if you change a value between those cells.
If you have a post covering recalculation of UDFs maybe post a link here for me.
PS: I am a bit if a UDF luddite and in trying to set up an example to test this I couldn’t even get the worksheet function “sum” to work when passing in a first and last cell.
Philip Treacy
Hi Alex,
Depending on what the UDF is doing it may or may not recalculate when you want it to. I haven’t written a post on this topic but sounds like a good one to cover.
Excel will monitor the arguments passed into your function to see if they have changed, and then recalculate as required. If, for example, you trying to sum a range but only pass in the first and last cells, but some other cell in the range changes, the function won’t recalculate. You’re best off passing in the entire range so Excel will monitor the entire range for changes:
and call it like this if wanting the sum of cells A1:D10 :
Cheers
Phil
Joan
Thank you for the great explanation of history and use of Alt Code and Unicodes. ☺
Philip Treacy
You’re welcome
Vergenia
Thanks Mynda
Mynda Treacy
Actually, Phil wrote this post, but we’re glad you liked it 🙂