Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

How to Sort a Spreadsheet by Alpha and Keep the Row Hierarchy Intact

  Asked By: Jesse    Date: Feb 27    Category: MS Office    Views: 881
  

I am trying to sort a spreadsheet by alpha and keep the hierarchy
intact.



Here is what it looks like when I first pull the data:



Activity Type

Orderable

Orderable Type

General Lab

11 Deoxycortisol

Primary

General Lab

15q Del Prader Willi Angelman FISH

Primary

General Lab

Fish 15 Prader Willi

Direct Care Provider

General Lab

Prader Willi and Angelman Syndrome

Direct Care Provider

General Lab

17 Hydroxypregnenolone

Primary

General Lab

17 Hydroxyprogesterone

Primary

General Lab

17 OH Progesterone

Direct Care Provider

General Lab

17 Ketosteriods Fract Urine

Primary

General Lab

17 Ketosteroids Urine

Primary

General Lab

22q DiGeorge FISH

Primary

General Lab

FISH DiGeorge 22q

Direct Care Provider

General Lab

5 HIAA Urine

Primary

General Lab

5 HIAA Quant Urine

Direct Care Provider

General Lab

Serotonin, Urine

Direct Care Provider

General Lab

5' Nucleotidase

Primary

General Lab

Nucleotidase

Direct Care Provider

General Lab

7-Dehydrocholestrol

Primary

General Lab

Absolute Retics (Automated)

Primary

General Lab

Retics Count Absolute

Direct Care Provider

General Lab

Glucose Fasting

Primary

General Lab

Fasting Glucose

Direct Care Provider

General Lab

Glucose Random

Primary

General Lab

Random Glucose

Direct Care Provider

General Lab

Glucose 2 Hour PP

Primary

General Lab

2 Hour PP Glucose

Direct Care Provider

General Lab

PP 2 Hour Glucose

Direct Care Provider



Data for the same exam is listed in multiple rows. I want to keep the
Direct Care Provider rows attached to their Primary row that is located
above it. Some exams do not have a corresponding Direct Care Provider
which essentially is just a fancy name for a synonym.


So, what I want to do is alpha sort the "Orderable Type" just by the
rows that have "Primary" in them, but I want to keep the "Direct Care
Provider" row in order under its corresponding "Primary" row. The
second column has either "Primary" or "Direct Care Provider" in it.



For example, I want to lock the below rows



Activity Type

Orderable

Orderable Type

General Lab

15q Del Prader Willi Angelman FISH

Primary

General Lab

Fish 15 Prader Willi

Direct Care Provider

General Lab

Prader Willi and Angelman Syndrome

Direct Care Provider


together and only alpha sort the "Del Prader...", "Hydroxypreg...",
"Deoxy...", and "Hydroxypreg...".



Then, it would look like this after sorting:



Activity Type

Orderable

Orderable Type

General Lab

11 Deoxycortisol

Primary

General Lab

15q Del Prader Willi Angelman FISH

Primary

General Lab

Fish 15 Prader Willi

Direct Care Provider

General Lab

Prader Willi and Angelman Syndrome

Direct Care Provider

General Lab

17 Hydroxypregnenolone

Primary

General Lab

17 Hydroxyprogesterone

Primary

General Lab

17 OH Progesterone

Direct Care Provider

General Lab

17 Ketosteriods Fract Urine

Primary

General Lab

17 Ketosteroids Urine

Primary

General Lab

22q DiGeorge FISH

Primary

General Lab

FISH DiGeorge 22q

Direct Care Provider





Please let me know if you need a spreadsheet with more example data.
Thanks for your help!

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Casey Montgomery     Answered On: Feb 27

I think you'e going to have to write (or have help writing) a custom sort.
Excel doesn't do well in defining multiple  rows into a record.
If you can send me a file, I'd be glad to take a look at writing a sort  routine.
Do you have specific sort fields or would you like to select them?
I can make a form that will allow you to define the sort sequence,
or we can hard-code the sequence.

 




Tagged: