Hi All,
I might be not the prettiest problem solving formula, but this works for me just fine. Thought if someone would be interested in a similar problem, could use my source code. Here it goes:
If you have nicer solutions, feel free to post it. 
Sub refer()
Dim lRow, end, puffer, pufferdown, lowerlvl, nextlvl, currlvl, x, n, i As Integer
Dim need As String
Application.ScreenUpdating = False
lRow = Range("A" & Rows.Count).End(xlUp).Row
x = activecell.Row
Cells(x, 25).Select
activecell.FormulaR1C1 = "needed"
puffer = ActiveSheet.Cells(activecell.Row, 1)
pufferdown = ActiveSheet.Cells(activecell.Row, 1)
end = 0
For n = x To 2 Step -1
currlvl = Cells(n, 1)
lowerlvl = Cells(n - 1, 1)
kell = Cells(n, 25)
If lowerlvl < currlvl Then
If lowerlvl >= puffer Then
Cells(n - 1, 25).Select
activecell.FormulaR1C1 = "not needed"
End If
If lowerlvl < puffer Then
Cells(n - 1, 25).Select
activecell.FormulaR1C1 = "needed"
puffer = lowerlvl
End If
End If
If lowerlvl >= currlvl Then
Cells(n - 1, 25).Select
activecell.FormulaR1C1 = "not needed"
End If
Next
For n = x To Cells(Rows.Count, "A").End(xlUp).Row
currlvl = Cells(n, 1)
nextlvl = Cells(n + 1, 1)
need = Cells(n, 25)
If nextlvl <= pufferdown Then
Cells(n + 1, 25).Select
activecell.FormulaR1C1 = "not needed"
vege = 1
End If
If nextlvl > pufferdown Then
Cells(n + 1, 25).Select
activecell.FormulaR1C1 = "needed"
End If
If vege = 1 Then
Cells(n + 1, 25).Select
activecell.FormulaR1C1 = "not needed"
End If
Next
Cells(1, 25).Select
activecell.FormulaR1C1 = "Refer"
Range("Y1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$Y$" & lRow).AutoFilter Field:=25, Criteria1:="=needed"
Range("A1").Select
End Sub
Regards,
Ambrus
Bookmarks