This trick uses circular references :

Using self-reference to increment a row number for use in indirect ; then uses match in a dynamic array of cell references to check line per line the field given by the indirect reference ; if no match -> give the indirect entry, and block the text in cell. Show blank cell content when cell value is more than max iteration (600).

=IF(NOT(ISNUMBER(B7));B7;IF(B7>598;"";IF(NOT(ISERROR(MATCH(INDIRECT("'BDD W'!F"&2+B7);$B$7:$B7;0)));1+B7;INDIRECT("'BDD W'!F"&2+B7))))

Adapt to your data, and paste this formula in a column.

Iteration must be set.