+ Reply to Thread
Results 1 to 12 of 12

Group data by values

  1. #1
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Group data by values

    Hi,

    I'm having trouble with grouping data by value using a specific format.
    In my table, I have weekly hours and I want to group data following this example:

    W1 W2 W3 W4
    35:00 35:00 35:00 35:00

    The final result would be: W1-W4 35:00.

    However, if there are different values in the table, the result should be:

    W1 W2 W3 W4 W5 W6
    35:00 35:00 35:00 35:00 30:00 35:00

    Final result: W1-W4 35:00 W5 30:00 W6 35:00

    Please find attached a workbook with more explanations.

    Could you please help me?

    Many thanks!

    Okela
    Attached Files Attached Files
    Last edited by okela; 04-29-2020 at 11:24 AM. Reason: The workbook has been corrected

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Group data by values

    Hi,
    In your 2nd example: Why should W6 be 35 and not 30?

  3. #3
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Hi Belinda,

    This is because the W6 has 35 hours and not 30 hours.
    In my table, weeks can have different hours that is why I gave those examples.
    Is this clearer?

    Thanks,
    Okela

  4. #4
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Group data by values

    Sorry, I meant why is your final result

    W1-W4 35:00 W5 30:00 W6 30:00


    when the value in W6 is 35...?

  5. #5
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Hi Belinda,

    Indeed, the final desired result is: W1-W4 35:00 W5 30:00 W6 35:00.
    Sorry, I have corrected the workbook.
    Please find attached the updated workbook. I have also updated the main post.

    Okela
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Up, could you please help me with this request?

    Many thanks!

    Okela

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Group data by values

    Please try at G12

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Group data by values

    Bo_Ry Amazing!

  9. #9
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Bo_Ry, this is amazing!
    You saved me twice today. Thank you so much.

    Okela

  10. #10
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Hi Bo_Ry,

    I tried to add more weeks and to leave blanks cells. It duplicated the hyphens. For example:

    W1--W5 35:00--

    Could you please help me to fine-tune the function? I have attached the updated workbook with new weeks added.

    Many thanks,

    Okela
    Attached Files Attached Files

  11. #11
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Group data by values

    The hyphens is tricky parts.

    How about no hyphens?

    =TRIM(TEXTJOIN(" ",,REPT(G$5:O$5,((F6:N6<>G6:O6)+(G6:O6<>H6:P6))*(G6:O6<>"")>0)&REPT(TEXT(G6:O6," [h]:mm "),(G6:O6<>H6:P6)*(G6:O6<>""))))

  12. #12
    Registered User
    Join Date
    11-18-2019
    Location
    Paris
    MS-Off Ver
    Office 2016
    Posts
    80

    Re: Group data by values

    Yes, indeed... Is there any way to handle the hyphens?

+ 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] Consolidate values from a group of data
    By kersplash in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-10-2018, 07:06 AM
  2. Replies: 6
    Last Post: 08-09-2016, 10:50 AM
  3. Dynamically select various worksheets to group into one PDF using data values
    By titanzrule32 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2014, 10:11 AM
  4. Distributing values or data with a group???
    By FifiNguyen in forum Excel General
    Replies: 0
    Last Post: 03-01-2014, 03:46 AM
  5. Group data according to certain criteria and add values
    By herolindl in forum Excel General
    Replies: 3
    Last Post: 07-20-2010, 09:29 AM
  6. How to compare a group of values with data ...
    By RPP005 in forum Excel General
    Replies: 4
    Last Post: 08-28-2006, 03:04 PM
  7. [SOLVED] sum values in a data group
    By BigTim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-28-2005, 11:05 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