Sorting multi-level data in a table

Xcythe

New Member
Joined
Aug 19, 2018
Messages
3
Hey guys, hoping I can figure out if this is possible to do.

So basically I'm constructing a sort of project manager buy breaking down the steps. The below table is an example of what I am trying to achieve.

[TABLE="class: grid, width: 900"]
<tbody>[TR]
[TD]Priority[/TD]
[TD]Project[/TD]
[TD][/TD]
[TD]Step #1[/TD]
[TD][/TD]
[TD]Step #2[/TD]
[TD][/TD]
[TD]Step #3[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Education[/TD]
[TD]>>[/TD]
[TD]Reading[/TD]
[TD]>>[/TD]
[TD]Think and Grow Rich By Napoleon Hill[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]>>[/TD]
[TD]The Original Species by Charles Darwin[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]House Work[/TD]
[TD]>>[/TD]
[TD]Brace trellising[/TD]
[TD]>>[/TD]
[TD]Buy timber brace[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]>>[/TD]
[TD][/TD]
[TD]>>[/TD]
[TD]Cut and fix brace[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]>>[/TD]
[TD]New curtains[/TD]
[TD]>>[/TD]
[TD]Research curtains[/TD]
[TD]>>[/TD]
[TD]Research online[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]>>[/TD]
[TD]Vist shops that sell curtains[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]>>[/TD]
[TD]Buy new curtains[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Misc.[/TD]
[TD]>>[/TD]
[TD]Etc.[/TD]
[TD]>>[/TD]
[TD]Etc.[/TD]
[TD]>>[/TD]
[TD]Etc.[/TD]
[/TR]
</tbody>[/TABLE]


This provides me with the easiest method to see exactly what steps I need to take to complete a project. It also looks much better with formatting.

Now what I would like to do is be able to sort the data by the priority column but have anything with multiple steps in the correct order.


Is this possible to do?

Thank you in advance for your time.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
If you add values like 1.1, 1.2, etc. in the blank cells in column A it will sort correctly. And if you don't want to see the 1.1, 1.2, etc. you can hide them with conditional formatting.

<table valign="top" border="1"><caption>LEGO HTML</caption><col width="54"><col width="122"><col width="140"><col width="95"><col width="154"><col width="95"><col width="279"><col width="95"><col width="223">
<tr><td></td><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">A</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">B</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">C</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">D</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">E</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">F</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">G</font></th><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">H</font></th></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">1</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"><b>Priority</b></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"><b>Project</b></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"><b>Step #1</b></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"><b>Step #2</b></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"><b>Step #3</b></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">2</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">House Work</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Brace trellising</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Buy timber brace</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">3</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1.1</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Cut and fix brace</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">4</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1.2</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">New curtains</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Research curtains</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Research online</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">5</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1.3</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Vist shops that sell curtains</font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">6</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1.4</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Buy new curtains</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">7</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">1.5</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">8</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">2</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Education</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Reading</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Think and Grow Rich By Napoleon Hill</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">9</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">2.1</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">The Original Species by Charles Darwin</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">10</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">2.2</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)"></font></td></tr>
<tr><th style="background-color:rgb(166, 166, 166)"><font style="color:rgb(0, 0, 0)">11</font></th><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">3</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Misc.</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Etc.</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Etc.</font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">>></font></td><td style="background-color:rgb(250, 250, 250)"><font face="Verdana" style="color:rgb(51, 51, 51)">Etc.</font></td></tr></table>
 
Upvote 0
It works, thanks a lot!

I do have another question; is it possible to have it automatically fill cells in 0.01 increments until it reaches a whole number that I have typed in manually? I know it's easy enough with auto fill, but I would like to make this workbook as dynamic as possible to prevent extra work once it's ready to go.
 
Upvote 0
This will fill the decimal points and sort the table automatically.

Code:
Sub dSort()
Dim LR As Long: LR = Range("B" & Rows.Count).End(xlUp).Row
Dim R As Range: Set R = Range("A2:A" & LR).SpecialCells(xlCellTypeBlanks)
Dim Tbl As Range: Set Tbl = Range("A1:H" & LR)


R.FormulaR1C1 = "=R[-1]C+.01"
Tbl.Value = Tbl.Value
Tbl.Sort key1:=Tbl.Cells(1, 1), order1:=xlAscending, Header:=xlYes


End Sub
 
Upvote 0
That's really cool, I can understand it mostly.

How would I get it to read the actual number under priority then attach 0.1 to it so I could easily reorder them as priorities change? Also, what kind of fail-safe can be used in case I accidentally add the same priority number to more than one project? (to prevent jumbling up).

Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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