Наборы данных приведены ниже:
Сводная таблица окладов (A)
Таблица исходных окладов (B)
I have done the logic in SQL server but I am not having any luck converting it into Excel.
The logic to be converted from SQL into Excel is
A.SALARY is the SUM of rows in Table B when
- A.EMPLID = B.EMPLID
- A.EMPL_RCD = B.EMPL_RCD
- B.SLICE_BEGIN between A.START_DATE AND A.END_DATE OR B.SLICE_END between A.START_DATE AND A.END_DATE
I have done my own attempt of SUMIFS but it doesn't cater for the "OR" condition outlined in (3) above.
Просто интересно, каково здесь решение и может ли кто-нибудь указать мне правильное направление.
Данные:
+---------+----------+-------------+------------+----------+
| EMPLID | EMPL_RCD | SLICE_BEGIN | SLICE_END | SALARY |
+---------+----------+-------------+------------+----------+
| 1000280 | 0 | 28/12/2017 | 10/01/2018 | 2,634.03 |
| 1000280 | 0 | 11/01/2018 | 24/01/2018 | 2,634.02 |
| 1000280 | 0 | 25/01/2018 | 07/02/2018 | 2,634.05 |
| 1000280 | 0 | 08/02/2018 | 21/02/2018 | 2,634.02 |
| 1000280 | 0 | 22/02/2018 | 07/03/2018 | 2,634.03 |
| 1000280 | 0 | 08/03/2018 | 21/03/2018 | 2,634.02 |
| 1000280 | 0 | 22/03/2018 | 04/04/2018 | 2,634.02 |
| 1000280 | 0 | 05/04/2018 | 18/04/2018 | 2,634.02 |
| 1000280 | 0 | 19/04/2018 | 02/05/2018 | 2,634.02 |
| 1000280 | 0 | 03/05/2018 | 16/05/2018 | 2,634.03 |
| 1000280 | 0 | 17/05/2018 | 30/05/2018 | 2,634.02 |
| 1000280 | 0 | 31/05/2018 | 13/06/2018 | 2,634.02 |
| 1000280 | 0 | 14/06/2018 | 27/06/2018 | 2,634.02 |
| 1000280 | 0 | 02/07/2018 | 11/07/2018 | 2,590.56 |
| 1000280 | 0 | 12/07/2018 | 25/07/2018 | 2,631.30 |
| 1000280 | 0 | 26/07/2018 | 08/08/2018 | 2,631.30 |
| 1000280 | 0 | 09/08/2018 | 22/08/2018 | 2,631.30 |
| 1000280 | 0 | 23/08/2018 | 05/09/2018 | 2,631.30 |
| 1000280 | 0 | 06/09/2018 | 19/09/2018 | 2,631.30 |
| 1000280 | 0 | 20/09/2018 | 03/10/2018 | 2,631.30 |
| 1000280 | 0 | 04/10/2018 | 17/10/2018 | 2,631.30 |
| 1000280 | 0 | 18/10/2018 | 31/10/2018 | 2,631.30 |
| 1000280 | 0 | 01/11/2018 | 14/11/2018 | 2,631.30 |
| 1000280 | 0 | 15/11/2018 | 28/11/2018 | 2,631.30 |
| 1000280 | 0 | 01/12/2018 | 12/12/2018 | 2,675.62 |
| 1000280 | 0 | 13/12/2018 | 26/12/2018 | 2,686.70 |
+---------+----------+-------------+------------+----------+