I wrote this script and it works however I have 15 repeating fields for each record and this only seems to work off the first field. Is there any way I could make this go through all 15 field and note if the last 3 position numbers were different. This way the field might show administration/engineering services
There's a function called "GetRepetition" that you can use to check each repetition in a loop.
However, as I think has been recommended to you elsewhere, it would be much, much easier for you to split your data into a related table where each record stores the data for one repetition.