Power Query Function to Remove Accents in Excel

Last Updated on 17/08/2025
Reading time: 2 minutes

In this article, you’ll find a ready-to-use Power Query custom function that removes diacritics (accents) from your text, so École becomes Ecole, Łódź becomes Lodz, and so on. This is essential for robust matching, deduplication, and URL slugs.

Power Query vs VBA

We previously showed a similar approach in VBA. However, classic VBA techniques often rely on the extended ASCII table and run into limits beyond character code 255. That means characters such as ż, ł, or ń aren’t handled reliably with simple ASCII mappings. Power Query (M) works with Unicode and makes this kind of cleanup much more dependable.

ASCII table limitations compared to Unicode

Because many European characters exceed code 255, Power Query is the recommended option for normalizing text for joins, search, or key generation.

Code overview

The function builds a two-column mapping (accented → unaccented) and applies it across the characters of your text. Conceptually:

  1. A list of target letters to return (A, C, E, L, N, O, S, Z, etc.).
  2. All accented variants that should map to each target letter (á, à, ä → a; Ą → A; ł → l; etc.).
(MyText as text) =>
let
    ListAccents = 
		{
		{"à","a"},
		{"á","a"},
		{"â","a"},
		{"ã","a"},
		{"ä","a"},
		{"å","a"},
		{"è","e"},
		{"é","e"},
..........
		{"ś","s"},
		{"ż","z"},
		{"ź","z"},
		{"Ą","A"},
		{"Ć","C"},
		{"Ę","E"},
		{"Ł","L"},
		{"Ń","N"},
		{"Ś","S"},
		{"Ż","Z"},
		{"Ź","Z"},
		}
in
    Text.Combine(List.ReplaceMatchingItems(Text.ToList(MyText), ListAccents))

How it works:

  • Text.ToList splits MyText into a list of single characters.
  • List.ReplaceMatchingItems replaces each accented character using the mapping list.
  • Text.Combine rebuilds the normalized string.

Download the code

Click the button to download the text version of the custom function.

Setup

  1. Copy the code in the file.
  2. In Excel: Data > Get Data > From Other Sources > Blank Query.
  3. Open the Advanced Editor and paste the code.
  4. Name the query fnRemoveAccents.
Name the function fnRemoveAccents

Use the function

Build your query as usual, then call the function to normalize a text column:

  1. Add Column > Invoke Custom Function.
  2. Select the function query (e.g., fnRemoveAccents).
  3. Choose the source column that contains accented text.
  4. Confirm to create a new normalized column without accents.
Invoke Power Query function to remove accents

Tip: Apply this cleanup early in your queries (right after source and type steps) to make downstream joins, grouping, and matching more reliable.

Leave a Reply

Your email address will not be published. Required fields are marked *

Power Query Function to Remove Accents in Excel

Reading time: 2 minutes
Last Updated on 17/08/2025

In this article, you’ll find a ready-to-use Power Query custom function that removes diacritics (accents) from your text, so École becomes Ecole, Łódź becomes Lodz, and so on. This is essential for robust matching, deduplication, and URL slugs.

Power Query vs VBA

We previously showed a similar approach in VBA. However, classic VBA techniques often rely on the extended ASCII table and run into limits beyond character code 255. That means characters such as ż, ł, or ń aren’t handled reliably with simple ASCII mappings. Power Query (M) works with Unicode and makes this kind of cleanup much more dependable.

ASCII table limitations compared to Unicode

Because many European characters exceed code 255, Power Query is the recommended option for normalizing text for joins, search, or key generation.

Code overview

The function builds a two-column mapping (accented → unaccented) and applies it across the characters of your text. Conceptually:

  1. A list of target letters to return (A, C, E, L, N, O, S, Z, etc.).
  2. All accented variants that should map to each target letter (á, à, ä → a; Ą → A; ł → l; etc.).
(MyText as text) =>
let
    ListAccents = 
		{
		{"à","a"},
		{"á","a"},
		{"â","a"},
		{"ã","a"},
		{"ä","a"},
		{"å","a"},
		{"è","e"},
		{"é","e"},
..........
		{"ś","s"},
		{"ż","z"},
		{"ź","z"},
		{"Ą","A"},
		{"Ć","C"},
		{"Ę","E"},
		{"Ł","L"},
		{"Ń","N"},
		{"Ś","S"},
		{"Ż","Z"},
		{"Ź","Z"},
		}
in
    Text.Combine(List.ReplaceMatchingItems(Text.ToList(MyText), ListAccents))

How it works:

  • Text.ToList splits MyText into a list of single characters.
  • List.ReplaceMatchingItems replaces each accented character using the mapping list.
  • Text.Combine rebuilds the normalized string.

Download the code

Click the button to download the text version of the custom function.

Setup

  1. Copy the code in the file.
  2. In Excel: Data > Get Data > From Other Sources > Blank Query.
  3. Open the Advanced Editor and paste the code.
  4. Name the query fnRemoveAccents.
Name the function fnRemoveAccents

Use the function

Build your query as usual, then call the function to normalize a text column:

  1. Add Column > Invoke Custom Function.
  2. Select the function query (e.g., fnRemoveAccents).
  3. Choose the source column that contains accented text.
  4. Confirm to create a new normalized column without accents.
Invoke Power Query function to remove accents

Tip: Apply this cleanup early in your queries (right after source and type steps) to make downstream joins, grouping, and matching more reliable.

Leave a Reply

Your email address will not be published. Required fields are marked *