Paste results consecutively within column (based off other worksheet)
The idea of this formula is the following: It tries to find values in a
column, which (a) meet a certain criterion and (b) have not been found
yet. The key to the formula is the virtual array which is used in
MATCH:
MATCH(1,(Data!$C$2:$C$200)*(COUNTIF(A$2:A2,Data!A $2:A$20)=0),*0)
We are trying to find the first 1 in an array which will have 1's if
the criterion is met -- in this case (Data!$C$2:$C$200) -- AND if the
value is not found ABOVE. Notice that the first formula is different
from the rest. The first formula finds the first element matching the
criterion and populates the first entry of the output. Subsequent
formulas are also asking if it has also been found already.
COUNTIF *always* expects the first argument to be a range. It is in
array formulas that the second argument can ALSO be a range. When we
are in A5 of the output, the expression will have been:
MATCH(1,(Data!$C$2:$C$200)*(COUNTIF(A$2:A4,Data!A $2:A$20)=0),*0)
------ Notice the A$2:A4. It is a trick with the $$.
At that point, COUNTIF asks if *each* of the cells in Data!A$2:A$20 is
found above. The result will be a 1/0 for each of the input values,
which is multiplied with a similar array of 1/0 for whether the
criterion is met. Thus, MATCH will first find a 1 in the position where
BOTH the criterion is met AND this record has not already been
retrieved.
Does this help?
Kostis Vezerides
|