Is there a way to calculate Custom Week numbers that start from a user's first Transaction Date onwards? The Users (emailId) and TransDate columns may not be in a sorted condition as shown below:
e.g.
+------+-------------+---------------------+
| WkNo | TransDate | emailId |
+------+-------------+---------------------+
| 1 | 2018-Aug-30 | moz.shea@abc.com |
| 1 | 2018-Aug-30 | moz.shea@abc.com |
| 10 | 2018-Nov-07 | moz.shea@abc.com |
| 1 | 2018-Aug-09 | zabi.prado@abc.com |
| 1 | 2018-Aug-09 | zabi.prado@abc.com |
| 6 | 2018-Sep-20 | zabi.prado@abc.com |
| 15 | 2018-Nov-23 | zabi.prado@abc.com |
| 21 | 2018-Dec-31 | zabi.prado@abc.com |
| 1 | 2018-Aug-20 | silo.whitte@abc.com |
| 5 | 2018-Sep-23 | silo.whitte@abc.com |
| 7 | 2018-10-11 | silo.whitte@abc.com |
| 7 | 2018-10-11 | silo.whitte@abc.com |
| 8 | 2018-Oct-14 | silo.whitte@abc.com |
| 9 | 2018-Oct-19 | silo.whitte@abc.com |
| 1 | 2018-Jul-01 | pablo.gucci@abc.com |
| 6 | 2018-Aug-10 | pablo.gucci@abc.com |
| 13 | 2018-Oct-03 | pablo.gucci@abc.com |
+------+-------------+---------------------+
I wrote the following formula using FILTER function that then supplies the filtered dates per user to the DATEDIF function. However, i am not getting the desired result as shown above.
=ARRAYFORMULA(if(B2:B="","",1 + round(DATEDIF(min(sort(FILTER(B2:B,C2:C=C2:C),1,true)),sort(FILTER(B2:B,C2:C=C2:C),1,true),"D")/7)))
EDIT:
Formula Result:
1
7
7
7
8
10
10
13
13
14
16
16
16
17
19
22
27
Also removed SORT from above formula:
=ARRAYFORMULA(if(B2:B="","",1 + round(DATEDIF(min(sort(FILTER(B2:B,C2:C=C2:C),1,true)),FILTER(B2:B,C2:C=C2:C),"D")/7)))
Formula Result:
10
10
19
7
7
13
22
27
8
13
16
16
16
17
1
7
14
Both seem to work, but give unexpected results as MIN is evaluating to a single date 2018-Jul-01
instead of an Array of Minimum dates per user. Where am i going wrong?