Reversing?!?!

kpark91

Well-known Member
Joined
Jul 15, 2010
Messages
1,582
Just out of curiousity and since this seems to be the most active forum so..

What's the fastest way of reversing only words and sentences? :P
(without using excel's pre-established functions if any..)

Ex)
Hello my name is kpark91

Reversing words: olleH ym eman si 19krapk
Reversing sentences: 19krapk si eman ym olleH


For reversing sentences:
I was thinking along the lines of treating the string as an array of characters..
1) Find length of sentence
2) Loop for integer value of length of sentence divided by 2 (swapping first and last characters, 2nd and 2nd last characters, so on...)


For reversing words:
1) Use Split function to split the words
2) Use the same method as reversing sentences except it's for each word.


I was thinking of using these methods but then I found out excel didn't treat the string as an array of characters :(

Any ideas? :D
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi kpark91...

you can try the StrReverse function for reversing words; e.g. s = StrReverse("Hello")

Regards
 
Upvote 0
Cool. I didn't know that kind of function existed.
Thanks.

But what's the code behind it? :P
 
Upvote 0

Forum statistics

Threads
1,213,553
Messages
6,114,279
Members
448,562
Latest member
Flashbond

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top