macro to find lowest level

Microsoft / P-4
June 3, 2009 at 02:54:37
Specs: Windows XP, PENTIMUM -4/1GB
Hello,

please see the excel file i have below i need to search the lowest level from the heirarachy level list which i have as output of my standard report.

CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE PORTION
CHICKEN ROTISSERIE STANDARD
CHICKEN ROTISSERIE
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE WHOLE
CHICKEN ROTISSERIE STANDARD
CHICKEN ROTISSERIE
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE PORTION
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE OTHER
CHICKEN ROTISSERIE STANDARD
CHICKEN ROTISSERIE STANDARD

so output should find lines
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE PORTION
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE WHOLE
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE PORTION
CHICKEN ROTISSERIE STANDARD CHICKEN ROTISSERIE OTHER
as it all are the lowest levels.

can you please provide the macro which find it autometically i have long list of report.

thanks in advance.
Dharmesh


See More: macro to find lowest level

Report •


#1
June 3, 2009 at 07:11:18
Why don't you just sort the range which will put the longest lines at the top or bottom depending on which way you sort?

Report •

#2
June 3, 2009 at 09:41:42
hi,
thanks for quick response.

but let me give you more clear idea about my problem
my file has two column 1 code and 2nd discription

for example

12345 i love
12345 i love india
12345 i love india and indians.
12344 i love london
12399 i love usa
12399 i love usa and people of usa.
12399 i love usa and people of uk
its difficult to decide which is the lowest level in each report so if i do only sorting it will mix all the long lines and may be possible two lines are on same level but they both are the lowest level of same upper lines.

in above example i need line number 3,4,6,7 as output

as line 4 is lowest level of line 12 and 4 has no upper level and line 6 and 7 is lower level of line 5.

i hope its clear if not i can send you my actual report can you suggest how i can attach my file here?

Regards,
dharmesh


Report •

#3
June 3, 2009 at 13:09:12
I think my brain just blew up.

There is no line 12 in your example, so telling us that line 4 is lowest level of line 12 and 4 has no upper level doesn't make sense, at least not to me.

If line 6 and 7 is (sic) lower level of 5, why isn't 2 lower level of 1?


Report •

Related Solutions

#4
June 6, 2009 at 10:58:02
Hi,

thanks for quick help
let me try to give more clarification
Column A column B
Line1 12345 i love
Line2 12345 i love india
Line3 12345 i love india and indians.
Line4 12344 i love london
Line5 12399 i love usa
Line6 12399 i love usa and people of usa.
Line7 12399 i love usa and people of uk

output :-->

line number 3 is the lowest level of line
line number 4 has no lower level so it should return
line number 6 and 7 is the lowest level of line number 5

yes u are right that line no 2 is lower level of 1 but it is not lowest as line number 3 is present below it and i required lowest levels.

my logic is first macro should look the code number in column A if they are same then it should go to see the text weather it is part of next cell in column B if yes then it should move to next cell and return the lowest level.(line number 3 in above example)

if code number is not the same then there is no need to check text it should return the same text from column B.(Line number 4 in above example)


also if the code is same and text is not part of immediate cell in column B then it should return both current text in column B and immediate next cell text in column B.(line number 6 and 7 in above example)

i hope it will be more celar.

please tell if i can give some more clarification.

Regards,
Dharmesh



Report •

#5
June 6, 2009 at 11:03:29
Please pick one of your 2 threads and stop posting in both. It is very difficult to follow.

I'll take part of the blame for replying in both, but I won't be doing that anymore.

I will be ignoring this particular thread from now on.


Report •

#6
June 6, 2009 at 11:08:08
ok.

i have already replied one...so i will not continue with this.

apologies for confusion.

both problem is same only


Report •


Ask Question