I have combined the concepts demonstrated by the following 4 articles located at:
into a single workbook. Among the changes I did/did not make are:
- No change to the formula that given occurance number for records in a filtered list.
- I moved the formula list from above the filtered list to another worksheet.
- I fixed some issues with the VBA code for the Filter Criteria UDF. I then located it with the
- the static list on the other worksheet.
- I included the Advanced Filter search with a custom list with this model.
In moving the static calculated list to another worksheet, I had significant problems adjusting the formulas to work in their new location. For the formula:
I had to add the sheets names in the parts of the formula that point to the filtered list on Sheet1. Also, to create the correct positioning of the first formula(s) in the list (place on row 3 instead of row 2), I had to change:
The FilterCriteriaEnh function was amended to fix several faults – an error handler was added to fix the scenario where .Criteria2 did not exist and adding a line of code (Criteria2=.Criteria2) in case it did (see code in the example workbook).
The criteria UDF was relocated to the row above the static list. The following formula in A1 on the Static worksheet is:
Note that the range in the UDF argument points at the filtered list on Sheet1.
The list used for the advanced filter lookup is also located on the Static worksheet. As expected, when I activated the advanced filter the filter criteria UDF did not return a result, since no “filter” was applied to the list.
I hope that I have explained what is available with this new filter model, but if not, please go back and reread the 4 base articles.
You can download the (enhanced) file here.