View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Max
 
Posts: n/a
Default Master Worksheet reflecting sub-worksheets

wrote
.. Could I continue this worksheet merge with additional sheets
by adding more INDEX function lines to the overall IF function?
If so, what would be the additional format?
Example: Add sheet "North" and "South".


Here's a revised/extended play
to cater for 4 sheets: North, South, East, West

A sample construct available at:
http://www.savefile.com/files/6920182
AutoMerge_Rows_from_4_sheets_to_summ_sheet_KeyCol_ A_populated_v2.zip

Assume source data in identically structured sheets: North, South, East,
West, cols A to V, data from row2 down (Key col = col A, if populated, i.e.
not empty)

In sheet: All
With the same headers pasted into A1:V2

Put in A3:
=IF(ISERROR(SMALL($W:$W,ROW(A1))),
IF(ISERROR(SMALL($X:$X,ROW(A1)-COUNT($W:$W))),
IF(ISERROR(SMALL($Y:$Y,ROW(A1)-COUNT($X:$X)-COUNT($W:$W))),
IF(ISERROR(SMALL($Z:$Z,ROW(A1)-COUNT($Y:$Y)-COUNT($X:$X)-COUNT($W:$W))),"",
INDEX(OFFSET(INDIRECT("'"&$Z$2&"'!A:A"),,COLUMN(A1 )-1),SMALL($Z:$Z,ROW(A1)-C
OUNT($Y:$Y)-COUNT($X:$X)-COUNT($W:$W)))),
INDEX(OFFSET(INDIRECT("'"&$Y$2&"'!A:A"),,COLUMN(A1 )-1),SMALL($Y:$Y,ROW(A1)-C
OUNT($X:$X)-COUNT($W:$W)))),
INDEX(OFFSET(INDIRECT("'"&$X$2&"'!A:A"),,COLUMN(A1 )-1),SMALL($X:$X,ROW(A1)-C
OUNT($W:$W)))),
INDEX(OFFSET(INDIRECT("'"&$W$2&"'!A:A"),,COLUMN(A1 )-1),MATCH(SMALL($W:$W,ROW
(A1)),$W:$W,0)))
Copy A3 to V3

Enter the sheet names into W2:Z2, say: North, South, East, West
Note:
1. Enter names in the desired "stacking" sequence from W2 to Z2
(Lines will be stacked in the order: W2's, then X2's, then Y2's, then Z2's.
So we have some flexibility here <g.)
2. Names entered must match *exactly* what's on the tabs

Put in W3: =IF(TRIM(INDIRECT("'"& W$2 & "'!A"&ROW(A1)+2))="","",ROW())
Copy W3 to Z3

Select A3:Z3, copy down to cover the aggregated max expected extent of data
in all the 4 sheets (eg: if each sheet is expected to contain a max of 10
rows each, copy down by 10 rows x 4 sheets = 40 rows to Z42)

The above will automatically return the non-empty data lines from the 4
sheets: North, South, East and West (i.e. where col A <""), stacked per
order of the sheetnames in W2:Z2, viz.: North's lines, then South's, then
East's, then West's, all lines neatly bunched at the top. It'll also cater
for row insertions* / deletions made in each sheet's data lines.
*within the assumed max 10 rows per sheet extent above

To maintain tolerable performance, if there's quite a fair bit lines to
bring over from each sheet, set the calc mode to Manual (via: Tools
Options Calculation tab). Then press F9 to update/calc when ready.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---