# function for reversing data in cell?

#### Andrew70

##### New Member
I think this is one of those yes or no questions.

Is there an excel function that will take the data in a cell and reverse it for me?

For example, if cell A1 contains the text 'AB CD EF', is there a function that would enable me to output 'FE DC BA' in cell B1?

I did look at trying to cobble something together with the MID and RIGHT commands but I couldn't make it work.

I'm afraid my knowledge only extends to ordinary formulas so array formula solutions or VB solutions wouldn't be of any use to me.

Thanks,
Andrew.

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Are all of the values of the form "XX XX XX" (with spaces between three sets of two characters)?

If so, B1 =RIGHT(A1)&MID(A1,7,1)&MID(A1,6,1)&MID(A1,5,1)&MID(A1,4,1)&MID(A1,3,1)&MID(A1,2,1)&LEFT(A1)

No, unfortunately the character strings are variable in length and the position and number of spaces is also variable.

UDF formula:

Function Backwards\$(aname\$)
Temp\$ = ""
For i = Len(aname\$) To 1 Step -1
Temp\$ = Temp\$ + Mid\$(aname\$, i, 1)
Next i
Backwards\$ = Temp\$
End Function

Regards
Pekka

PS. In Excel

1. press Alt +F11, VBA window opens
2. click Insert -> Module
3. copy and paste the code into module window
4. press Alt+F11 to go back to worksheet.
5. You are done

Now you can input the formula from your formula list.

Thank you for the reply Pekavee but how should this formula be entered?
I only know how to use formulas of the style that Oaktree suggested.

Have a look in my PS.
If you have some problems, let me know.

Pekka

I am interesting in your code. I copy it to Macro but it never works. What is aname\$?
Thanks.
Dennis

aname is just a name for the formula.

Did you copy and paste the code from here to your VBA module window.

It should work. After inserting the code you should see the formula in your formula list when you are adding a formula into a cell.
It is not a macro, it is user defined formula and that is why you can not see it in the macro list.

Pekka

Sadly I do not know how to use VB so I cannot use that solution.
I have also looked for the morefunc add-in but none of the websites I have visted show either a TEXTREVERSE or REVERSETEXT function included in that add-in. Was it removed? I think that would have been ideal if it worked like an ordinary formula function.

Replies
6
Views
478
Replies
1
Views
893
Replies
0
Views
136
Replies
1
Views
163
Replies
2
Views
420

1,196,391
Messages
6,015,006
Members
441,865
Latest member
Enragedpanda

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back