Sort across multiple worksheets in a workbook

P

pawnokrat

Hi,

I have a workbook in Excel 2003 that has 10 worksheets each laid out
identically with the same one-line header having 8 columns but varying
number of rows, say R1, R2... ...R8 that is are added to daily.

I expect in time the total number of rows in the 10 worksheets will
exceed 65536, the limit on rows in any worksheet.

Is there a way to sort all the entries in the workbook by, say, Column
E in all the 10 worksheets and either dump the resulting sorted data
in the existing worksheets or in new worksheets in the same/new
workbook?

If need be, I can abandon the labels on worksheets 2 - 10.

TIA for any help

Pawnokrat
 
P

pawnokrat

Pawnpkrat,

In a word, I fear, no. It sounds as if getting all this data into one sheet would be
useful. Take a look at "Data across multipls sheets" athttp://www.smokeylake.com/excel/excel_truths.htm.


Earl,

Thanks for your reply. At least now I can stop searching.

My compliments for an excellent page. Love your VFAQ and the lovely
picture of the lake.

Regards
Pawnokrat
 
B

Bill Sharpe

Earl,

Thanks for your reply. At least now I can stop searching.

My compliments for an excellent page. Love your VFAQ and the lovely
picture of the lake.

Regards
Pawnokrat
Try Excel 2007, which has 1,000,000+ rows. However, proceed at your own
risk.

Bill
 
H

Harlan Grove

(e-mail address removed) wrote...
....
Is there a way to sort all the entries in the workbook by, say, Column
E in all the 10 worksheets and either dump the resulting sorted data
in the existing worksheets or in new worksheets in the same/new
workbook?
....

Yes. It's cumbersome to do manually. If you have a single column as
sort key, you'd need to add one extra column to the tables in each
worksheet. If you have multiple columns as sort keys, you'd need to
add two extra columns to the tables in each worksheet. For now I'll
assume a single column sort key, and that there are no duplicate sort
key values.

First enter the names of these worksheets in a single column range in
a different worksheet (not one of the ones to be sorted - not strictly
necessary, but easier). Name that range WSLST. Then select all these
worksheets.

If the single column sort key were column A, and if row 1 were
headings in each worksheet, then move to row 2 in the first empty
column to the right of the table to be sorted. Hold down [Shift] and
[Ctrl] keys and press the [Down] arrow key. Type the formula

=INT(SUMPRODUCT(COUNTIF(INDIRECT("'"&WSLST&"'!A2:A65536"),
"<"&A2))/65535)

hold down the [Ctrl] key and press [Enter]. This should enter this
formula into every cell from row 2 to row 65536 in this column. The
formula returns the group into which that row's record falls, so the
result worksheet into which it should be placed.

At this point it's easier to create new worksheets with the sorted
tables. With the worksheets still grouped, run the menu command Insert
Worksheet. In Excel 2003 at least this inserts a number of new new
worksheets equal to the number of selected worksheets, and ungroups
worksheets so only one of the new worksheets is selected.

Next, cycle through each of the originally selected worksheets singly
in turn. In each, select the augmented table - the original table plus
the column of formulas - and autofilter (Data > Filter > Autofilter).
Filter on the column of formulas, selecting 0 through 9 (or one less
than the number of worksheets named in WSLST).

In the first worksheet you process, copy the filtered table including
row 1 but not including the column of formulas, and paste into the new
worksheet corresponding to that group beginning in row 1. This will
put the headers into row 1 in the new worksheets.

In the subsequent worksheets you process, don't include row 1 or the
column of formulas when you select the filtered records to copy, and
paste into the corresponding new worksheet just below the previously
pasted records. When you're finished copying records, go through each
of the new workbooks and sort them each (separately) on column A.

This could be wrapped into a macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top