Email:      Pass:    Pass?
Close Window   
TE
Subscribe for Email Updates!
Excel tips, help, and more!
E-mail:


Advertisements


Free Excel Forum

Sort Rows

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

How do I reverse sort a series of rows - i dont want to sort by naything in the cell, i simply want them reversed from so the bottom is the top

thx in advance for the tips


Similar Excel Video Tutorials

Helpful Excel Macros

Bubble Sort
- This macro will perform a bubble sort in excel. You use it simply by selecting one column to sort and then running the
Sort Worksheet Tabs - Ascending or Descending Order
- This macro will sort all of the worksheets in the current workbook. It can sort in ascending or descending order. This
Sort Data With Headers in Ascending Order in Excel
- Macro that sorts data that has headers in ascending order in Excel. This macro assumes that you data has headers on it.
Sort Data that Doesn't Have Headers in Ascending Order in Excel
- Sort data that doesn't have headers in ascending order in Excel with this macro. This is a simple sort macro that assum
Sort Data that Doesn't Have Headers in Descending Order in Excel
- Sort data in Excel that doesn't have headers using a macro. This Excel macro assumes that your data set does not have a

Similar Topics







sorry for such a newbie question but I am years rusty working excel. (downsizing)
I searched the board for sometime but for some reason got very few hits on this.
I am trying to sort a table of multiple columns by a column that contains dates. The rows contain values that i am adding together in groups of 5 rows at the bottom of the table for use else where. The sort by date rearranges the order of the rows (data).... i thought the individual cell references i am adding would change with the sort but they dont.

I could create named cells but there are ALOT of cells.

stumped by something simple. THANKS FOR LOOKING!


I'm looking for VBA code that will automatically sort (descending) my spreadsheet (with the exception of rows 1 and 2) on the contents of Column A whenever any value is changed in any cell in Column A. (It doesn't matter to me whether or not the column will sort when A1 or A2 are changed, as long as those rows are not moved in the sort).

Attached is an example. The actual sheet will look very similar with hundreds more entries. The first sheet is pre sort, the next is what I want the sheet to look like after one sort and the third after a second sort. You can see that I'm changing an entry in column A from 1 to 0, and want that entry to go to the bottom of the list. Obviously I want all the formulas to remain the same.

Thanks!


I want to sort multiple rows, at the same time but seem to only be able to do one at a time. I know that to sort multiple columns, I can highlight as many columns as I want and then select A to Z. But this doesn't seem to be the case for sorting rows. In terms of sorting rows, the only thing I can seem to do is to go into Data-->Sort-->Options-->Select Left to Right. I can then sort a single row, and from this window it looks like a may (although haven't figured out how to get it to work) three rows, but I cannot tell how I might be able to sort more than three rows. For instance, suppose I have the following data

3, 2, 1
6, 5, 4
98, 97, 96
33, 32, 21

I want to be able to select all of these rows and quickly sort them as follows:

1, 2, 3
4, 5, 6
96, 97, 98
21, 32, 33

i forget to mention at the same time! Not one by one!
let's say i have 200> rows so i would like to sort them form min to max but all together!
so...
THANKS IN ADVANCE


I am having a serious problem with sorting a spreadsheet that I have never seen before. For some reason, when I try and sort by some of my categories, the excel spreadsheet simply closes. No warning or error is given, it just closes. There are some levels in place and when i sort with all of the collapsed, I dont have the problem. Unfortunately, I need to be able to sort when all rows are visible. Anyone know what this is happening and a way around it?


Hi,
I have a spreadsheet with 10 columns and about 40 projects listed on it in the left column. Each project takes up 3 rows and are alternating colours. I'd like to be able to sort everything in the "Projects" column alphabetically. When I go to sort, sort by column A it condenses all the blank spaces and pushes all the projects together. I also have 3 columns in 3 of the rows for each project that need to be permanent that get pushed together when I sort by column A.
I'd like to be able to add new projects to the bottom of the list and have excel sort (all 3 rows together) automatically.

Is this possible? I can send an example of the worksheet if needed. I'm a bit of a noob when it comes to Excel 2003 FYI.


My data is thousands of rows from a txt file of a report that was many pages long. Each "page" has a header and footer and some rows were subtotals or other text. Column F has the data I want to sort, then I can just delete all the rows of trash that would be in contiguous rows.
But, if I sort right doing a right click, Sort, or by doing a sort from the menu, it only sorts the contiguous rows that have data in F - not the whole file.
How can I sort the whole mess?


Hello,
Below you can find an example of my worksheet:
DC 00 03 20
FE 06 55 20
BD 09 29 40
CT 08 41 70
GT 09 92 80
In this example, you see the sort as I want it (right-to-left and
top-to-bottom). But how can I let Excel do this sort? Now I'm first sorting
all the numbers by hand.



Hi, I have an unusual sorting problem.

I'm using excel to keep track of information about individuals and we only want sort certain rows (not all of them). For instance, rows 2-85 only. My predecessor who created this file was able to accomplish this somehow where you simply go to Data --> Sort and it happens--no need to do a macro or even select the rows that I want sorted. But now that I am adding in more rows for new individuals, I find that I am not able to have Excel sort only certain rows whenever I go to Data --> Sort. It pulls in rows that I don't want sorted.

Can anyone offer advice?

Thanks much!


Hello. We work with a typical excel spreadsheet. Rows 1,2,3 have all of our "header" information, and the rest of the rows are data.

The problem is, we sort the data on a daily basis, and when we do this, our "header" rows (rows 1,2,3) are always moved to the bottom of the spreadsheet. Even if I freeze rows 1,2,3, the rows are STILL put at the bottom of the spreadsheet when I do the sort.

I know that one way to avoid this is to simply highlight only the data that I want sorted and then do the sort... But I want to avoid this if at all possible.

Is there any command on excel that will automatically exclude the header rows from being sorted?

Thanks!


I am re-working an inventory/ordering workbook and have hit a snag.

On one page there is vendor data in the range B13:W312, with about half of the rows blank. Colums B contains vendor numbers from 1-10, with many rows for each vendor.

One way that we want to sort the data is on Column B, but we would like the blank rows sorted to the top of the range and the data to the bottom. This would make it easy for users to enter new data into the top and then sort the new data into place with another sort. However, Excel sorts the blanks in Column B to the bottom, no matter whether I sort ascending or decending. Is there a way to get Excel to sort blanks to the top? Here is my code ...

Range("B13:W312").Select
Selection.Sort Key1:=Range("B13"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thanks,

Vernon


I'd like help with a sorting anomaly. Here's how to reproduce the problem:

Insert the following two values into an Excel spreadsheet (into two adjacent vertical cells):
C2_
C2-

Then sort alphabetically. Here's what I get:
C2-
C2_

(The cells have reversed order. Underscore is indeed after the hyphen in the ASCII sequence.)

Then add the same single character to the end of each string, and re-sort. Here's what I get:
C2_a
C2-a
(The cells reverse order again.)

How is this possible? How does adding the same character to sorted strings change the sort order? If I sort in a text editor (like PSPad), adding the extra character to the end does *not* change the sort order.

Thx for any help you can give.

-Wayne


I need to sort a variable number of rows in a fixed 25-row range in descending order of a computed column ("J") in that range. For blank rows, the computed result in the sort column is "", and I want those rows at the bottom. Also note that the rows I want to sort are already at the top of the range so just dynamically describing the range, might be the best approach ... but I don't know how to do that This code is to run when I press a "Sort" button. Here is what I have so far ...
Range("E2:M27").Select
ActiveWorkbook.Worksheets("Individual Results").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Individual Results").Sort.SortFields.Add Key:=Range( _
"J3:J27"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
This works great except if I only have 20 rows of data, the first five rows are blank. I want those blank rows to remain in rows 23 to 27. Thanks for any ideas.


Hi there,
I have a range A18:O29 which I want to sort but some rows are blank. Because of this, once the sort is done, the blank rows get put to the top. Is there a way I can get he blank rows to the bottom?

This is part of the macro I'm using at the moment:-

Selection.Sort Key1:=Range("L18"), Order1:=xlDescending, Key2:=Range( _
"N18"), Order2:=xlDescending, Key3:=Range("O18"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

Cheers,

YP


Hello all. Thanks in advance for any help you can give me. I have been trying to find a way to sort hundreds of rows and can't figure it out. Here is an example of what I have:

23 56 34 16 25 6
56 45 48 23 12 5
12 45 34 67 47 32
.
.
.
What I want to do is sort each row lowest to highest like so:

6 16 23 25 34 56
5 12 23 45 48 56
12 32 34 45 47 67

The sort by rows thing doesn't work.

Thanks again!

-Mark


I currently have a macro that sorts the rows of the worksheet based on the contents of column A (simple integer sort, lowest to highest, possibly with repeated values). But when I change the value of one or more cells (and re-sort), I need them to be inserted at the bottom of the set of values. So if I change a 1 to a 2, I need that row to be inserted at the bottom of all the 2's (last value before the 3's, and so on). By default, sort() inserts at the earliest opportunity (which is at the top of the new value).

Any ideas?


Hi Guys,

In need of some help/advice.

I'm trying to figure out a way ( excel 2000) how to sort data over a range of columns.

Attached is a sheet.

So what I am looking for is this:

Bottom 10 for target 1, target 2, target 3.

I can sort them indervidually, but is there a way to sort the all?

Or would I need a agent column for each target to sort?

Or maybe there is a way to sort the data so it would work out that if they are in the bottom 10 of lets say 2 of the targets but not all 3 they would still show in the bottom 10?


I have a fear of the sort. I usally will write down one row and check after the sort. I manually high light the top to bottom of data,right, before I sort. It seems that some times I get results, shift in columns, I don't want. I would feel safer if I know how the sort works. It seems if you use the Sort & Filter, with the curser in a column, It don't care where the data ends on the sheet. It seems there is no boundares,data table.

Is there a safe sort. That might seem like a odd request if you feel safe with the sort.
Bob


Have a sheet setup with a VB macro to sort 2,500 rows. Often, I don't need to sort this many rows and would like to know if there's a way to use something like a COUNTA function to count the rows and use that result to limit the number of rows to sort.

Thanks!

Tom


With 2003, if there were blank cells in a sort, it would sort the whole column and move the blanks to the bottom....

With 2007, I have a column with the first two rows blank and the first data is in Row 3... when I click sort.... it highlights all my data starting at Row 3 to sort.... why won't it sort the whole column?


I need some code to attach to a button that will sort data in H3:CA770 in descending order, the catch is I need this to sort on by the column to the most right with data in it.

I use rows 1 & 2 as a header so there will always be data in that, so I need the button to sort my worksheet based on the last column with data in it. The sheet will be updated monthly so I dont want to creat 12 different sort buttons.

Thanks,
Travis


How do I sort many rows horizontally? I searched this forum and found out how to sort single rows, (sort options/sort left to right) but it is tedious to sort 50 rows that way.

Here's the application:


Row 1 - Race dates
Column A - Racers' names
Cells - Finished rank in race

___A_______B______C______D______E
1 --------Race1--Race2--Race3--Race4
2 Johnny......1.........4..........3.........6
3 Miranda.....4.........1..........8.........9

I need to list all finishes from lowest to highest according to racer:

Johnny......1.........3..........4.........6
Miranda.....1.........4..........8.........9

How can I highlight the race results and sort left to right within each row? The results field is B2:J49 if that helps.

Thanks!

JP


I'm using Excel 97 SR-2 and I have a strange sorting error.

I attached a small portion of the 4000+ rows db I'm working with.
It is currently sorted on col A (no problem).

But when you sort it on col AA, some rows with AA content end up sorted above the rows with empty AA (contains a space) and some end up below.

I've tried to reformat the AA col to text and others types and I still can't get it to sort on col AA properly.

The one difference I found is that the AA content of some rows was copied from another .xls file cell and some were keyed into the AA cell directly.
To see what I mean: sort the file on AA then key 22533 into the col AA cell that currently contains 22533, sort again on AA. The subject row will move to the other group.

How do I fix this so the file will sort properly.


I need to sort a group of data, say A2:K12, although number of rows to sort will vary each month. If the cursor is at A2, is there a way to tell Excel to select this variable range of data and sort it?

Also the sort needs to "Sort numbers and numbers stored as text separately"


I see no way to specify a particular area (which columns, by which rows -- which specific cells) to include in a sort?

I have data lying in rows beneath the data which I will sort [many times], but don't want that lower data to get messed up or reordered by the sort.

Is there a way to do this? In Filter & Sort - Custom Sort, there are no rows by columns options that you can set, so I'm wondering if you can specify the cells to sort any other way?

Thanks so much!!


How would you right code to automatically sort (using the same sort parameters all the time) when the value of a column changes?

Here's the scenario:
Columns B through N are populated.
The sort parameters are (in order) column F ascending, column D ascending and then column B ascending. The sort in column F is based on a custom list (but I doubt that matters here).
As far as the number of rows to select, it varies but there is always a blank row at the bottom of the selection.

What I am looking for is code that will sort the selection (currently its B4 through N37) in the above order automatically when the value in any of the selected rows changes in column F. Possible?