Hello,

I'm working on a sheet with a structure

Column_A Column_B Column_C Column_D
Code Level Description Value
1. 1 Expenses 10 000
1.1. 2 Water 5 000
1.2. 2 Electricity 3 000
1.3. 2 Gas 2 000
1.3.1. 3 Gas - type 1 1 000
1.3.2. 3 Gas - type 2 1 000


Is there a way to expand the formula below to the additional sublevels? ( old formula with comma, instead of semicolon for Excel 2017 )


=COUNTIF(B$1:B2,1)&IF(B2<>1,"."&COUNTIF(B$1:B2,2)-COUNTIF(B$2:INDEX(B$2:B2,LOOKUP(2,1/(B$2:B2=1),ROW(B$2:B2)-ROW(B$2)+1)),2),"")&IF(B2=3,"."&COUNTIF(B$1:B2,3)-COUNTIF(B$2:INDEX(B$2:B2,LOOKUP(2,1/(B$2:B2=1),ROW(B$2:B2)-ROW(B$2)+1)),3),"")


This formula works fine for three levels, but if there is more than 4 it shows only the first three.

I'm trying to create this list for the new budget file, and would like to find a better solution
to assign the row codes up to 6 or 7 levels.

for example
1.1
1.1.1.
1.1.2.
1.1.2.1.
1.1.2.1.1.
1.1.2.1.1.1.
1.1.2.1.1.2.

etc.

I've browsed through other solutions with VBA (autonumbering), but maybe there is a simpler way, by using the formula.
The structure above is similar to the ones used for WBS and legal numbering cases.

Thanks.