We store bunches of keys on numbered pegs in large vehicle safes, which are numbered 1 to 500. Peg number 220 is the next one to be used but we also have some gaps where keys have been returned to the customer.
My database lists these peg numbers against customers so rather than assign 220 to the next bunch of keys for a customer, I want to find the lowest available number and use that instead. We could always go and look in the safe and find an empty peg but that's just too much work for some of us
So could I sort the numbers in numerical order 1, 2, 3, 5, etc. and have a calcultion tell me that "4" is free to re-use?