+ Reply to Thread
Results 1 to 15 of 15

Reformat data in specific way using filter and split to two groups

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Reformat data in specific way using filter and split to two groups

    Hello everyone
    I have two sheets .. the first is for raw data which is needed to be formatted in specific way
    Sheet2 is the result sheet .. I will explain what is fixed and what is to be changed

    In sheet2, the cell M2 I will put a value from sheet1 column D (Here's as example 1 or 2) suppose I type 1 in M2

    The headers from rows (5 : 10) to be copied again but there after the first group data with five rows (five blank rows in between the two groups)
    As for headers the colored cells will be changed :
    ** J5 & J26 will be the same value as M2
    ** K5 will be the string "A's Group" & K26 will be the string "B's Group"
    ** L5 & L26 will have the total of results (as explained in the attachment)

    As for the data it will not be exactly as the raw data .. notice the columns positions
    and as for the column A in sheet 1 is just numbering and in the result sheet I need to number filtered data

    NB : The data would be put after the header but let blank row as illustrated

    Hope it is clear and easy
    Thanks advanced for help
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Reformat data in specific way using filter and split to two groups

    If I understand the request correctly the most obvious and elegant way is with a Pivot Table and a couple of Slicers to allow you to filter the results.

    See attached.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Reformat data in specific way using filter and split to two groups

    No idea about the logic of your result extracted...

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    Thank you very much for replies
    In fact I need complex formats that pivot table will not satisfy me .. although pivot tables are great means
    I have to explain again (I am sorry for not good clarification)
    I will attach the file again putting sheet2 as it is and I need the output to be as illustrated before

    001.png

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Reformat data in specific way using filter and split to two groups

    Missed some parts
    change myFilter procedure to
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    Thanks Mr. Jindon for great solutions. You are very helpful
    As for the headers in rows 26 : 31 would be a copy of rows 5 : 10
    and the data will be dynamic in Sheet1 so the copied rows would be placed in another location (I mean rows 26 : 31 will not be always for headers .. this is just for illustration)

    Simply : The code would grab data according to M2 and change the three cells in the main header (5:10) then put the data for group A class (M2.value) then five blank rows then the headers copied again and change the three cells

    Please have a look at the sample in Post #4 .. That's a sheet (RAW Sheet) >> Please, Now I need the code to do all the task in the sequence of logic illustrated

    That's all .. Hope it is clear
    Thanks advanced for great and wonderful help
    Last edited by YasserKhalil; 09-08-2016 at 09:56 PM.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Reformat data in specific way using filter and split to two groups

    Just change to
    Please Login or Register  to view this content.
    ??

  8. #8
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Reformat data in specific way using filter and split to two groups

    You can use this code also, which will generate the outputs for any quantity of groups:
    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    Thank you very very much mr. Sanram
    That's exactly what I need .. You are great
    And thanks a lot to Mr. Jindon (It is my fault of not clarifying my request well)

    @Sanram
    I just need to keep the rows 5:10 as it is and to use these rows as a copy (hope it is clear) then to change the values of the three cells in these headers
    I noticed if I type 1 (it is ok) then if cleared the contents of M2 these rows cleared completely ( I don't need to hardcode the formatting of these rows .. just deal with these rows as they are)
    Thank you very much
    Best regards
    Last edited by YasserKhalil; 09-09-2016 at 04:49 AM.

  10. #10
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Reformat data in specific way using filter and split to two groups

    Use this:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    Thank you very much for great help Mr. Sanram
    I tested the code and typed 1 in M2 and everything is ok
    Typed 2 and everything is ok
    Cleared the cell M2 and everything as expected
    But when typed 3 (or cleared the cell again when it is empty) .. I encountered an error 1004 at this line
    Please Login or Register  to view this content.
    As for the code I don't need to format the rows for B's group as I noticed that part of code
    Please Login or Register  to view this content.
    Rows for Group B would be just copy of main header rows ... and some changes in the cells that I refer to ..
    Sorry for disturbing you ..

  12. #12
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    @Sanram
    The solution is very great and working well .. Just need some modification to get rid of errors if any other value typed in M2 .. and depend on the main rows (as a copy for the second group)

  13. #13
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Reformat data in specific way using filter and split to two groups

    Use this :
    Please Login or Register  to view this content.
    Last edited by sanram; 09-09-2016 at 03:45 PM. Reason: Missed 2nd requirement

  14. #14
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Reformat data in specific way using filter and split to two groups

    Thank you very very much for this awesome solution
    It is working exactly as I need
    Best and kind regards

  15. #15
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Reformat data in specific way using filter and split to two groups

    You are welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-05-2015, 08:29 PM
  2. Need a Macro to Filter out certain groups of data
    By XIGRIMxREAPERIX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2014, 05:13 PM
  3. Filter data by different groups of values
    By adriannn87 in forum Excel General
    Replies: 1
    Last Post: 05-16-2014, 12:57 PM
  4. Quick Macro to Reformat Data into specific format
    By Seraph122 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-23-2012, 07:13 AM
  5. Split Data into User Defined Groups
    By clacketyclack in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2012, 04:37 PM
  6. How to split data to reformat for comparison
    By Opy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2012, 10:52 PM
  7. Replies: 0
    Last Post: 01-19-2011, 02:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1