How to Reverse a string in Microsoft Excel ?

Your 2020 Plan. Learn 20 minutes a day for 20 days. Online courses from €9.99.

There are times when you might want to reverse a string or text in a cell in Excel to achieve some objectives. Well, there are NO direct or built-in function to achieve this but one could create a User Defined Function using VBA and call the same via the formula.

How to Reverse a string in Microsoft Excel ?

1. Press the keyboard shortcut key ALT + F11 to display the Microsoft Visual Basic for Applications dialog.

2. In the “Microsoft Visual Basic for Applications” dialog , Click Insert –> Module and then enter the following code in to the editor.

Function Reverse(str As String) As String
    Reverse = StrReverse(Trim(str))
End Function

3. Save the changes and then close the “Microsoft Visual Basic for Applications” dialog.

4. Navigate back to the worksheet where you want to display the reverse of a string and enter the following formula and specify the cell for which you need to find the reverse of the string.


Leave a Reply

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