Hi Lars,
I might have jumped to conclusions too fast here.
I validated the data and it was correct so I didn't concider any furter implications.
To foresee full disclosure I want to mention that I need the last 5 unique WORKPCKG and WORKITEMS combinations.
It is possible that these are empty and then I would have to apply the same logic to the field NONPROJECTCODE, since it will be filled if no WORKPCKG & WORKITEM is used.
I will try your code, thank you.
Adding the logic for the NONPROJECTCODE, how would you approach this ?