Text.Reverse reverses the characters in a text value, so "Power Query" becomes "yreuQ rewop". You need Power Query available in Excel, Power BI, or another Microsoft tool that supports it, and a text column or value to work with. The function is not case-sensitive and treats each character individually, including spaces and punctuation.
What You'll Need
- Excel (2016 or later, or Microsoft 365) with Power Query, Power BI Desktop, or another Microsoft tool that includes Power Query.
- A text value or a column containing text. If you are using a column, you will add a custom column or transform the existing one.
- Basic familiarity with opening the Power Query Editor and adding a step.
Step-by-Step
- Open your data in Power Query. In Excel, select your table and go to Data > From Table/Range. In Power BI, use Home > Transform data to open the Power Query Editor. Menu labels can differ slightly by version, device, or region.
- Decide where you want the reversed text. To create a new column, go to Add Column > Custom Column. To replace the existing values, right-click the column header and choose Transform > Text.Reverse (or use the Transform tab and find the Text.Reverse option). If you prefer a formula, you can type it manually.
- If you are using a custom column, in the Custom Column dialog, give the new column a name (for example, "Reversed Text"). In the formula box, type
Text.Reverse([YourColumnName]), replacing[YourColumnName]with the actual name of your text column. Column names are case-sensitive and must match exactly, including spaces. - Click OK. Power Query adds the step and shows the reversed text in the new column or in the transformed column.
- Check a few rows to confirm the result. For example, if the original is "Hello", the reversed value should be "olleH". If you see errors, see Troubleshooting below.
- When you are satisfied, load the query back to your worksheet or data model: Home > Close & Load (in Excel) or Home > Close & Apply (in Power BI).
Common Mistakes
- Using the wrong column name. In a custom column formula, the column name must be exact. If your column is named "Customer Name" with a space, you must write
[Customer Name], not[CustomerName]. - Forgetting that Text.Reverse works on text only. If the column contains numbers, Power Query may treat them as numbers and return an error. Convert the column to text first (right-click the column header > Change Type > Text) or use
Text.From([Column])inside the formula. - Expecting it to reverse words, not characters. Text.Reverse reverses the entire string character by character. "Hello World" becomes "dlroW olleH", not "World Hello".
- Applying it to the wrong step. If you add a custom column after other steps, make sure the column you reference still exists at that point in the query. Steps are applied in order.
- Ignoring null values. Text.Reverse returns null if the input is null. That is usually fine, but if you need a blank string, wrap it with
Text.Reverse([Column] ?? "")or handle nulls separately.
Tips
- You can use Text.Reverse inside other functions. For example, to reverse only the domain part of an email, split the text first, reverse the relevant part, then combine.
- To reverse words while keeping their order, split the text by space into a list, reverse the list, then combine with spaces. That requires a custom formula using
Text.SplitandList.Reverse, not just Text.Reverse. - Use the Advanced Editor to see the exact M code Power Query generates. That helps you learn and modify the step later.
- If you need to reverse text frequently, consider creating a custom function that wraps Text.Reverse and handles nulls or type conversions.
- Remember that Text.Reverse is not available in all Power Query versions. It was added in later versions; if you cannot find it, update your software or use a custom function with
Text.ToListandList.Reverse.
Troubleshooting
If you get an error saying the column was not found, check the exact column name in the formula and ensure the step is placed after the column is created. If the function is not recognized, your version of Power Query may not include Text.Reverse; try updating Excel or Power BI Desktop, or use a custom function: Text.Combine(List.Reverse(Text.ToList([Column]))). If the output looks wrong, verify that the input is text and not a number or date. For numbers, convert to text first. If you see nulls, check whether the original values are null; Text.Reverse preserves nulls. If the query is slow on large datasets, consider whether you can reverse only a subset of rows or use a more efficient approach. If the step fails after you change the source data, review the Applied Steps and make sure the column still exists with the same name. If you accidentally transform the wrong column, delete the step in the Applied Steps list and redo it. Always test on a copy of your data before applying changes to the original query.
Frequently Asked Questions
What does Text.Reverse do in Power Query?
It takes a text value and returns a new text value with the characters in reverse order. For example, "abc" becomes "cba".
Can I reverse only part of a text string?
Yes. Use Text.Reverse on a substring. For example, to reverse the last three characters, use Text.Reverse(Text.End([Column], 3)) and combine with the rest as needed.
Does Text.Reverse work on numbers?
No, it expects text. Convert numbers to text first with Text.From or by changing the column type to Text.
Is Text.Reverse available in all versions of Excel?
It is available in modern versions of Excel and Power BI Desktop that include Power Query. If you cannot find it, your version may be older; update your software or use a custom function.
How do I reverse words instead of characters?
Split the text into a list of words with Text.Split, reverse the list with List.Reverse, then combine with Text.Combine using a space delimiter.
What happens if the input is null?
Text.Reverse returns null. You can handle nulls by providing a default value, for example Text.Reverse([Column] ?? "").