View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Counting Indents

This is a great question!

Say we have a cell with indented contents and want to know the indent level.
Consider the following one-line UDF:

Function indenture(r As Range) As Integer
indenture = r.IndentLevel
End Function

If A1 has been indented 3 times,
=indenture(A1) will return a 3
--
Gary''s Student - gsnu200825


"MParham" wrote:

I have a Hyperion report that gives me the Chart of Accounts in a way that
each level is indented when viewed in Excel. There are no spaces to count, it
is all done with indents. I need to convert the file dividing them out into
Level groups so I need to know how many times the item was indented so I can
write a macro or formula to move it to the proper level. When an item is
indented, how do you get the computer to calculate the number of indents? If
you can't do that, can I replace each indent with another character I can
count via formula?

An example of what I have is:

Account 1
Account 1a
Account 1b
Account 1b1
Account 2

That is just something to show how my report comes in. I used spaces in the
above example but the report does not, it uses indents and I need to be able
to calculate how many indents on each Account so I can use another formula to
automatically place it in the right place of another form.