To keep track of the last technician who completed a job in column J (J2:J24) based on the entries in columns H (Technician 1) and I (Technician 2), you can use a combination of IF, AND, and MAX functions along with your existing status check.
Here's a formula you can use in cell J2 and then drag down to J24:
=IF(
AND(F2>=D2, H2<>"", I2=""),
H2,
IF(
AND(F2>=D2, H2="", I2<>""),
I2,
IF(
AND(F2>=D2, H2<>"", I2<>""),
IF(MAX(H2:I2)=H2, H2, I2),
""
)
)
)
Explanation:
- First Condition: Checks if the job is completed (
F2>=D2), Technician 1 is listed (H2<>""), and Technician 2 is not listed (I2=""). If true, it returns Technician 1's name.
- Second Condition: Checks if the job is completed (
F2>=D2), Technician 1 is not listed (H2=""), and Technician 2 is listed (I2<>""). If true, it returns Technician 2's name.
- Third Condition: Checks if the job is completed (
F2>=D2) and both technicians are listed (H2<>"", I2<>""). It then compares the two names using MAX to determine the last entry (assuming the last entry is the one that is alphabetically later, which is a common approach in Google Sheets).
- Default: If the job is not completed or no technicians are listed, it returns an empty string.
Alternative Approach:
If you want to track the last entry based on the timestamp of when the data was entered (rather than alphabetical order), you might need a script or a more complex setup involving timestamps. However, the above formula should work well for most cases where you just need to track the last technician based on the data in the cells.
Note:
- This formula assumes that the last technician to work on the job is the one whose name is alphabetically later if both are listed. If you have a different way to determine the last technician, the formula might need adjustment.
- If you want to ensure that the last technician is the one who actually completed the job (i.e., the one whose entry caused
F2 to meet or exceed D2), you might need a more sophisticated approach, possibly involving scripts or additional columns to track changes.