A somewhat simpler approach is a formula that you can put in E2 and then copy down:
This assumes that the numbers in column A increase by 1 each time they change. This is true in your example but I don't know if it's always true.![]()
=MAX(INDEX(D:D,MATCH(A2,A:A,0)):INDEX(D:D,MATCH(A2+1,A:A,0)))
This would also require a dummy number to be added in column A after the last row that is equal to the last number in column A plus 1.
It will work for any number of values in each set.
Bookmarks