• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

how to group by collaps and expend in excel 2007

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
Bharat Guru
Asked:
Bharat Guru
  • 8
  • 6
1 Solution
 
KnutsonBMCommented:
Have you tried using a Pivot Table?
0
 
Bharat GuruAuthor Commented:
Pivot doesn't seems to get above result
0
 
KnutsonBMCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Bharat GuruAuthor Commented:
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
 
KnutsonBMCommented:
like this?
See-Pvt-Tbl.xlsx
0
 
Bharat GuruAuthor Commented:
this is perfect but please send me the steps how you have done it
0
 
KnutsonBMCommented:
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
 
Bharat GuruAuthor Commented:
sorry but I cannot get the same result as yours
0
 
KnutsonBMCommented:
you are using Excel 2007 correct?
0
 
KnutsonBMCommented:
attached is how i did it step by step
See-Pvt-Tbl.xlsx
0
 
Bharat GuruAuthor Commented:
If I follow you steps mannually it works but I have more then 3000 rows and Its not suitable for manual fixed
0
 
KnutsonBMCommented:
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
 
KnutsonBMCommented:
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
 
Bharat GuruAuthor Commented:
Excellent solution
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now