Avatar of John Darby
John Darby
Flag for United States of America asked on

Excel autonumber in column 1 based on level of indent in column 2

I have a spreadsheet with Column 2 containing tasks for a project. In column one, I would like to have an autonumber feature, (1,2,3,3.1,3.2,3.3,4.11,4.12, etc) which does the following:

1. Determine the level of indent on the cell adjacent right (column 2)
2. Increment based upon the cell above or if indent is "out-dented" incement from last indent of same level

Does this make sense? I am not sure if this is easy or massively difficult. Help me understand and I will go away if this is too hard.

A sample with a column 2 indents is attached.

Thank you!
Microsoft ExcelVBA

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon
Ingeborg Hawighorst (Microsoft MVP / EE MVE)


sounds like wrong tool for the job. Why don't you use Word instead? It's built-in and ready to go.

cheers, teylyn
Martin Liss

I'll modify the workbook I created for you.
Martin Liss

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
John Darby

Dang Martin, that rocks! It also is teaching me how to do it, since I have 3 more levels of indent to create (Cases 5-7).

Thank you Professor! :)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
John Darby

Marty is the master of Excel and VBA! Thank you, my friend!
Martin Liss

Thank you for the kind words and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014