Representing Hierarchical Data in Excel

_curtis

New Member
Joined
Jul 31, 2017
Messages
2
Hi there!

I am fairly new to VBA in Excel and was hoping for some guidance on this problem. I am given hierarchical data from a database to perform a report, and the user would like to format the information such that an entry's children lie directly below it (a parent can have multiple children, child has only one parent). This could perhaps be done by indenting the Notes tab of the data by a few spaces. I was wondering how to first perform the reordering of the data by hierarchy, and then visually showing an indentation by adding, say, 5 spaces to the beginning of the Notes tab.
For sample data:

IDParent IDNotes
0NULLThis is number 0.
10This is number 1.
20This is number 2.
31This is number 3.
43This is number 4.
50This is number 5.

<tbody>
</tbody>


I would then like the data to be presented as such:
IDParent IDNotes
0NULLThis is number 0.
10-----This is number 1.
30-----This is number 3.
41----------This is number 4.
23-----This is number 2.
50-----This is number 5.

<tbody>
</tbody>

Thank you so much! Your help is greatly appreciated :)
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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