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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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