Sorting an Outline/WBS

apez

New Member
Joined
Jun 24, 2007
Messages
9
Does anyone have an Excel VBA function to sort an Outline/WBS?

I have a column in an excel workbook with a Outline/WBS.
If a user uses the default Excel sort I need to sort the Outline/WBS back to the correct Outline structure (example below):


1
1.1
1.2
1.3
1.3.1
1.3.2
2
2.1
2.2
2.2.1
2.2.2
2.3
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You need to force the WBS to text, so it sorts correctly. One option:

Insert a column next to the WBS codes. Assuming WBS starts in A2 and B is blank, place this in B2 and fill down: =TEXT(A2,"@")

Sort on column B to get the WBS

Denis
 
Upvote 0
That will not work.

An Outline/WBS will not sort correctly using any conventional text or numeric sort.

You can test it yourself by pasting the WBS in my original message and trying to sort in Excel.

It requires a sort routine - I am looking for a VBA sort function.
 
Upvote 0
Sorry, but I disagree. Did you try it?

I took your original outline and tested it before posting the reponse. It works. The function coerces everything to text, not a mixture of text and numbers which is the normal result of formatting the column as text.

Denis
 
Upvote 0
I did test it - it does NOT work

Using any Excel convention sort will not work - it requires a special VBA sort routine

This was the result of the sort which is NOT correct:

1
1.1
1.2
1.3
2
2.1
2.2
2.3
1.3.1
1.3.2
2.2.1
2.2.2
 
Upvote 0
Strange, because I got...

1
1.1
1.2
1.3
1.3.1
1.3.2
2
2.1
2.2
2.2.1
2.2.2
2.3

Looks OK to me. did you sort on A or B?

Denis
 
Upvote 0
OK. The layout, incorrectly sorted (Col A) with the Text versions in col B

Excel Workbook
AB
111
21.11.1
31.21.2
41.31.3
522
62.12.1
72.22.2
82.32.3
91.3.11.3.1
101.3.21.3.2
112.2.12.2.1
122.2.22.2.2
Sheet2


This is the result of sorting on column B

Excel Workbook
AB
111
21.11.1
31.21.2
41.31.3
51.3.11.3.1
61.3.21.3.2
722
82.12.1
92.22.2
102.2.12.2.1
112.2.22.2.2
122.32.3
Sheet2


Does that help? BTW, I have tested in EXCEL 2003 and 2007.

Denis
 
Upvote 0
I have an Excel spreadsheet set up exactly as you have described.

I cannot duplicate your results.

I am not an excel novice so I can assure you that I am struggling to duplicate your solution.


Is there anyway to post the actual file on this message board?
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,332
Members
449,155
Latest member
ravioli44

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