The workbook and formula has a lot of dependencies and will take a while to clean up, desensitize, etc. In the meantime, I've posted the formula and some details.
The array formula starts in B4 and is copied down for 3,000 rows. It looks in tblData (about 45K records) and extracts the OrderIDs, listing them from B4 to, potentially, B3000. It only extracts OrderIDs which match the user's criteria.
I'm using structured references to refer to the data table. The basic technique is to check if the value in tblData (e.g., tblData[OrderType]) matches the criteria, which is stored in a named range (e.g., valOrderType).
This is the formula, which I've attempted to annotate:
- cntOrders = the count of order numbers to be returned (the sum of another table that shows the number of orders by region)
Using combo boxes and worksheet change events, the user specifies what order details he wants to see. His criteria are assigned to these named ranges:
- valOrderType = Type of order ("Mail", "Phone", "Internet", etc.)
valCriteria1Yes = Repeat customer (always has "Yes")
valCriteria1No = Repeat customer (blank or "No")
valCriteria2Yes = Happy customer (always has "Yes")
valCriteria2No = Happy customer (blank or "No")
For those Yes and No criteria, the formula evaluates these with a +. If only "Yes" is selected, it returns only OrderIDs with a "Yes"; if "Yes" and "No" are selected, it returns OrderIDs with either "Yes" or "No".
Bookmarks