If using 2008 as implied you have no VBA support so you will have to do this with formulae.
It's not clear which columns contain the values but if we assume you insert a column such that Col A is blank then:
modify ranges as nec. - the above assumes each precedent cell contains either a number / numeric string
(text values etc would generate #VALUE! errors)
post back with a small sample file if nec.
edit: scrap all of the above (apart from VBA of course) given:

Originally Posted by
iMellroy
The lenght of the sequences varies and there are also empty gaps in the sequence sometimes
my bad - I didn't read thoroughly
Bookmarks