Need help for VBA coding to do grouping

pprahul2003

New Member
Joined
Sep 21, 2014
Messages
7
Hi,


I am looking to use grouping function multiple times. Can you please help me in this regard?
I have a chart of accounts with Hierarchy relationship as parent and child. each child may act as parent.
Child1 is acting as parent contains 1x1 and 1x2 as children. while chid 1x2 also acting as parent with 1x21 and 1x22 as children. I have to do manual multiple grouping to ensure every children comes under parent's group.
in below case one group for 1x21 & 1x22 with 1x2 as parent.
then 1x1 & 1x2 are grouped under child1
similarly child 1 and child 2 groped under parent1.


I am looking for a macro for the same. Please help.




Relation ship as shown below.
Parent1
Child1
Child1x1

<tbody>
</tbody>
Child1x2

<tbody>
</tbody>
Child1x21

<tbody>
</tbody>
Child1x22

<tbody>
</tbody>
Child2

<tbody>
</tbody>
Child2x1

<tbody>
</tbody>
Child2x2

<tbody>
</tbody>

<tbody>
</tbody>



















Parent1
Child1
Child1x1
Child1x2
Child1x21
Child1x22
Child2
Child2x1
Child2x2

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
pprahul2003,

Welcome to the MrExcel forum.

1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?

Can you post a screenshot of the actual raw data worksheet?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post your data, you can download and install one of the following two programs (both will display what cells, rows, columns, your data is in):
1. MrExcel HTMLMaker20101230
https://onedrive.live.com/?cid=8cffdec0ce27e813&sc=documents&id=8CFFDEC0CE27E813!189

Installation instructions here:
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970

2. Excel Jeanie
Download


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.
 

pprahul2003

New Member
Joined
Sep 21, 2014
Messages
7
pprahul2003,

Welcome to the MrExcel forum.

1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?

Can you post a screenshot of the actual raw data worksheet?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post your data, you can download and install one of the following two programs (both will display what cells, rows, columns, your data is in):
1. MrExcel HTMLMaker20101230
https://onedrive.live.com/?cid=8cffdec0ce27e813&sc=documents&id=8CFFDEC0CE27E813!189

Installation instructions here:
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970

2. Excel Jeanie
Download


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.



Hi Thanks for your response. Due to data integrity issue I cannot share you actual data. However How my data look like and actual results are on two different tabs. You may see the rough data and actual working. What I did is sorted the whole data from down to up and did the grouping. This is the manual work. In actual data columns may increase as there may be many parent child relation ship. Below is the link to understand what am I trying to say. I hope you can help me out. I use excel 2010, PC.

https://www.dropbox.com/s/yxsat343g5g3pvq/Rough Data.xls?dl=0
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
pprahul2003,

Thanks for the workbook.

You have only displayed one group on worksheet Rough Data?????

And, on worksheet Results, you have displayed the above data in reverse order?????


Here are the screenshots of your worksheets, just in case someone else will be able to assist you:


Excel 2007
ABCD
1Parent1
2Child1
3Child1x1A
4Child1x2B
5Child1x21C
6Child1x22D
7Child2
8Child2x1E
9Child2x2F
10
Rough Data



Excel 2007
ABCD
1Child2x2F
2Child2x1E
3Child2
4Child1x22D
5Child1x21C
6Child1x2B
7Child1x1A
8Child1
9Parent1
10
Results



Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 

pprahul2003

New Member
Joined
Sep 21, 2014
Messages
7

ADVERTISEMENT

Hi, yes the data in results tab is in reverse order. however, you can see that i have used group data function to group. you can see 12345 buttons on extreme left top outside work sheet. this is what i want to get coded. i want to group every child with its immediate parent and then those parent to group with there immediate parent.
 

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
pprahul2003,

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,016
Messages
5,834,941
Members
430,327
Latest member
Mr_Himalayan778

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top