+ Reply to Thread
Results 1 to 7 of 7

Grouping Row Values Based On Set Criteria

  1. #1
    Registered User
    Join Date
    09-26-2013
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    3

    Grouping Row Values Based On Set Criteria

    Hi everyone, I really hope someone can help me with a little problem. It is likely something silly I'm missing, but I need to resolve this issue as soon as possible.

    I have a set of data from an external source which populates a sheet via SQL:

    ID Date Vex 1 Vex 2 Vex 3 Vex 4 Vex 5
    009999 01/01/2014 5 8 22 26 41
    009998 01/12/2013 10 11 29 40 47
    009997 01/11/2013 30 32 38 41 45

    I need to take the row values and group them into set ranges, of 0-9, 10-19, 20-29, 30-39 and 40-49 so that they appear under these headings. What I'm looking to achieve should look like this:

    ID Date 0-9 10-19 20-29 30-39 40-49
    009999 01/01/2014 5, 8 N/A 22, 26 N/A 41
    009998 01/12/2013 N/A 10, 11 29 N/A 40, 47
    009997 01/11/2013 N/A N/A N/A 30, 32, 38 41, 45

    Any help will be greatly appreciated.

  2. #2
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Grouping Row Values Based On Set Criteria

    How large is your actual data set and how do you feel about using a macro?
    1. Include a sample workbook with an example of the result you want
    2. Use [CODE] and [FORMULA] wrappers for your VBA code or excel formulas
    3. If your question has been answered, mark the thread as SOLVED and click on the "Add Rep" star to thank whoever helped you.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Grouping Row Values Based On Set Criteria

    hi RRa, option, please check attachment, press "Run" button or run code "test"
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-26-2013
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    3

    Re: Grouping Row Values Based On Set Criteria

    Thank you both for such a quick reply.

    Quote Originally Posted by k64 View Post
    How large is your actual data set and how do you feel about using a macro?
    The data set is currently in excess of 10,000 values - Something I would like working in Access, but unfortunately I don't make that call. As for macros, I am willing to use anything that fulfills my requirements and can guarantee 100% accuracy without toppling the system.

    Quote Originally Posted by watersev View Post
    hi RRa, option, please check attachment, press "Run" button or run code "test"
    Hi watersev, I ran your function and it certainly seems to do the job - However I will load it into my main data sheets first and report back on the results.

    Update:

    Thanks watersev, it works well with my data; however would it be possible to populate the values your function returns into a specified sheet (instead of creating a new one) with a table style? If the function were to be run again, could it update the specified sheet overwriting existing data so that it retains the order?
    Last edited by RRa; 06-08-2014 at 02:48 AM. Reason: Updating information

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Grouping Row Values Based On Set Criteria

    hi RRa, yes, it is possible, can you provide a sample workbook with target sheet for result table?

  6. #6
    Registered User
    Join Date
    09-26-2013
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    3

    Re: Grouping Row Values Based On Set Criteria

    Quote Originally Posted by watersev View Post
    hi RRa, yes, it is possible, can you provide a sample workbook with target sheet for result table?
    Hi watersev, thanks for the reply and sorry for the delay in getting back.

    I can't provide a direct copy of the original spreadsheet, but I have modified the one you provided previously to reflect the general aim:

    1. Click on Run
    2. All results in the Data sheet are evaluated and grouped based on criteria
    3. The grouped values are displayed in the GroupTblAlpha table in the Grouping sheet
    4. When Run is clicked again, the same process is executed overwriting the values present in GroupTblAlpha (this is to maintain the order and prevent duplication when new data is parsed into the Data sheet)

    Thank you for your on-going support and I look forward to your reply.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Grouping Row Values Based On Set Criteria

    hi RRa, please check attachment, click Run
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-26-2013
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    3

    Re: Grouping Row Values Based On Set Criteria

    Thank you for all of your help watersev, it is working well and doing everything required.

+ 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. [SOLVED] automatic response based on grouping criteria via macros
    By nicki_rae22 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-31-2014, 02:13 PM
  2. Replies: 6
    Last Post: 10-18-2012, 03:10 PM
  3. Grouping and counting based on several criteria
    By Stroem in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2012, 05:22 AM
  4. [SOLVED] Grouping data based on multiple criteria
    By Thoughtfox in forum Excel General
    Replies: 4
    Last Post: 04-26-2012, 06:12 PM
  5. Grouping rows based on column values and comparing row values
    By bernborough in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2010, 10:18 AM

Tags for this Thread

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