As Pete says, it is difficult to know what you are asking but here's my best guess.
You know that the "
Before Value
" of a row is taken from the "
After Value
" of the preceding row.
Row[N].Before_Value = Row[N-1].After_Value
A "
group" of rows or an "
input set" is terminated when this "
rule" is
not respected.
You can therefore traverse the rows of the table testing for this condition and when it is not true then you have found the end of one
input set (the
LATEST AFTER VALUE
of the current
input set) and the start of the next one (the
INITIAL BEFORE VALUE
of the next
input set).
Doing that would give you the output that you have put into the question and the "
What I have tried" section.
As an aside, there are 5 input sets and not 4 as you state in your question, this is shown in the output that you have provided.
As for what code would do that for you then you need to show what code you have tried (so people can help you improve it / fix it) or as an absolute minimum the language that you are supposed to be using.