Parent Child Hierarchy

mikeyosyd

New Member
Joined
Apr 18, 2018
Messages
5
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi wonderful people. I'm hoping you may be able to help. Apologies if this has already been solved elsewhere.

I have HR data like the inout data table below where I have manager and subordinate employee numbers.

I'd like to find some VBA code to output the table to the right below. In my case of the HR hierarchy data this enables me to pick any manager and find all the subordinates to them down through the full organisational tree.


Input DataOutput Data
ParentChildParent Children
ABAB
ACAC
CDAD
CEAE
DGAG
GHAH
CD
CE
CG
CH
DG
DH
GH

<colgroup><col width="87" span="5" style="width: 65pt;"></colgroup><tbody>
</tbody>
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
See this code provided by pgc01 in another thread
https://www.mrexcel.com/forum/excel...-children-parent-post3892723.html#post3892723

Hope this helps

M.


Hi, thanks so much thats extremely promising. I got an error when I ran it on my dataset of "out of stack space". If you had any thoughts on how to resolve I'd be very grateful. As a guide, my dataset has around 7000 parent-child relationships on the input table. I'll post the same question back to the other thred.

Thanks
 
Upvote 0
I do not know if there is any limitation in Excel for recursive codes. I hope the code author can help you.

M.
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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