When files are imported into Excel, words can occasionally be flipped. In order to produce meaningful terms, we must reverse those strings. In this post, we’ve covered a variety of simple ways on how to reverse a string in Excel. So, continue with us and follow the procedure.
Download Practice Workbook
You can download the practice workbook from the following download button.
3 Ways to Reverse a String in Excel
Despite the lack of any built-in function, there are several methods for doing this. At first, we will do reversing string with functions and then we will continue with VBA code.
1. Using MID and CONCATENATE Functions
Follow these steps to flip the string “ExcelDemy” in cell B4:
- We will enter the following formula in cell C4:
- So, the letter “y” should be returned as it is the last character in the provided string.
- So now, drag the fill handle downward identical to the picture that is situated at the bottom right of cell C4.
- We will enter the TRANSPOSE function in the cell that follows the final cell of column C, or cell C12, then drag and select cells C4 through C12 before closing the parentheses around the TRANSPOSE formula.
- Now we will press F9 after selecting the entire formula in the formula bar. Then the formula bar will be like this:
- As our main purpose is to use CONCATENATE, we will use this function after replacing the first curly brace and removing the second curly brace with the second parenthesis. Now this will turn into “ExcelDemy” to “ymeDlecxE”.
2. Using MID and TEXTJOIN Functions
In the previous method, we merged by CONCATENATE function but in this method, we will use TEXTJOIN. These two functions both do the same task but TEXTJOIN can add a delimiter between strings.
- Insert the following formula in cell C4 and drag the fill handle to the last cell.
- The main purpose of this function is to reverse strings like the reverse order of numbers in the array and the MID function returns a single character for each number in the array. And lastly, TEXTJOIN joins those strings in reverse order.
Only text with 20 characters or fewer than 20 characters can be used in this formula. But for longer strings, you have to use the VBA code given below.
- How to Reverse Text to Columns in Excel (6 Handy Methods)
- How to Reverse X Axis in Excel (4 Quick Tricks)
- Reverse Legend Order of Stacked Bar Chart in Excel (With Quick Steps)
- How to Reverse the Order of Worksheets in Excel (3 Easy Ways)
- How to Reverse Axis Order in Excel (4 Suitable Ways)
3. Apply VBA Code to Reverse a String in Excel
Now we can easily flip a string by VBA code. In this method, we have to write the code or copy it from here.
3.1 Apply VBA Code for Single Cell
- By selecting the string that we want to reverse, we will press ALT+F11. Then the VBA window will appear. Now we will copy the following string and paste it in the window.
Sub Reverse_String() Dim s As Range Set s = Application.Selection s.Offset(0, 1).Value = StrReverse(s) End Sub
- Now we will press F5 to run the VBA code. Consequently, the result shown in the worksheet will be like “ymeDlecxE”.
3.2 Apply VBA Code for Multiple Cells
Already, using VBA code, we have flipped a string with ease. This method’s code is for several strings that must be composed or copied from here.
- Picking the strings that we wish to reverse and tapping ALT+F11, the VBA window will appear. Following that, we’ll copy the following VBA code and paste it into the window. To run the code press F5.
Sub reverse_string_range() Dim s As Range Dim cell As Range Set s = Application.Selection i = 0 For Each cell In s cell.Offset(0, 1).Value = StrReverse(cell) i = i + 1 Next cell End Sub
To Reverse a String in Excel, follow these procedures and stages. You may download the workbook and use it for your own practice as well. In the comments area, if you have any questions, issues, or recommendations, just let me know. Visit our blog ExcelDemy for more similar Excel-related issues.
- How to Reverse Data in Excel Chart (4 Useful Methods)
- Paste in Reverse Order in Excel (7 Handy Ways)
- How to Reverse X and Y Axis in Excel (4 Quick Methods)
- Reverse Order of Columns Horizontally in Excel
- How to Reverse Column Order in Excel (4 Easy Methods)
- How to Reverse Names in Excel (5 Handy Methods)