How to Reverse a String in Excel: 3 Suitable Ways

Method 1 – Using MID and CONCATENATE Functions to Reverse a String in Excel

Steps:

  • Enter the following formula in cell C4:
=MID($B$4,LEN($B$4)-ROW(B4)+4,1)
  • The letter “y” should be returned as it is the last character in the provided string.

Using MID and CONCATENATE Functions to Reverse a String in Excel

  • Dag the fill handle downward, identical to the picture that is situated at the bottom right of cell C4.

  • Enter the TRANSPOSE function in the cell that follows the final cell of column C, or cell C12, drag and select cells C4 through C12 before closing the parentheses around the TRANSPOSE formula.

Enter the TRANSPOSE Function and Press F9 to get the output

  • Press F9 after selecting the entire formula in the formula bar. Then the formula bar will be like this:
={"y","m","e","D","l","e","c","x","E"} 
  • As our purpose is to use the CONCATENATE function, we will use this function after replacing the first curly brace and removing the second curly brace with the second parenthesis. This will turn into “ExcelDemy” to “ymeDlecxE”.

Apply CONCATENATE Function


Method 2 – Reversing a String with MID and TEXTJOIN Functions

Steps:

  • Insert the following formula in cell C4 and drag the fill handle to the last cell.
=TEXTJOIN("",1,MID(B4,{20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1},1))
  • The main purpose of this formula is to reverse strings like reversing the order of numbers in the array. The MID function returns a single character for each number in the array. TEXTJOIN joins those strings in reverse order.

Apply TEXTJOIN and MID functions to reverse string in excel

Note:

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


Method 3 – Applying VBA Code to Reverse a String in Excel

3.1 Apply VBA Code to a Single Cell

  • By selecting the string that we want to reverse, we will press ALT+F11. The VBA window will appear. Copy the following string and paste it into the window. 
Sub Reverse_String()
Dim s As Range
Set s = Application.Selection
s.Offset(0, 1).Value = StrReverse(s)
End Sub
  • Press F5 to run the VBA code. The result shown in the worksheet will be like “ymeDlecxE”.

ALT+F11 and opening VBA window


3.2  Apply VBA Code to Multiple Cells

Steps:

  • Pick the strings that we wish to reverse and tap ALT+F11, the VBA window will appear. 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

Apply VBA Code for Multiple Cells: how to reverse a string in excel

 


Download Practice Workbook

You can download the practice workbook from the following download button.


Related Articles


<< Go Back to Excel Reverse Order | Sort in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Al Ikram Amit
Al Ikram Amit

Al Ikram Amit, holding a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, serves as a key Excel & VBA Content Developer at ExcelDemy. Driven by a profound passion for research and innovation, he actively immerses himself in Excel. In his role, Amit not only skillfully addresses complex challenges but also exhibits enthusiasm and expertise in gracefully navigating tough situations, emphasizing his steadfast commitment to consistently delivering exceptional, high-quality content that adds significant... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo