Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Converting to ASCII Text.

Converting to ASCII Text

by Allen Wyatt
(last updated June 19, 2018)


Brenda has a lot of information that has been imported or pasted into a worksheet. Sometimes the text in the worksheet will contain "foreign" and strange characters. She wonders if there is a way to easily convert the data so that it contains no non-ASCII characters and, perhaps, some foreign characters are converted to regular ASCII values (such as converting accented letters to non-accented letters).

There are a couple of things you can try. First, you can use the CLEAN worksheet function to get rid of non-printable characters. Just use the function in this manner:


The result is "cleaned" text, without the non-printables. If you want to replace foreign characters with regular ASCII characters, that will need to be done with a macro. Here's an example of a relatively straightforward approach:

Sub StripAccent()
    Dim sAcc As String
    Dim sReg As String
    Dim sA As String
    Dim sR As String
    Dim i As Integer

    sAcc = "ŠŽšžŸÀÁÂÃÄ�...ÇÈÉÊËÌÍÎÏÐ�'�'�"�"ÕÖÙÚÛÜÝàáâãäåçè�©êëìí�®ïðñòóôõöùúûüýÿ"
    sReg = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"

    For i = 1 To Len(sAcc)
        sA = Mid(sAcc, i, 1)
        sR = Mid(sReg, i, 1)
        Selection.Replace What:=sA, Replacement:=sR, _
          LookAt:=xlPart, MatchCase:=True
End Sub

The macro steps through the characters in the sAcc variable and, one at a time, uses Find and Replace to replace them with the corresponding character in the sReg variable. You can adjust the contents of sAcc and sReg to reflect your conversion needs; the key is to make sure that they are both the same length.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11493) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Converting to ASCII Text.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Hiding Errors

If you find the green and red squiggly underlines that Word adds to your document distracting, you might want a quick way ...

Discover More

Using a Single Instance of Excel with Two Monitors

Working on a computer system that has multiple monitors can help increase your productivity. If you want to work with ...

Discover More

Automatically Running a Macro

Word allows you to create macros that can run at special times, automatically. This tip explains five special macros that ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Understanding AutoComplete

Entering data in a worksheet can be time consuming. One of the tools that Excel provides to make entry easier is ...

Discover More

Can't Empty the Clipboard

The Clipboard is essential to move or copy information from one place in Excel to another. If you get an error when you ...

Discover More

Using the Fill Handle from the Keyboard

The fill handle can save a huge amount of time when you are editing a worksheet. If you are really good at using the ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 + 5?

2017-08-29 12:17:06

Willy Vanhaelen

@Ru Lopi
If you want to do it with a UDF this smaler function will do it much faster since it has only one loop:

Function StripAccent(sText As String) As String
Dim X As Integer, Y As Integer
Const sAcc = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÓÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
Const sReg = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"
For X = 1 To Len(sText)
Y = InStr(sAcc, Mid(sText, X, 1))
If Y Then Mid(sText, X, 1) = Mid(sReg, Y, 1)
Next X
StripAccent = sText
End Function

2017-08-28 08:40:55

Ru Lopi

The following will replace foreign characters in a cell.

In a module place this code:

Function funcStripAccent(strText As String) As String

Dim sAcc As String
Dim sReg As String

Dim intInner As Integer
Dim intOuter As Integer

sAcc = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÓÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
sReg = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"

For intOuter = 1 To Len(strText)

For intInner = 1 To Len(sAcc)

If Mid(strText, intOuter, 1) = Mid(sAcc, intInner, 1) Then
Mid(strText, intOuter, 1) = Mid(sReg, intInner, 1)
End If

Next intInner

Next intOuter

funcStripAccent = strText

End Function

Assuming that the foreign text is in A1 then in the destination cell enter: =funcStripAccent(A1)
This can be fllled to other cells as required.

As mentioned, sAcc and sReg must be the same length with matching conversion characters.

2017-08-26 14:30:11

Willy Vanhaelen

The macro in this tip is really sloppy work. When you copy and paste it in VBA the "sAcc = ..." row gets entirely blood red meaning there is an error. This is because at 2 places in the string there is a single quotation mark which is not allowed . When you remove them you can run the macro but it replaces all the characters in the selected text with an o (ooooooo...)!!!.

Obviously the sAcc and sReg strings should be exactly the same length which is not the case here. The sAcc string is much longer and contains beside the 2 quotation marks a dozen of useless characters including some question marks. These causes the erroneous result. The last question mark in the sAcc string corresponds to the letter o in the sReg string so when sA contains a ? , Replace considers this as a wild card and replaces all the characters in the selection with an o which is the content of sR at that moment.

Here is my version of the macro (smaler as usual :-) that does the job properly:

Sub StripAccent()
Const sAcc = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçéèêëìíîïðñòóôõöùúûüýÿ"
Const sReg = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeeiiionooooouuuuyy"
Dim X As Integer
For X = 1 To Len(sAcc)
Selection.Replace _
What:=Mid(sAcc, X, 1), _
Replacement:=Mid(sReg, X, 1), _
LookAt:=xlPart, MatchCase:=True
End Sub

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.