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

Written by Allen Wyatt (last updated December 8, 2021)
This tip applies to Excel 2007, 2010, 2013, and 2016


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. ...


Strikethrough Shortcut Key

One common type of formatting is strikethrough, which is normally applied from the Font dialog box. There is no built-in ...

Discover More

AutoFilling with the Alphabet

If you need to fill a number of cells with a specific sequence of characters (such as the alphabet), there are several ...

Discover More

Showing Visited Hyperlinks

Many people like to use Excel to keep track of lists of hyperlinks. Want to keep a permanent record of which hyperlinks ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Deleting Everything Except Formulas

Need to get rid of everything in a worksheet except the formulas? It's easier to make this huge change than you think it is.

Discover More

Trimming Off All Spaces

The easy way to get rid of spaces at the beginning or end of a cell's contents is to use the TRIM function. ...

Discover More

Can't Copy Data between Workbooks

Edit a group of workbooks at the same time and you probably will find yourself trying to copy information from one of ...

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 3 + 4?

2021-12-10 11:54:10


I checked the comments to gather helpful info and noticed some opening comments stating:

"The macro in this tip is really sloppy work" "Obviously..." "a dozen of useless characters" "my version of the macro (smaler as usual :-) that does the job properly"

While the opinions may be true, does the opening sentence often set a "tone" and "expectation" for the reader?

Because for me, I think of conflict, attacks and argumentative posturing however all I really want is well presented information.

Please make your points more inclusive to allow many audiences to share and learn from them... even for timid, uneducated readers like myself?

Respectfully, BJT

2021-12-08 10:21:25

Willy Vanhaelen

I'm perplexed! The text of this tip starts with (last updated June 19, 2018) but Allen or his co-worker didn't take any notice of my comment of 26 Aug 2017 reporting a severe bug in the macro, it still fails to work.

Today i got a "Daily Nugget" referring to this tip with still the cripple macro... That's bad publicity !

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.