Solved

how to group by collaps and expend in excel 2007

Posted on 2011-02-17
14
434 Views
Last Modified: 2012-06-27
I want group below data as collaps and expend view
AB       AB desc1      AB Detail1    
AB       AB desc2      AB Detail2    
AC       AC desc1      AC Detail1    
AC       AC desc2      AC Detail2    
AC       AC desc3      AC Detail3    

result should be
collaps close
+AB      
+AC    

collaps expend
-AB      
            AB desc1      AB Detail1    
             AB desc2      AB Detail2    
-AC    
            AC desc1      AC Detail1    
            AC desc2      AC Detail2    
            AC desc3      AC Detail3    

When I click on Outline from menu I'm getting error "cannot create an outline"
0
Comment
Question by:Bharat Guru
  • 8
  • 6
14 Comments
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34917192
Have you tried using a Pivot Table?
0
 

Author Comment

by:Bharat Guru
ID: 34917434
Pivot doesn't seems to get above result
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34917476
check this out and let me know if it is what you are looking forward, this is the Pivot Table i was talking about


-Brandon
See-Pvt-Tbl.xlsx
0
 

Author Comment

by:Bharat Guru
ID: 34918031
Pivot is fine but I'm only looking for 1 level of sub group when i expend I want to get result as following

Col1      Col2             Col3
-AB      
            AB desc1      AB Detail1    
             AB desc2      AB Detail2    
-AC    
            AC desc1      AC Detail1    
            AC desc2      AC Detail2    
            AC desc3      AC Detail3  
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34918105
like this?
See-Pvt-Tbl.xlsx
0
 

Author Comment

by:Bharat Guru
ID: 34918437
this is perfect but please send me the steps how you have done it
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34918524
ensure you have a space between the groups that you are trying to create, in the space BELOW the group put the header (AB, AC, etc...), go to the 'Data' Tab in the Ribbon, on the Right hand side you will see where it says Group and Ungroup, select the rows that you want to group (Not including the header on the line below) and select 'Group' from the ribbon

let me know if this does not work for you

-Brandon
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Bharat Guru
ID: 34918918
sorry but I cannot get the same result as yours
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34919100
you are using Excel 2007 correct?
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34919149
attached is how i did it step by step
See-Pvt-Tbl.xlsx
0
 

Author Comment

by:Bharat Guru
ID: 34919249
If I follow you steps mannually it works but I have more then 3000 rows and Its not suitable for manual fixed
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 34919626
I am working on the vba script to do it for you, i am pretty slammed at work right now so it may be this evening or even tomorrow morning (Eastern Time).  If this is insufficient i apologize and am sure there is another expert than can help.

Brandon
0
 
LVL 6

Accepted Solution

by:
KnutsonBM earned 125 total points
ID: 34920039
This code works on the test data i created, if you supply a copy of test data i could use, then i can ensure it works for you

Sub GroupAll()
a = 1
b = 2
c = 3
d = 1

Do Until Cells(d, 1).Value = ""
Do Until Cells(a, 1).Value <> Cells(b, 1).Value
    b = b + 1
Loop

Rows(b).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

Range(Rows(a), Rows(b - 1)).Select
Selection.Rows.Group

Cells(b, 1).Value = Cells(a, 1).Value

b = b + 1
a = b
b = b + 1
c = b + 1
d = c

Loop

End Sub
0
 

Author Closing Comment

by:Bharat Guru
ID: 34920474
Excellent solution
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now