I have a table representing a series of components and their subcomponents, and the subcomponents' respective subcomponents, and so on. It currently looks like a tree (one-to-many relations), but it could change at some point to resemble a graph (many-to-many relations) instead. Unfortunately, it was poorly formatted by its author, and looks something like this:

![Poorly-formatted table](https://i.stack.imgur.com/aZExu.png)

The above format is poor because there is a lot of data duplication and it is limited to a set number (4) of tiers. I would instead prefer if it looked something like this:

![Nicely-formatted table](https://i.stack.imgur.com/wLLOO.png)

The above format is nice because there is very little data duplication, and it is not limited to a set number of tiers.

In case there is any confusion about what the tables represent, here is a graphical representation of the data:

![graphical tree](https://i.stack.imgur.com/NSNoR.png)

It is simple enough to convert from the poor format to the nice format, but there are hundreds of root components, and manual data entry would be far too time-consuming and tedious.

I suspect this problem is unique and I am prepared to write some VBA code myself to parse the table into the nice format, but I thought I'd make sure that this wasn't a common problem with a pre-rolled solution before I rolled my own.

Is there a technical term to describe the poor formatting in the first table? Is there an easier way to reformat the data than to write a VBA macro?