I've been through various discussions on recreating something akin to the the Excel CountIfs function, but have been struggling for 2 days.
Basically, I need have a row be able to count any previous rows (it will be previous by default) that match certain criteria
So, for a given row, as long as its type <> "Online", I want to count records/rows where Cust ID = Cust ID, Type DOES = Online in a previous record, and the Purch date of the row to be counted is between the purchase date the row in question and 30 days prior.
In the data below, the later occurrences of CustIDs 199003 and 135833 (I tried to bold type) would each show a count of 1 (assumedly in a new column so i can flag it later), as they each are <>Online, but there is row with a matching CustID, where Type = Online, and was within the previous 30 days.
| Purch Date APP | Purch Date-1 | Purch Date less 30 | Purchase# | Type | CustID |
| 6/30/2021 | 6/29/2021 | 5/30/2021 | 2260787 | Online | 199003 |
| 7/1/2021 | 6/30/2021 | 6/1/2021 | 2153512 | Online | 135833 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2575005 | Shop2 | 146651 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2871696 | Shop1 | 190452 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2834699 | Shop1 | 183225 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2934265 | Shop1 | 151681 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2807218 | Shop2 | 113738 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2967201 | Shop2 | 127026 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2487600 | Shop2 | 199003 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2693672 | Shop2 | 160585 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2058022 | Online | 177808 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2866540 | Online | 111339 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2745257 | Shop1 | 135833 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2602772 | Shop1 | 116841 |
| 7/21/2021 | 7/20/2021 | 6/21/2021 | 2899620 | Shop1 | 155846 |