Org Chart - Using a Macro to Determine all Child Nodes for a Parent Node

chrisjaong

New Member
Joined
Feb 10, 2014
Messages
6
Hi all!

This is my first time posting here but have found many useful things from this forum.

I need to determine all the Child Nodes for each Node within a Business Department Hierarchy.

I have a list in Excel with all the nodes and their one up parent node

i.e.

DEP1

DEP2 DEP 3

DEP 4 DEP 5 DEP 6 DEP 7

[TABLE="width: 500"]
<tbody>[TR]
[TD]Node[/TD]
[TD]Parent[/TD]
[/TR]
[TR]
[TD]DEP1
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DEP2[/TD]
[TD]DEP1[/TD]
[/TR]
[TR]
[TD]DEP3[/TD]
[TD]DEP1[/TD]
[/TR]
[TR]
[TD]DEP4[/TD]
[TD]DEP2[/TD]
[/TR]
[TR]
[TD]DEP5[/TD]
[TD]DEP2[/TD]
[/TR]
[TR]
[TD]DEP6[/TD]
[TD]DEP3[/TD]
[/TR]
[TR]
[TD]DEP7[/TD]
[TD]DEP4[/TD]
[/TR]
</tbody>[/TABLE]

Now this is just an example, in reality it goes down 7 levels with 315 nodes.

What I need is a list to show:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Node[/TD]
[TD]Child[/TD]
[/TR]
[TR]
[TD]DEP1[/TD]
[TD]DEP2~DEP3~DEP4~DEP5~DEP6~DEP7[/TD]
[/TR]
[TR]
[TD]DEP2[/TD]
[TD]DEP4~DEP5[/TD]
[/TR]
[TR]
[TD]DEP3[/TD]
[TD]DEP6~DEP7[/TD]
[/TR]
</tbody>[/TABLE]

and so on.

Can anyone think of a macro to be able to do this in excel?

As this will be used as data for a system, it will have to be calculated and determined in excel.

Really appreciate any form of advice from the Excel Guru's here!!!

Much thanks,

Chris.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top