View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
mkemp73 mkemp73 is offline
external usenet poster
 
Posts: 3
Default Basic sort question - maintain relationship across columns

On Mar 15, 12:16 pm, Joel wrote:
I assume your data looks like this

A 1

2

3

B 1

2

For excel to do the sorting you need both column A and column B to have data
in all rows. I know its easy to read when column A doesn't have all the
entries. You may want to add a new column that have data in all the rows so
the sort works properly. The other choice is to write a Macro.

1) have a column A with all entries



"mkemp73" wrote:
On Mar 15, 11:38 am, Dave Peterson wrote:
Select all the columns you want included in the sort.
Then Data|Sort and sort by the key that you want.


Personally, I never let excel guess at the range to sort--sometimes it guesses
wrong.


mkemp73 wrote:


Excel 2003


The worksheet has two columns only, all text.
I'd like to sort the entire worksheet by column A, alphabetically.
Many of my column A entries have multiple related entries in col. B;
that is, cell A2 has related items in B2, B3, B4. A2, A3, A4 are
blank.
A5 has related items in B5, B6, B7, B8, B9 (the A's are blank)
How do I sort by col. A and retain the association of all of the
related col. B items? So that, if the sort moves A5 up to A1, it also
moves B5, B6, B7, B8, B9 up to A1, A2, etc.?


Thanks,


Mike


--


Dave Peterson- Hide quoted text -


- Show quoted text -


When I do that, all of the col B items that have a blank col A next to
them get dropped to the bottom of col. B. For example, I'd like B3 to
remain with A2, but after the sort, A2 moves to A14, but B3 drops to
B48.- Hide quoted text -


- Show quoted text -


Thanks. I guess I'll have to fill in the blanks. Wouldn't know how to
create a macro like that.