Reversing the order of data separated by commas within a cell?

  • Thread starter Thread starter rome330
  • Start date Start date
R

rome330

I have an index of paragraph numbers that I imported from Word. The numbers
are currently listed in each cell in highest - lowest order. Is there a
formula that will allow me to reverse the order?
 
Can't you just sort them using Data | Sort and specify the sort order?

If they are an awkward format which won't sort very easily, you can
add a simple sequence 1, 2, 3, 4 etc to cells in the adjacent column
and then highlight both sets of cells and do Data | Sort choosing the
second column as sort field and sort in decreasing order. Then you can
delete the helper cells.

Hope this helps.

Pete
 
Try this small UDF:

Function mirror(r As Range) As String
s = Split(r.Value, ",")
mirror = s((UBound(s)))
For i = UBound(s) - 1 To 0 Step -1
mirror = mirror & "," & s(i)
Next
End Function

so that if A1 contains:
17,23,11,7,51
=mirror(A1) will display:
51,7,11,23,17
 
Public Function RevStr(rng As Range)
RevStr = StrReverse(rng.text)
End Function

Currently.....................7,6,5,4,3,2,1

=Revstr(cellref)

Returns.......................1,2,3,4,5,6,7


Gord Dibben MS Excel MVP
 
Hi,

I could give you a fancy formula but:

Suppose your column of data is A1:A1000
In B1 enter 1
In B2 enter 2
Highligh B1:B2 and drag the fill handle down as far as your data.
Sort on Column B in Descending order
 
Back
Top