Re: Sorting

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



David,

Thanks for your reply, but that doesn't seem to work for me. I end up
with this

| Grandfather's sibling | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandfather | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandfather's sibling | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Son #1 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandson 1-1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| Grandson 1-2 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0 |
| Son #2 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandson 2-1 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 0 |
| Great-Grandson 2-1-1 | 2 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
| Great-Grandson 2-2-2 | 2 | 2 | 2 | 2 | 0 | 0 | 0 | 0 |

and I want this

| Grandfather's sibling | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandfather | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandfather's sibling | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Son #1 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| Son #2 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
| Grandson 1-1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| Grandson 1-2 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0 |
| Grandson 2-1 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 0 |
| Great-Grandson 2-1-1 | 2 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
| Great-Grandson 2-2-2 | 2 | 2 | 2 | 2 | 0 | 0 | 0 | 0 |

Here's a real sample of my data. I can get this with no problem:

| JACK JONES | 6 | 7 | 3 | 12 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
| TYLER JONES | 6 | 7 | 3 | 12 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0
|
| WILLIAM JONES | 6 | 7 | 3 | 12 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0
|
| PETER JONES | 6 | 7 | 3 | 12 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0
|
| JOHN JONES | 6 | 7 | 3 | 12 | 1 | 1 | 2 | 0 | 0 | 0 | 0 | 0
|
| WILL JONES | 6 | 7 | 3 | 12 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0
|
| JOHANN JONES | 6 | 7 | 3 | 12 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
| WILLIAM JONES | 6 | 7 | 3 | 12 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0
|
| JOHAN JONES | 6 | 7 | 3 | 12 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0
|
| WILHELM JONES | 6 | 7 | 3 | 12 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0
|
| ELIZABETH JONES | 6 | 7 | 3 | 12 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0
|
| HELEN JONES | 6 | 7 | 3 | 12 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|

The difficulty is achieving this (without building an extra index)

| JACK JONES | 6 | 7 | 3 | 12 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
| JOHANN JONES | 6 | 7 | 3 | 12 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
| HELEN JONES | 6 | 7 | 3 | 12 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
| TYLER JONES | 6 | 7 | 3 | 12 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0
|
| WILL JONES | 6 | 7 | 3 | 12 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0
|
| WILLIAM JONES | 6 | 7 | 3 | 12 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0
|
| JOHN JONES | 6 | 7 | 3 | 12 | 1 | 1 | 2 | 0 | 0 | 0 | 0 | 0
|
| PETER JONES | 6 | 7 | 3 | 12 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0
|
| WILLIAM JONES | 6 | 7 | 3 | 12 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0
|
| ELIZABETH JONES | 6 | 7 | 3 | 12 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0
|
| JOHAN JONES | 6 | 7 | 3 | 12 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0
|
| WILHELM JONES | 6 | 7 | 3 | 12 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0
|

The zero's are place holders, they get replaced with > 0 digits as the
newer generations come along.

Thanks,

DaveU

.