Multilevel numbering upto 5 level from level and position

ketul shah

New Member
Joined
Aug 18, 2023
Messages
6
Office Version
  1. 2021
Platform
  1. Windows
LEVELPOSITIONOUTPUT
1
1​
1
2
1​
1.1
2
2​
1.2
2
3​
1.3
2
4​
1.4
3
1​
1.4.1
3
2​
1.4.2
3
3​
1.4.3
3
4​
1.4.4
3
5​
1.4.5
4
1​
1.4.5.1
4
2​
1.4.5.2
4
3​
1.4.5.3
1
2​
2

I have two column of level and its position numbers and need to create formula for output column as shown above.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Please tell us how the Output relates to those two columns. I'm not getting the logic
 
Upvote 0
How about:

Book3
ABCD
1LEVELPOSITIONOUTPUT - v1OUTPUT - v2
21111
3211.11.1
4221.21.2
5231.31.3
6241.41.4
7311.4.11.4.1
8321.4.21.4.2
9331.4.31.4.3
10341.4.41.4.4
11351.4.51.4.5
12411.4.5.11.4.5.1
13421.4.5.21.4.5.2
14431.4.5.31.4.5.3
151222
Sheet1
Cell Formulas
RangeFormula
C3:C15C3=LET(p,".",s,SEQUENCE(10),levs,TRIM(MID(SUBSTITUTE(C2,p,REPT(" ",99)),s*99-98,99)),r,IFS(s<A3,levs,s=A3,B3,1,""),TEXTJOIN(p,1,r))
D3:D15D3=LET(p,".",s,SEQUENCE(10),levs,TRIM(MID(SUBSTITUTE(D2,p,REPT(" ",99)),s*99-98,99)),r,IFS(s<A3,levs,s=A3,(0&levs)+1,1,""),TEXTJOIN(p,1,r))


The C formula uses the value from column B, the D formula just increments the level from the row above by 1.
 
Upvote 0
How about:

Book3
ABCD
1LEVELPOSITIONOUTPUT - v1OUTPUT - v2
21111
3211.11.1
4221.21.2
5231.31.3
6241.41.4
7311.4.11.4.1
8321.4.21.4.2
9331.4.31.4.3
10341.4.41.4.4
11351.4.51.4.5
12411.4.5.11.4.5.1
13421.4.5.21.4.5.2
14431.4.5.31.4.5.3
151222
Sheet1
Cell Formulas
RangeFormula
C3:C15C3=LET(p,".",s,SEQUENCE(10),levs,TRIM(MID(SUBSTITUTE(C2,p,REPT(" ",99)),s*99-98,99)),r,IFS(s<A3,levs,s=A3,B3,1,""),TEXTJOIN(p,1,r))
D3:D15D3=LET(p,".",s,SEQUENCE(10),levs,TRIM(MID(SUBSTITUTE(D2,p,REPT(" ",99)),s*99-98,99)),r,IFS(s<A3,levs,s=A3,(0&levs)+1,1,""),TEXTJOIN(p,1,r))


The C formula uses the value from column B, the D formula just increments the level from the row above by 1.
Thank you Eric for solution.
I would go with solution show in column C as sometimes position number are skipped in between.

My question: does formula in column C work if position number is >100 ?
 
Upvote 0

Forum statistics

Threads
1,215,358
Messages
6,124,487
Members
449,165
Latest member
ChipDude83

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