So, Mark, the original problem that you posted does not exactly reflect
your actual setup. What you posted is more like an effort for a digest,
where you envisioned putting all your criteria together in a 9th sheet.
Your problem is basically the following: you want to start with a
source list and then produce a destination list, which is a subset of
the first, according to arbitrary criteria, and you want the subset to
be contiguous. In this case the source list has a fixed number of
columns (as shown in your original post as Sheet2) and you want to
produce various destination lists in (necessarily?) adjacent columns.
So, I will give you a *sample* solution, formula based, which can be
adapted to suit your needs. This is based on your approach of the
original post, namely that you somehow parametrize your criteria
instead of trying to write a macro which will pull of the filtered data
only.
The following example assumes a list of numbers from 0 to 1000 in cells
A1:A20. We want to produce the subset of this list that contains
numbers less than 500. I will use two auxiliary columns: Column D
will compute the row numbers of where admissible numbers are and column
E:E will produce the actual data number. In both cases the destination
lists start from row 1.
Formulas in column D
are to be array-entered (Shift+Ctrl+Enter).
In D1:
=MIN(ROW(A1:A20)*(IF(A1:A20<500, 1, 10000)))
In D2:
=MIN(ROW($A$1:$A$20)*(IF($A$1:$A$20<500, 1,
10000))*IF(ROW($A$1:$A$20)>D1,1,10000))
Copy D2 down until a very large row number appears.
In E1:
=IF(D1<$D$1*10000, OFFSET($A$1,D1-1,0), "")
Copy down as necessary.
The condition is in the IF(A1:A20<500, 1, 10000) in D1 and
IF($A$1:$A$20<500, 1, 10000) in D2. You can modify the condition to
suit your needs.
Drawbacks:
- You must have enough copies of formulas down, which might make the
spreadsheet heavy in recalculation
- You need two columns per destination column. But these you can hide.
The OFFSET formula is enclosed in an IF() so as to not display 0's. The
criterion for this IF is explained as follows: $D$1 will have the first
row where data is found. This row number times 10000 is the large
number that will appear in column D
after you run out of data.
Write back if you need more.
HTH
Kostis Vezerides