+ Reply to Thread
Results 1 to 27 of 27

Grouping of similar data by Macros possible??

  1. #1
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Arrow Grouping of similar data by Macros possible??

    helo all,
    can any one help regarding grouping of data..


    i have attached raw file and sample grouping answer values. please find and help me.

    Thankyou....
    Last edited by raje; 11-24-2017 at 02:17 AM. Reason: For Explanation, deleted old Description and sample files, find at #4

  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: Need Grouping of similar data (with in tolerances)

    Please give examples of the detailed calculations that produce the results in columns T:X.

    For instance why does U4 result in an area of 900.45 when the highest area in the 230_600 size is the 3174 in O8
    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 Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Need Grouping of similar data (with in tolerances)

    @ Richard Buttrey,

    I was about to ask the same question. Tolerances should be consistent even if variations are applied.

    Kind Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Need Grouping of similar data (with in tolerances)

    Helo Richard Buttery ...i have attached detailed calculations to produce results..

    1)My Grouping is basis of "Size" and Max "Area" Values. so first stage of internal grouping by "Size"

    2)Based upon my example sheet data maximum "Size" is 1)300 600 2)230 600 and 3)230 450

    3)now i am Sub-divided Group no.1) as a) & b) by Maximum "Area" Values.

    4)For example in my Group No.1) contains Area values like 3546, 3258, 3096, 2898, 2790.
    here highest "Area" Value is 3546. so cutoff up to -13% value. here -13% value for 3546 is 3546-(33546*0.13) = 3085.02.

    5) so my group a) up to 3085.02 Area values. then group a) 3546, 3258, 3096.

    6)now we will form Group b), next highest value excluding group a) is 2898...so up to -13% cutoff is
    2898-(2898*0.13)=2521.26. then group as b) 2898, 2790.

    7) Next size is 230 600. and highest "Area" Value is 3174 from Group 2)3174 & 900.45.
    up to -13% cutoff value is 2761.38. but here no items other than 3174. so group individually as c)3174.

    8)Remaining Area value is 900.45, then group individually as d)900.45.

    9)then same rules for Grops No.3) too and sub divide as e). and finally these values produce at table format.

    have a look at my sample format file. need at least upto 2nd stage of grouping

    Please help me for producing results..

    Thank you!!!
    Attached Files Attached Files
    Last edited by raje; 11-24-2017 at 08:30 AM.

  5. #5
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Need Grouping of similar data (with in tolerances)

    Quote Originally Posted by Winon View Post
    @ Richard Buttrey,

    I was about to ask the same question. Tolerances should be consistent even if variations are applied.

    Kind Regards.
    Helo winon...explained calculations and attached sample sheet. Please find.

    Thank you.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Grouping of similar data by Macros possible??

    Here is formulas - manual sort based solution, which could be used as a startpoint for macro:

    1) sort your data on D, E, O descending
    2) in P2 and copy down helper formula (first stage):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    3) in Q2 and copy down Array formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    0.87 is of course 100%-13%
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    And there is also macro which implements it:
    Please Login or Register  to view this content.
    See attached file for the macro. But I do strongly recommend you go through formulas version first to find how it works.
    Attached Files Attached Files
    Last edited by Kaper; 11-24-2017 at 09:52 AM. Reason: added macro :-)
    Best Regards,

    Kaper

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

    Re: Grouping of similar data by Macros possible??

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

  8. #8
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Quote Originally Posted by Kaper View Post
    Here is formulas - handwork based solution, which could be used as a startpoint for macro:
    Hi sir,
    Thank you for your kind response. i have tried but not getting results. can you share the sheet with formulas?

    for the convince and reducing process i have modified sample format. please find modified sample file.

    Thank you for helping..
    Attached Files Attached Files

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Grouping of similar data by Macros possible??

    As for formulas (just to emphasize - second one is an ARRAY formula) - see attachment to this post (based on your data from post #8).
    As for macro - check attachment from post above - https://www.excelforum.com/excel-pro...ml#post4790916
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Quote Originally Posted by Kaper View Post
    Here is formulas - manual sort based solution, which could be used as a startpoint for macro:

    See attached file for the macro. But I do strongly recommend you go through formulas version first to find how it works.
    Thank You Kaper..nice idea for quick analysis.

    Thank you for helping

  11. #11
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Hi Jindon,
    Working great!!! Really nice...Thank you for your kind help...
    Last edited by raje; 11-24-2017 at 10:16 AM.

  12. #12
    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: Grouping of similar data by Macros possible??

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    In addition would you change your loacation to something meaningful. It often helps if we need to consider regional settings or date formats. Thanks.

  13. #13
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Ok Richard sir..

  14. #14
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Helo jindon,
    i entered some data and regarding group 2, highest value is 4482 and 0.87 factor cut off is 3899.34. but C12 Area value is 3546, it is less than 3899
    so it might be grouped other than group 2. but results table showing at group 2 sorting. may be you restricted total No. of groups 5...Actually no group restriction sir.. and final request can you arrange group no.s at P column (beside O column)? please see the sample file.

    Thank you sir..
    Attached Files Attached Files
    Last edited by raje; 11-26-2017 at 02:03 AM.

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

    Re: Grouping of similar data by Macros possible??

    CutOff all the way...
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    sir Total no. of items are 30. but after grouping showing 51. some items are repeated at groups. before and after grouping items total should be same.

    Thank you..
    Attached Files Attached Files

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

    Re: Grouping of similar data by Macros possible??

    Replace "CutOff" sub routine with below.
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    sir, excellent... sir can i ask the reason why it was not working when already other macro present in my excel file or paste it to other file showing error like this image?

    Thank you..
    Attached Images Attached Images

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

    Re: Grouping of similar data by Macros possible??

    No idea.....

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

    Re: Grouping of similar data by Macros possible??

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  21. #21
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Thank you Sir..

  22. #22
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Sir, small error observed at arranging grouping. that is not a major...by size after 300 600, next bigger item is 230 600 after this 230 450.
    this is only the correction..everything is perfect.

    Thank you..
    Attached Files Attached Files

  23. #23
    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: Grouping of similar data by Macros possible??

    Hi,

    As requested earlier would you mind changing your location to something more meaningful please.

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

    Re: Grouping of similar data by Macros possible??

    Replace "test" sub procedure with the below.
    Please Login or Register  to view this content.

  25. #25
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Grouping of similar data by Macros possible??

    Hi raje,
    But ... have you tried my proposition of code from one of first posts on page 1 (the one from 11-24-2017, 02:30 PM)?

    It returns exactly the same results as you expect. See screenshot. So why not use solution you've got already last week?
    Attached Images Attached Images

  26. #26
    Registered User
    Join Date
    11-19-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    38

    Re: Grouping of similar data by Macros possible??

    Hi Kaper sir,
    sorry for re open this thread...may i ask for final file.. i have 2nd type of sheet. comparing to 1st type no of loops are very less. in this Grouping
    by Maxium of "PComb" values. this is at "F" column in my sample file. so sort out group by Maximum "Pcomb Value" with upto 0.87 factor
    cutoff. for example my maximum PComb value is "1728.83". so cut off up to 1728.83*0.87 = 1504.08. so search value
    from 1728.83 to 1504.08 and group them as "1". remaining procedure is same for groups 1,2,3,4,5.

    please edit as per this file which is you prepared at post #6.

    Thank you..
    Attached Files Attached Files

  27. #27
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Grouping of similar data by Macros possible??

    1) My strong advice: avoid merged cells.
    2) Modified code (note starting from row 4 - because of these merged cells
    3) sample file attached - your manual assesment was wrong - note for instance C10 and C11. Moreover, in Sheet 1 you had no data for C17 while on results sheet it was listed
    Attached Files Attached Files

+ 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. Grouping similar text
    By HOJO654 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-11-2014, 10:13 AM
  2. Grouping Together Similar Cells
    By preet188 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 03:08 PM
  3. Grouping similar numbers in a row
    By Fugly in forum Excel General
    Replies: 7
    Last Post: 07-12-2012, 04:07 PM
  4. Grouping Similar Records
    By maw230 in forum Excel General
    Replies: 5
    Last Post: 10-21-2010, 03:26 PM
  5. Grouping Similar Terms
    By james598 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2010, 06:56 PM
  6. Grouping Similar Data
    By elwesso in forum Excel General
    Replies: 1
    Last Post: 07-17-2008, 02:29 PM
  7. Grouping Similar items
    By crosswire123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-31-2006, 04:02 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