
Originally Posted by
Stijn
I created a column that uses a COUNTIF array formula to designate unique orders based on order number (therefore I adjusted your original proposed formula to sum this unique order column).
Given above a further sample file which reflects your actual setup might be helpful here - small dataset only (replace confidential values of course).
If as implied you have 10-20k arrays on your source sheet this will have a significant impact on performance.
In the interim...
I'd suggest sorting your sales database by Customer and then Date (old to new).
I would then be inclined to add a formula adjacent to your source data which would in pseudo-terms work along the lines of:
where Col A holds customer and Col B date and C is the "helper" column.
What the above will do is define the first date a client placed an order and assign this same value for all records for the same client.
By sorting your data as outlined the above calculation is very (very) basic and thus very fast (no need for exact match etc).
With the above calculation in place you can then find number of orders placed after a given date where same customer has placed orders on or before that same date courtesy of a standard COUNTIFS formula:
where Blad2!A2 holds date - eg 3rd of January
The COUNTIFS approach will be quicker than SUMPRODUCT as it's non-iterative.
Note: following on from above if you do use SUMPRODUCT / Arrays be sure to keep precedent range sizes to a minimum / optimised at all times.
Bookmarks