How do you sort numbers in the same field in excel 2010 the same for access 2010

• Question

• Hi,

Is there a way to sort data horizontally in the same field in excel and for access, or is there an addin that can do this

or  function code

field data    6-4-25-23-11-45

sort order 4-6-11-23-25-45

Regards,

Rudolf

rudolfelizabeth

Friday, March 27, 2015 4:26 PM

All replies

• Re:  sorting horizontally
The Excel built-in sort utility can sort horizontally across a row; but only one row at a time.
In the sort dialog box, you must click the "Options..." button and checkmark "Sort left to right"

'---
Re:  "is there an addin that can do this"
If you need to sort multiple rows across then my commercial add-in "Special Sort" can do that in one go.

'---

Jim Cone
Portland, Oregon USA
https://goo.gl/IUQUN2 (Dropbox)
(free & commercial excel add-ins & workbooks)

• Edited by Tuesday, November 1, 2016 3:18 AM update link
Friday, March 27, 2015 5:46 PM
• If your question is how to sort left to right, click the Options button in the Sort dialog and select that option.

Jim

Friday, March 27, 2015 5:47 PM
• sort data horizontally in the same field in excel

Does "in the same field" means that the string "6-4-25-23-11-45" is located in one cell?

In that case you have to use an UDF. Paste this code into a regular module:

`Function SortNumbersPrim(ByVal What As String, Optional ByVal Delimiter) As Variant  Dim Arr, Temp  Dim i As Long, j As Long  Arr = Split(What, Delimiter)  For i = LBound(Arr) + 1 To UBound(Arr)    Temp = Val(Arr(i))    For j = i - 1 To LBound(Arr) Step -1      If Val(Arr(j)) <= Temp Then Exit For      Arr(j + 1) = Arr(j)    Next    Arr(j + 1) = Temp  Next  SortNumbersPrim = Join(Arr, Delimiter)End Function`

Then use a formula like this:
=SortNumbersPrim(A1,"-")

Andreas.

Saturday, March 28, 2015 12:37 PM
• Hi,

Tried build in custom sort doesn't work and special sort is no longer available.

Regards

rudolfelizabeth

Wednesday, April 1, 2015 2:56 PM
• Re:  "custom sort doesn't work"

I don't know what "doesn't work" means.
If the numbers you are trying to sort are all in one cell then the code posted by Andreas Killer should be used.
'---
Jim Cone

• Edited by Wednesday, April 1, 2015 9:13 PM
Wednesday, April 1, 2015 9:11 PM
• Hi

this code doesn't work in execl 2010.

Regards

rudolfelizabeth

Wednesday, April 1, 2015 10:42 PM
• Hi,

When I used custom you have to input al the variations,

then you go back klick sort nothing happens

Regards

rudolfelizabeth

Wednesday, April 1, 2015 10:47 PM
• Hi,

This function code gives an error message in excel 2010.

Regards

rudolfelizabeth

Wednesday, April 1, 2015 11:10 PM