Set up numbers into MultiLevel tree

Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

I need to generate number into column F, based on hierarchy (col B:D), below is excel examaple:
A
B
C
D
E
F
1
2
Looking Numbers
3
A1
1
4
A1.1
101
5
A1.2
201
6
A1.3
301
7
A1.3.1
10301
8
9
B1
2
10
B1.1
102
11
B1.2
202
12
B1.2.1
10202
13
B1.2.2
20202
14
B1.3
302
15
B1.4
402
16
17
C1
3
18
C1.1
103
19
C1.1.1
10103
20
C1.1.2
20103

<tbody>
</tbody>


I know only how to set A1, B1 and C1 value.
Code:
ws_c = ws1.Cells(Rows.Count, "D").End(xlUp).Row
Dim Lev1, Lev2, Lev3 As Long
Lev1 = 1
    For i = 3 To ws_c
    
        If ws1.Range("B" & i).Value <> "" Then
           ws1.Range("F" & i).Value = Lev1
           Lev1 = Lev1 + 1
        End If
    Next
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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