+ Reply to Thread
Results 1 to 17 of 17

Grouping rows by criteria excel vba

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    lagos
    MS-Off Ver
    Excel 2007
    Posts
    5

    Grouping rows by criteria excel vba

    What I need;


    I have a sales master data (with over 20 columns).

    It contains the following:

    S/N, Customer, Invoice date, Due date, vessel, producer, fiscal regime, quantity, price, sales value, date paid, amount paid, variance, remark, etc
    1.) I need a macro to group this report by invoice type, sum each group, with the column header and group title for each group on same sheet.
    2.) Copy 1 or more groups to form a another report on separate sheets
    3.) Write the summary (like a pivot table) for some of the column headers. Eg, Fiscal regime, sum by each producer with columns quantity, sales value and receipts
    4.) Group 1 or more of the summaries to form another report on separate sheets.
    Not to write too much, I am able to provide more clarity when we start.

    Thanks for your kind assistance.

    Thank you.
    Last edited by pmxpo; 04-28-2020 at 03:00 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Grouping rows by criteria excel vba

    Some suggestions you may fund useful:
    1. Our answerers are looking to "help" more often than they are looking to "do an entire project for you for free".
    2. Jump into this project yourself, when you get stuck on ONE specific hurdle, post that ONE item as a forum question.
    3. Show us what you've tried in an attached sample workbook and how it's not working for you. When you're doing the work yourself, just writing out a complete example question in a forum often points you to solution before you even finish posting.
    4. If you can't make any headway at all and no help is forthcoming in the free forum(s), we do have a Commercial Services forum where you can pay for assistance directly from our EF gurus."

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Grouping rows by criteria excel vba

    In addition to last comment from Pepe, an Excel sample file, showing what is the data and the expected result(S) is always more than welcome.
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    03-06-2013
    Location
    lagos
    MS-Off Ver
    Excel 2007
    Posts
    5

    Post Re: Grouping rows by criteria excel vba

    Quote Originally Posted by PCI View Post
    In addition to last comment from Pepe, an Excel sample file, showing what is the data and the expected result(S) is always more than welcome.
    Please find attached a sample with a code I have attempted...

    Sheet1 contains master data, sheet2 contains the filtered data copied from sheet1.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by pmxpo; 04-28-2020 at 02:38 AM. Reason: to include code tags

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Grouping rows by criteria excel vba

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Grouping rows by criteria excel vba

    I made a table of the data.

    After that a filter on column A and select
    empty cells, totals, restaurants.

    After that I deleted the filtered rows.

    After that I selected al in the filter.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Grouping rows by criteria excel vba

    crossposted: https://chandoo.org/forum/threads/vb...5/#post-263367

    https://www.mrexcel.com/board/thread...l-vba.1132269/

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future
    Last edited by alansidman; 04-28-2020 at 03:49 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Registered User
    Join Date
    03-06-2013
    Location
    lagos
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Grouping rows by criteria excel vba

    Thank you very much. I didn't know about the rules. Please accept my apologies. it has not been solved elsewhere.

    I admit sharing it on chandoo and mrexcel and my intent was to widen my enquiry. Going forward, this rule will strictly be obeyed.

    Thank you admin, I still look forward to a solution from you. Thank you.

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Grouping rows by criteria excel vba

    Then please post the solutions you found on the other forum, on behave of all forummembers.

    You did also not replied to my solution.

  10. #10
    Registered User
    Join Date
    03-06-2013
    Location
    lagos
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Grouping rows by criteria excel vba

    No solutions from any source yet...

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

    Re: Grouping rows by criteria excel vba

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Grouping rows by criteria excel vba

    in #10 you post No solutions from any source yet...

    and my post #6?

  13. #13
    Registered User
    Join Date
    04-19-2018
    Location
    London
    MS-Off Ver
    10
    Posts
    5

    Re: Grouping rows by criteria excel vba_resurrected

    Sorry once again.

    Each time I play with code, keep getting an error and macro doesn't run. I'm not VBA pro but keep trying to play with code until I discover I have no hair left.

    I thought this thread would help but not quite but the nature of this query is similar hence didn't want to start a new thread per se.

    Per attached file, I have the below code working for Grouping but it is based on Column A having a "1".

    I need help to modify the code on just one change such that it is Grouping based on criteria "Total" in Column A and not the number 1.

    Much appreciated as always for any assistance.
    Nick


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by alansidman; 05-16-2020 at 08:17 AM.

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Grouping rows by criteria excel vba

    @RKK1699BGC

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)


    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

  15. #15
    Registered User
    Join Date
    04-19-2018
    Location
    London
    MS-Off Ver
    10
    Posts
    5

    Re: Grouping rows by criteria excel vba

    Sorry - duly noted. Shall start a new thread.

  16. #16
    Registered User
    Join Date
    03-06-2013
    Location
    lagos
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Grouping rows by criteria excel vba

    Sorry, I was referring to the cross-posting rule if I had gotten solutions elsewhere.

    Thanks so much, I am indeed very grateful

  17. #17
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Grouping rows by criteria excel vba

    If you are satisfied with the solution, please mark the question solved.

+ 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: 6
    Last Post: 08-21-2019, 09:10 AM
  2. Criteria Based Multiple Level Grouping in Excel
    By swagatam2014 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2015, 01:15 PM
  3. Excel 2010 - grouping rows
    By frankhov1n in forum Excel General
    Replies: 2
    Last Post: 03-25-2014, 07:55 AM
  4. Excel 2010 VBA Help: Grouping Rows by text in A Column.
    By tiahuana in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2013, 12:13 PM
  5. Excel Macro to Group by bold subtotal rows (multiple levels of grouping)
    By aozorap in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2013, 03:13 PM
  6. Replies: 6
    Last Post: 10-18-2012, 03:10 PM
  7. grouping rows in excel 2000
    By ratfink in forum Excel General
    Replies: 3
    Last Post: 10-10-2008, 11:02 AM

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