Reverse Text by Word??

  • Thread starter Thread starter The Moose
  • Start date Start date
T

The Moose

I have several thousand rows with data similar to this:
Hen_On_Nest>Roosterware>Chickenrooster>Kitchen

Is it possible to reverse them so that they will read like this:
Kitchen>Chickenrooster>Roosterware>Hen_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
 
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top