ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Reverse Text by Word?? (https://www.excelbanter.com/excel-discussion-misc-queries/108276-reverse-text-word.html)

The Moose

Reverse Text by Word??
 
I have several thousand rows with data similar to this:
Hen_On_NestRoosterwareChickenroosterKitchen

Is it possible to reverse them so that they will read like this:
KitchenChickenroosterRoosterwareHen_On_Nest

In other words -- reverse the order -- enter the words from right to
left, instead of left to right (as they are now)??

Thanks.

Barb


Dave O

Reverse Text by Word??
 
How about: use the Text to Columns feature, using the as your
delimiter. This will split the strings into different columns; then
write a formula along the lines of =D1&C1&B1&A1 to reverse the word
order.


Gary''s Student

Reverse Text by Word??
 
Enter this small macro, then select the cells you want to convert and run the
macro.


Sub backwards()
Dim r As Range, st As String
For Each r In Selection
s = Split(r.Value, "")
u = UBound(s)
If u 0 Then
st = s(u)
For i = u - 1 To 0 Step -1
st = st & "" & s(i)
Next
r.Value = st
End If
Next

If you are not familiar with macros, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Gary's Student


"The Moose" wrote:

I have several thousand rows with data similar to this:
Hen_On_NestRoosterwareChickenroosterKitchen

Is it possible to reverse them so that they will read like this:
KitchenChickenroosterRoosterwareHen_On_Nest

In other words -- reverse the order -- enter the words from right to
left, instead of left to right (as they are now)??

Thanks.

Barb



The Moose

Reverse Text by Word??
 
You guys are *AMAZING*!! I can't tell you how much I appreciate the
help that you've both offered to me. Turned out, I was able to use
both methods on this monster project of mine!!

Thanks again.

Barb


Gary''s Student wrote:
Enter this small macro, then select the cells you want to convert and run the
macro.


Sub backwards()
Dim r As Range, st As String
For Each r In Selection
s = Split(r.Value, "")
u = UBound(s)
If u 0 Then
st = s(u)
For i = u - 1 To 0 Step -1
st = st & "" & s(i)
Next
r.Value = st
End If
Next

If you are not familiar with macros, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Gary's Student


"The Moose" wrote:

I have several thousand rows with data similar to this:
Hen_On_NestRoosterwareChickenroosterKitchen

Is it possible to reverse them so that they will read like this:
KitchenChickenroosterRoosterwareHen_On_Nest

In other words -- reverse the order -- enter the words from right to
left, instead of left to right (as they are now)??

Thanks.

Barb





All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com