Sorting with headers

  • Thread starter Thread starter Heatherk
  • Start date Start date
H

Heatherk

Sometimes - 50% - when I use the toolbar "A-Z" or "Z-A"
sort function, Excel sorts my headings in with the data.
Most annoying, how can I stop this??

~Heather
 
Excel tries to figure out what your intended sort range is and whether or
not you have a header row. Then it sorts your data accordingly.
Excel is not always right in this and that is what you are seeing. Use
of the A-Z and Z-A buttons should be taken as having a rather narrow scope.
If you find that your data consistently fits within this narrow scope, then
use those buttons. Obviously your data is not that way.
What you should do is not use those buttons. Instead, always select the
entire range you want sorted. Then do Data - Sort and select Header Row if
your selection includes the header row. Then select Ascending or Descending
and click on OK. That will always do it right. HTH Otto
 
Thanks much! (I've been using that workaround for a while -
works, but cumbersome as heck.)

Is there, by any chance, a way to TELL Excel you have a
header row (like Header Row Repeat in Word)? Or at least
find out what criteria Excel is using to find header rows
so you can tailor your data? These tables are pretty
garden-variety: Text headings with mixed text/number data.
 
Use a different format for the row of headings, and Excel should exclude
them from the sort. For example, make the text bold, or a different colour.
 
Thought I would tag along with this thread since my
question also deals with using Header Rows while Sorting.

In my case, I created a macro that references a named
range, and sorts that range. It works about 50% of the
time, when Excel "guesses" that I have a Header row, and
doesn't sort the first row when Excel guesses wrong that I
don't have a Header Row. The sort statement in my macro
is:
Selection.Sort Key1:=Range("D3"), Order1:=xlAscending,
Key2:=Range("E3") _
, Order2:=xlAscending, Key3:=Range("K3"),
Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

Does anyone know what I should change so that the sort
Always uses a Header row?

Thanks,
Bryan
 
Back
Top