Good morning everyone,
First of all, allow me to thank you for taking the time to provide solutions to this. My apologies for not responding sooner. I've looked at each one and as far as I can see, all of them provide a solution, just not in the format I require. The reason for my wanting to create the 'List' is so that it can be used as the foundation for the financial statements, which read linearly. The logic then, would be as follows:
- Beginning from the top left cell in the 'Category' array, the formula scans scan horizontally from left to right i.e. from Category 1 to Category 5 i.e. from Parent Category to sub-category
- Once the formula detects a unique value in a category that has not yet been generated in the List, it generates that unique value in the List on the next available row, then proceeds scanning the rest of the data in accordance with (1) above
- If the formula detects a value in a category that has already been generated in the List, it ignores it and continues to scan for the next unique value (*), first by continuing to scan rightwards and then proceeding to move down to the adjacent row and repeating the process.
* With the exception of category 5, where a duplicated value can be repeated in the List, provided the same values generated earlier in the List belong to a different Category 4
To explain in a different way why the solutions above aren't exactly what I need, again I reiterate that this list will be used as the foundation for the presentation of the financial statements. So imagine reading a set of financial statements where, instead of reading linearly i.e. having a 'Revenue' section at the top with a breakdown of all the revenue streams underneath, followed by an expenses section with a breakdown of all the individual line-item expenses underneath (i.e. the correct presentation), instead you have a set of financial statements that presents the titles of all the category 1 headers first, the category 2 headers second, the category 3 headers third, and so on, with all the line-items presented last and no segregation for class (expenses and revenue line items presented in one block).
I know there are other solutions to this e.g. using a static template, but for a number of reasons I need this to be dynamic. It doesn't have to make use of UNIQUE and if necessary then we can make use of helper columns. I don't have any knowledge of VBA though, so I'd prefer to steer away from that.
Attached is an updated sample and I've updated the categories to better suit the needs of the end users. As for the blank values in Cat. 5, in the real document these are dynamic ranges that are updated if the end user (overseas finance manager) wishes to add additional revenue streams, additional costs of sales etc. to tailor the document to their individual company. The 'List' ignores these blanks.
You'll be able to see that the 'List' begins to somewhat resemble a linear P&L i.e. converts into a linear (categorised) format rather than a tree structure. Revenue headers presented in rows 3-5 followed by the individual revenue streams below in rows 6-12, followed by the Expenses header in row 14, followed by the individual expense items from row 16).
Problem: You'll also note that row 13 is the External Revenue header, but the list doesn't show the external revenue streams underneath due to the fact the values (E22 - E28) have already been generated in the list (refer to G6 - G12; see E2 - E8 for original values).
I know the List doesn't resemble a finalised P&L, but I have already been able to configure sub-total lines (total internal revenue, total external revenue etc.), total lines (total revenue, total expenses etc.) and grand-total lines (gross profit, EBITDA etc.) into the document, as well as configure appropriate spacing between categories and total lines, so literally everything is in place and this is the last piece of the puzzle.