Copy selected lines
Your first formula
=MATCH(C3,Invoices!C$7:C$5000,0)
starts at row 7, so returns a 1 if the first instance is in row 7.
In the second formula, you are testing the row of otherwise acceptable
records against A6.
If if the first instance is in row 7, then the row (7) is greater thatn A6
(1).
Adust your second formula so that "A6" takes into account the 6 rows worth
of headers, such as "A6+6" or "A6+ROW(Invoices!$C$7)-1" to follow the
first row of data if you move it later.
=MATCH(1,INDEX((Invoices!C$7:C$5000=Sheet1!$C$3)*( ROW(Invoices!C$7:C$5000)A6+ROW(Invoices!$C$7)-1),0),0)
To add additional criteria, you need to use a formula like the second in
place of the first such as
=MATCH(1,INDEX((Invoices!C$7:C$5000=Sheet1!$C$3)*( Invoices!E$7:E$5000=Sheet1!$D$3)*(Invoices!E$7:E$ 5000<=Sheet1!$E$3),0),0)
Where Invoices column E holds the invoice date and Sheet1!D3 and Sheet1!E3
hold your start and end dates (note I used = and <= which INCLUDE the start
date and end date).
The second formula (and down) is the same as the first except you add back
the condition that the row of the next return is greater than the row of the
previous return.
=MATCH(1,INDEX((Invoices!C$7:C$5000=Sheet1!$C$3)*( Invoices!E$7:E$5000=Sheet1!$D$3)*(Invoices!E$7:E$ 5000<=Sheet1!$E$3)*(ROW(Invoices!C$7:C$5000)A6+RO W(Invoices!$C$7)-1),0),0)
I tested this only against as much data as you showed in your original post.
Let me know if you encounter any additional problems (and make sure your
dates are not stored as text).
"WTG" wrote in message
...
Can I expand on this formula to include more then one match value?
can I match to customer number between date1 and date2.
so out of my invoice list I can call up all the invoices for one
certain customer from feb. 15 to march 21.
Bob This worked great except for the second formula keeps giving me
the same value as the first. Can you see my error.
|