Sam Mathai Chacko
Active Member
So we haven't had a new challenge in a while, so I thought I'll remind people that we have a section of the forum to pick your brains, by posting the following formula based challenge. I came across this in VBAExpress; so the credit for the question goes to the OP. So anyway, the challenge is non-VBA, and it goes like this
Illustration:
You have a list of items and their prices in columns B and C. In column A, the levels are indicated as .[x]#, where .[x] represents the level of the hierarchy, and # is the number which represents that hierarchy. So if one were to identify the hierarchy, you could either count the number of dots/periods/decimals (whatever you want to call it), or extract the numeric value on the right hand side of the value in Col A.
Note that there is no price value for the top-most hierarchy, simply because that's the highest level. By the way, column B is irrelevant in our question.
The sample output is shown in column D, and this you can use as reference. What we are looking for is a formula which does not require a helper column.
You can assume that there is no data below this table.
And if it's any motivation, I cooked up a simple array formula that is 98 characters long.
Illustration:
You have a list of items and their prices in columns B and C. In column A, the levels are indicated as .[x]#, where .[x] represents the level of the hierarchy, and # is the number which represents that hierarchy. So if one were to identify the hierarchy, you could either count the number of dots/periods/decimals (whatever you want to call it), or extract the numeric value on the right hand side of the value in Col A.
Note that there is no price value for the top-most hierarchy, simply because that's the highest level. By the way, column B is irrelevant in our question.
The sample output is shown in column D, and this you can use as reference. What we are looking for is a formula which does not require a helper column.
You can assume that there is no data below this table.
And if it's any motivation, I cooked up a simple array formula that is 98 characters long.
Attachments
Last edited: