In an excel sheet I have hierarchy data of units from columns 1-8 (or A-H). The first row is a header. In each row there is only 1 cell that is not empty and that one cell includes the name of a unit. The following example describes the under-over-order relationship of units: Unit A's name is located in e.g. E10 and its superior unit's name is located upwards in the first row from Unit A's row but exactly 1 column left from Unit A's column so in this example the superior unit name will be in column D and somewhere between row 2-9. In column I there is a selfID which is uniqie to each unit. I would like to have an excel formula that provides in column J (parentID) the selfID of the unit's superior unit. If a unit doesn't have a superior unit (because the given unit is in column A and there is no other columns to the left of A) leave the superior unit's cell empty. In the attached photo I already manually filled column J with data that I would expect to get as a result of some excel magic.