If I'm interpretting you correctly, you can't start off with nothing in a sheet and use Index & match or any other function to get all expiring invoices. The VBA method I would use for that would be:
- clear Overdue_Invoices;
- set a filter records <= OverdueDays (named range);
- copy filtred records to Overdue_Invoices;
Either before or after copy of records to Overdue_Invoices use VBA to
- generate relevant formula (whether on Invoice list or Overdue Invoices would depend on needs);
- copy formula to required range.
In other words, filtering would still be involved in the method I would use (does not mean someone else won't have a solution that works better for you).
VBA can be used to change filters (for example when someone activates a sheet filters can be refreshed). Alternatively, Macro buttons can be used to toggle filters on/off.
To change vlookup to Index and Match. Actually, in the example below Index, Match & Match.
The formula
=IF($G2>=OverdueDays,INDEX(
Client_List!$A:$K,MATCH($B2,Client_List!$A:$A,0),MATCH(H$1,Client_List!$1:$1,0)),
"")
Hint before tackling the explanation: Writing separate components of nested formula in separate cells then copy/paste the parts together the work far easier than the result makes it looks
Hopefully, the following explanation of that formula is easily understood.
This formula is designed to drags across and down and responds to changes of column heading (i.e. rows are not hard-coded making it a more dynamic formula).
Breaking that down to help you understand Index & Match:
If $G2>= OverdueDays I am presuming you understand If().
Microsoft's Index function reference is INDEX(array, row_num, [column_num])
Another way to think of that is INDEX(Where, which row, which column)
Client_List!$A:$K, tells Index the lookup range.
MATCH($B2,Client_List!$A:$A,0) tells index the lookup row number
MATCH(H$1,Client_List!$1:$1,0) tells index the lookup column number.
Now for the Match parts:
Microsoft's Match function reference is MATCH(lookup_value, lookup_array, [match_type])
Match(what value, where, type of match required)
MATCH(
$B2,
Client_List!$A:$A,
0)
In this case, we are looking for the value contained in
B2 which contains the client reference (column $B fixed to enable drag copy to other columns).
The client reference is contained in
Client_List! column
$A:$A (column $A fixed to enables drag/copy to other columns)
Match type
0 tells Match we are looking for an exact match.
The same logic applies in MATCH(H$1,Client_List!$1:$1,0) except we are looking to match the heading in H1 to the Headings in Client list to find the relevant column number. NOTE As with client reference, column names need to be an exact match (I always copy/paste column headings when using this method).
Result
Excel 2010
| A | B | C | D | E
| F | G
| H | I | J | K |
---|
Contact Name | Contact Phone | Contact E-Mail | Office E-Mail | | | | | | | | |
| | | | | | | | | | | |
Josh Ganan | (811) 112-1616 | josh-ganan@bedf.com | info@bedf.com | | | | | | | | |
| | | | | | | | | | | |
AJ Gilbert | (532) 326-2181 | aj.gilbert@axcb.com | office@axcb.com | | | | | | | | |
Aaron Duner | (530) 514-3344 | aarond@ldjgj.com | help@ldjgj.com | | | | | | | | |
AJ Gilbert | (532) 326-2181 | aj.gilbert@axcb.com | office@axcb.com | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | | |
<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Invoice #[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Client #[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Invoice Sum[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Buy Date[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Due date[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Paid[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Days Due[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]AB10001[/TD]
[TD="align: center"]Client 1[/TD]
[TD="align: center"]$517[/TD]
[TD="align: center"]2/01/2016[/TD]
[TD="align: center"]16/01/2016[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]AB10002[/TD]
[TD="align: center"]Client 2[/TD]
[TD="align: center"]$921[/TD]
[TD="align: center"]23/01/2016[/TD]
[TD="align: center"]6/02/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]25[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]AB10003[/TD]
[TD="align: center"]Client 3[/TD]
[TD="align: center"]$1211[/TD]
[TD="align: center"]27/01/2016[/TD]
[TD="align: center"]10/02/2016[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]AB10004[/TD]
[TD="align: center"]Client 1[/TD]
[TD="align: center"]$1351[/TD]
[TD="align: center"]29/01/2016[/TD]
[TD="align: center"]12/02/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]AB10005[/TD]
[TD="align: center"]Client 4[/TD]
[TD="align: center"]$1321[/TD]
[TD="align: center"]1/02/2016[/TD]
[TD="align: center"]15/02/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]16[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]AB10006[/TD]
[TD="align: center"]Client 1[/TD]
[TD="align: center"]$955[/TD]
[TD="align: center"]3/02/2016[/TD]
[TD="align: center"]17/02/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]AB10007[/TD]
[TD="align: center"]Client 1[/TD]
[TD="align: center"]$365[/TD]
[TD="align: center"]6/02/2016[/TD]
[TD="align: center"]20/02/2016[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]AB10008[/TD]
[TD="align: center"]Client 5[/TD]
[TD="align: center"]$419[/TD]
[TD="align: center"]9/02/2016[/TD]
[TD="align: center"]23/02/2016[/TD]
[TD="align: center"]Y[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]AB10009[/TD]
[TD="align: center"]Client 6[/TD]
[TD="align: center"]$946[/TD]
[TD="align: center"]12/02/2016[/TD]
[TD="align: center"]26/02/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]AB10010[/TD]
[TD="align: center"]Client 3[/TD]
[TD="align: center"]$1000[/TD]
[TD="align: center"]20/02/2016[/TD]
[TD="align: center"]5/03/2016[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]-3[/TD]
</tbody>
Invoice_List
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]H2[/TH]
[TD="align: left"]=IF(
$G2>=OverdueDays,INDEX(Client_List!$A:$K,MATCH($B2,Client_List!$A:$A,0),MATCH(H$1,Client_List!$1:$1,0)),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Workbook Defined Names[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Name[/TH]
[TH="align: left"]Refers To[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]OverdueDays[/TH]
[TD="align: left"]=Variables!$A$1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Client list is as per previous post
The named range OverdueDays contains the value 10