So I convert a date range to week numbers. This is some sample data:
+-----------+------------+------------+--------------------+
| Name | From | To | ProjectDaysPerWeek |
+-----------+------------+------------+--------------------+
| Bob | 02/04/2021 | 20/04/2021 | 4 |
| Jessie | 05/05/2021 | 05/06/2021 | 5 |
| Lars | 15/06/2021 | 15/07/2021 | 3 |
| Kathy | 12/05/2021 | 22/06/2021 | 5 |
| Bob | 10/04/2021 | 16/04/2021 | 2 |
| Lars | 22/06/2021 | 30/06/2021 | 4 |
| Kim | 10/06/2021 | 30/06/2021 | 5 |
| Bob | 18/06/2021 | 24/06/2021 | 2 |
+-----------+------------+------------+--------------------+
And for the names that come up more than once (such as for Bob's and for Lars') I would want to extract the ProjectDaysPerWeek per
. That's what I am trying with this code:
However, this produces duplicate results as you can see in the results here:
+------+-----------+---------+------------+------------+-------+-------------+
| Name | From Week | To Week | From Date | To Date | Value | Week Number |
+------+-----------+---------+------------+------------+-------+-------------+
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 14 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 15 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 16 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 17 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 14 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 15 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 16 |
| Bob | 14 | 17 | 02/04/2021 | 20/04/2021 | 4 | 17 |
| Lars | 25 | 29 | 15/06/2021 | 15/07/2021 | 3 | 25 |
| Lars | 25 | 29 | 15/06/2021 | 15/07/2021 | 3 | 26 |
| Lars | 25 | 29 | 15/06/2021 | 15/07/2021 | 3 | 27 |
| Lars | 25 | 29 | 15/06/2021 | 15/07/2021 | 3 | 28 |
| Lars | 25 | 29 | 15/06/2021 | 15/07/2021 | 3 | 29 |
| Bob | 15 | 16 | 10/04/2021 | 16/04/2021 | 2 | 15 |
| Bob | 15 | 16 | 10/04/2021 | 16/04/2021 | 2 | 16 |
| Bob | 15 | 16 | 10/04/2021 | 16/04/2021 | 2 | 15 |
| Bob | 15 | 16 | 10/04/2021 | 16/04/2021 | 2 | 16 |
| Lars | 26 | 27 | 22/06/2021 | 30/06/2021 | 4 | 26 |
| Lars | 26 | 27 | 22/06/2021 | 30/06/2021 | 4 | 27 |
| Bob | 25 | 26 | 18/06/2021 | 24/06/2021 | 2 | 25 |
| Bob | 25 | 26 | 18/06/2021 | 24/06/2021 | 2 | 26 |
| Bob | 25 | 26 | 18/06/2021 | 24/06/2021 | 2 | 25 |
| Bob | 25 | 26 | 18/06/2021 | 24/06/2021 | 2 | 26 |
+------+-----------+---------+------------+------------+-------+-------------+
Any help is appreciated.
Bookmarks