How to order (sort) the extent List below from descending to ascending to put in a non sequence cells?

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
228
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

How to order (sort) the extent List below from descending to ascending to add it in a non sequence cells?

Extent List:

294 Lx - Amadora (MÁgua - Sul)
295 Lx - Amadora (MÁgua - Norte)
296 Lx - Amadora (Venteira)
297 Lx - Amadora (Alfragide, ÁLivres)
298 Lx - Amadora (Falagueira, VNova)


Non sequence cells:

C1
C3
C5
C7
C9
....

Thank you very much.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I doubt you can use excel's features for this. and if that's true, then you have to use code. do you know anything about arrays? you can put them into an array, and then sort them accordingly. this is some code that I have on my github page that serves a purpose like that:
VBA Code:
'Sort a 1 Dimensional Array
Function SortArray(ArrayToSort() As Variant) As Variant
     
    Dim First           As Integer
    Dim Last            As Integer
    Dim i               As Integer
    Dim j               As Integer
    Dim Temp            As String
     
    First = LBound(ArrayToSort)
    Last = UBound(ArrayToSort)
    For i = First To Last - 1
        For j = i + 1 To Last
            If ArrayToSort(i) > ArrayToSort(j) Then
                Temp = ArrayToSort(j)
                ArrayToSort(j) = ArrayToSort(i)
                ArrayToSort(i) = Temp
            End If
        Next j
    Next i
    
        For i = 1 To UBound(ArrayToSort)
            Debug.Print ArrayToSort(i)
        Next i

End Function
 
Upvote 0
How to order (sort) the extent List below from descending to ascending to add it in a non sequence cells?
A little more clarification might help.

  1. Exactly what do you mean by "from descending to ascending"? I ask because that list already is in ascending order. Could you show us what you would want in each of C1, C3, C5, C7 and C9 for that sample data & give any further clarification about the sorting ascending/descending?

  2. Is your original data always in ascending order to start with?

  3. Where is the original data located? That is, what cell is the first value in the list in?

  4. If there is a choice, would you be looking for a solution that is ..
    • Manual?
    • Formulas?
    • VBA code?
    • Power query?
 
Upvote 0
Dear my friends.

First, thanks for your first appreciation.

Im sorry if my question wasnt very clear.

Please let me clarify:

1.Have this extent list of data more or less than 31 rows:

1579565016326.png



2.Want to put in ascending order like this:

1579565181527.png



Is there a way more faster than to copy it one by one?

Again, thank you ver much.
 
Upvote 0
with Power Query aka Get&Transform
addblankrow.png

Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Suffix = Table.TransformColumns(Table.Sort(Source,{{"Raw", Order.Ascending}}), {{"Raw", each _ & "#", type text}}),
    Result = Table.RemoveLastN(Table.ExpandListColumn(Table.TransformColumns(Suffix, {{"Raw", Splitter.SplitTextByDelimiter("#", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Raw"),1)
in
    Result
 
Upvote 0
Peter_SSs said:
Is your original data always in ascending order to start with?
.. what is the answer to that question?
Okay, let's cover both cases.
If the data is not already sorted ascending, or you are unsure, then you can use the formula in column C.
If the data will always be already sorted ascending then you can use the slightly simpler formula in column D.

Cell Formulas
RangeFormula
C1:C12C1=IFERROR(IF(MOD(ROWS(C$1:C1),2),INDEX(SORT(A$1:A$5,1,1),INT((ROWS(C$1:C1)+1)/2)),""),"")
D1:D12D1=IFERROR(IF(MOD(ROWS(D$1:D1),2),INDEX(A$1:A$5,INT((ROWS(D$1:D1)+1)/2)),""),"")
 
Upvote 0
Okay, let's cover both cases.
If the data is not already sorted ascending, or you are unsure, then you can use the formula in column C.
If the data will always be already sorted ascending then you can use the slightly simpler formula in column D.

Cell Formulas
RangeFormula
C1:C12C1=IFERROR(IF(MOD(ROWS(C$1:C1),2),INDEX(SORT(A$1:A$5,1,1),INT((ROWS(C$1:C1)+1)/2)),""),"")
D1:D12D1=IFERROR(IF(MOD(ROWS(D$1:D1),2),INDEX(A$1:A$5,INT((ROWS(D$1:D1)+1)/2)),""),"")


Works wonderful, however can you make the formula with 10 blank rows between instead of one blank row, like that:


1579645031650.png



Again, thank you very much.
 
Upvote 0
Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Suffix = Table.TransformColumns(Table.Sort(Source,{{"Raw", Order.Ascending}}), {{"Raw", each _ & "##########", type text}}),
    Result = Table.RemoveLastN(Table.ExpandListColumn(Table.TransformColumns(Suffix, {{"Raw", Splitter.SplitTextByAnyDelimiter({"#"}, QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Raw"),10)
in
    Result
10blanks.png
 
Upvote 0
can you make the formula with 10 blank rows between instead of one blank row,
Sure ..

Book1
ABC
1294 Lx - Amadora (MÁgua - Sul)294 Lx - Amadora (MÁgua - Sul)
2295 Lx - Amadora (MÁgua - Norte) 
3296 Lx - Amadora (Venteira) 
4297 Lx - Amadora (Alfragide, ÁLivres) 
5298 Lx - Amadora (Falagueira, VNova) 
6 
7 
8 
9 
10 
11 
12295 Lx - Amadora (MÁgua - Norte)
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23296 Lx - Amadora (Venteira)
24 
Sort & Space
Cell Formulas
RangeFormula
C1:C24C1=IFERROR(IF(MOD(ROWS(C$1:C1),11)=1,INDEX(SORT(A$1:A$5,1,1),INT((ROWS(C$1:C1)+10)/11)),""),"")
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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