Is the data sorted by id and entry date? If the leave date is in row 5, will the next entry date, if it exists, always be in row 6?
If so then the following formula should do what you want:
=IF(AND(current_id=next_id,next_entry_date-current_leave_date<=14),1,0)
If not, then please provide additional details on how the multiple entries are related.