Forum Discussion

Nic Walmsley's avatar
Nic Walmsley
Copper Contributor
Aug 06, 2018

Proceeding sibling

Hi there

 

I'm looking for some help with an excel formula. Have tried myself but is beyond my capabilities.

 

In the table below, I need a formula for Column D. If I were to characterize the rule for this column, it would be:

 

Look up at all the Node values above the current row, and find the next node with the same level as the current row, BUT if you encounter a node with a lower level number first, leave the cell blank.

 

So for example, if the row I'm on is for a node at level 3, it would look up and find the next node from level 3 (looking upwards from my row towards the top). But if it hit a node from a lower level (2 or 1 in this example) before it found another level 3, it would leave Column D blank.

 

D could be characterized as "proceeding sibling"

 

Here's an example of how it should look:

 

NodeLevelParentProceeding Sibling
Food1  
Friut2Food 
Apple3Fruit 
Orange3FruitApple
Banana3FruitOrange
Grape3FruitBanana
Red Grape4Grape 
Green Grape4GrapeRed Grape
Meat2FoodFruit
Beef3Meat 
Chicken3MeatBeef
Lamb3MeatChicken
Fish3MeatLamb
Snapper4Fish 
Cod4FishSnapper
Desert2FoodMeat
Veges2FoodDesert
Potato3Veges 
Carrot3Veges

Potato

Resources