I should have been more specific. Through code I am accumulating the amount of time 4 lighting contactors are on. These values are stored in floating point register. At a specific period of time I need to do a compare of the 4 accumulated values and turn on the contactor with the fewest amount of on time. At the next period of time turn on the next lowest amount of on time and so on. And when it is time to turn off a contactor, reverse the scenario, the one with the largest amount of on time turns off first. I have attempted to do a bubble sort but for some reason have run into difficulties. I am trying to streamline the logic to make it easier to duplicate over 10 groups of 4 lighting contactors. Hopefully this clarifies the app. Your advice is greatly appreciated.