I have specific need for text manipulating formula. Is it possible to reverse text in a cell, for example: microsoft excel to lecxe tfosorcim.
Thanks in advance...
I have specific need for text manipulating formula. Is it possible to reverse text in a cell, for example: microsoft excel to lecxe tfosorcim.
Thanks in advance...
Last edited by sakinen; 06-21-2009 at 02:48 PM.
Hi Sakinen. Welcome to the Forum. Here's a new Function you can add to your worksheet to give yourself this simple functionality:
(Install that in a standard module) (source)![]()
Please Login or Register to view this content.
Then just use it like so...to reverse the text in A1, put this in B1:
=REVERSE(A1)
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
sakinen,
If cell A1 contains:
microsoft excel
The formula/function in cell B1:
=ReverseCell(A1,TRUE)
returns:
lecxe tfosorcim
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
Adding the Macro
1. Copy the below macro, by highlighting the macro code and pressing the keys CTRL+C
2. Open your workbook
3. Press the keys ALT+F11 to open the Visual Basic Editor
4. Press the keys ALT+I to activate the Insert menu
5. Press M to insert a Standard Module
6. Paste the code by pressing the keys CTRL+V
7. Press the keys ALT+Q to exit the Editor, and return to Excel.
![]()
Please Login or Register to view this content.
Have a great day,
Stan
Windows 10, Excel 2007, on a PC.
If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
Hello sakinen,
Since Excel 2000, there has been a built in function to do this StrReverse.
Example
![]()
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Oh my, Leith! Great stuff. That makes a custom function ONE LINE long...hehe. Seems to work equally well for text and numerics..
=REVERSE(A1)![]()
Please Login or Register to view this content.
This does convert numeric values INTO strings, but if you know you're dealing with numbers, that's easy to fix, too:
=REVERSE(A1)+0
Last edited by JBeaucaire; 06-20-2009 at 06:08 PM.
I guess it's simple enough to build the "is it a number" test into the function:
![]()
Please Login or Register to view this content.
With this function, Reverse("100") = Reverse("10")
![]()
Please Login or Register to view this content.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Hmm, that does open a whole can of worms. Anything I do to lead a numeric with zeros effectively converts the string BACK into text when I feed it back to the formula. SO...
Leaving the function in it's simpler form (post #5) doesn't suffer from this problem UNLESS the user decides on their own to add back in +0. So, that's probably the simplest. The user is in control of the output appearance
What do you think?
I think that Reverse is a string function that accepts a string as its argument. If Reverse(Number) doesn't return an error, Reverse(Number)=Number seems logical.
![]()
Please Login or Register to view this content.
Last edited by mikerickson; 06-21-2009 at 12:28 AM.
Thanks a lot guys... I didn't expect this number of solutions. I will put them all to trial. Thanks again.
Just out of curiosity, is it possible to do the same thing on a selection...
For example, ...?
Entia non sunt multiplicanda sine necessitate
For example i select the cells i want to reverse the letter order then press some kind of macro button, and the selected cells become reversed.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks