whexcelitious
New Member
- Joined
- Apr 10, 2023
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
I constructed an XLOOKUP to find the right rate of a worker from a set of contracts. The rate needs to be added to a list of timesheet records that hold the name of the worker, the contract he worked for, etc. So when every timesheet-row has the right rate, I can construct a pivot that shows the total hours worked and the total value (hours x rate) of that contract in a month-based overview.
However, I struggle finding the right rate... And my current solution (does not include the contract period yet..) is already quite slow (the total list of timesheet records counts about 8000 entries).
Q1: how can I expand the xlookup with taking the contract period into account
Q2: what would be a faster query to get the same result?
This is the timesheet list: the red rate cells show the wrong rate due to the fact that the wrong contract is found.
any suggestions?
However, I struggle finding the right rate... And my current solution (does not include the contract period yet..) is already quite slow (the total list of timesheet records counts about 8000 entries).
Q1: how can I expand the xlookup with taking the contract period into account
Q2: what would be a faster query to get the same result?
contractRate.xlsx | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | workOrder | workerName | contractStart | contractEnd | Rate | Timecode | ||
2 | w11111 | John Doe | 1-1-2022 | 30-6-2022 | 61 | A | ||
3 | w11111 | John Doe | 1-1-2022 | 30-6-2022 | 66 | P | ||
4 | w11111 | John Doe | 1-1-2022 | 31-12-2022 | 71 | A | ||
5 | w11111 | John Doe | 1-1-2022 | 31-12-2022 | 76 | P | ||
6 | w22222 | John Doe | 1-1-2022 | 30-6-2022 | 62 | A | ||
7 | w22222 | John Doe | 1-1-2022 | 30-6-2022 | 67 | P | ||
8 | w22222 | John Doe | 1-1-2022 | 31-12-2022 | 72 | A | ||
9 | w22222 | John Doe | 1-1-2022 | 31-12-2022 | 77 | P | ||
10 | w22222 | Michael Foe | 1-1-2022 | 30-6-2022 | 82 | A | ||
11 | w22222 | Michael Foe | 1-1-2022 | 30-6-2022 | 87 | P | ||
12 | w22222 | Michael Foe | 1-1-2022 | 31-12-2022 | 92 | A | ||
13 | w22222 | Michael Foe | 1-1-2022 | 31-12-2022 | 97 | P | ||
Contracts |
This is the timesheet list: the red rate cells show the wrong rate due to the fact that the wrong contract is found.
contractRate.xlsx | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | date | Timecode | workerName | workOrder | #hours | rate? | ||
2 | 1-2-2022 | A | John Doe | w11111 | 1 | 61 | ||
3 | 1-2-2022 | P | John Doe | w11111 | 1 | 66 | ||
4 | 1-7-2022 | A | John Doe | w11111 | 1 | 61 | ||
5 | 1-7-2022 | P | John Doe | w11111 | 1 | 66 | ||
6 | 1-2-2022 | A | John Doe | w22222 | 1 | 62 | ||
7 | 1-2-2022 | P | John Doe | w22222 | 1 | 67 | ||
8 | 1-7-2022 | A | John Doe | w22222 | 1 | 62 | ||
9 | 1-7-2022 | P | John Doe | w22222 | 1 | 67 | ||
10 | 1-2-2022 | A | Michael Foe | w22222 | 1 | 82 | ||
11 | 1-2-2022 | P | Michael Foe | w22222 | 1 | 87 | ||
12 | 1-7-2022 | A | Michael Foe | w22222 | 1 | 82 | ||
13 | 1-7-2022 | P | Michael Foe | w22222 | 1 | 87 | ||
Timesheet |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F2:F13 | F2 | =XLOOKUP(1,(Contracts!F:F=Timesheet!B2)*(Contracts!B:B=Timesheet!C2)*(Contracts!A:A=Timesheet!D2),Contracts!E:E) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
Contracts!_FilterDatabase | =Contracts!$A$1:$F$5 | F2:F13 |
any suggestions?