+ Reply to Thread
Results 1 to 27 of 27

Grouping of similar data by Macros possible??

Hybrid View

  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)

    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.

  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)

    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.

  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,678

    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
    =IF(OR(D2<>D1,E2<>E1),SUM(P1,1),P1)

    3) in Q2 and copy down Array formula
    Formula: copy to clipboard
    =IF(P2<>P1,SUM(Q1,1),IF(MAX(IF(Q1:Q$2=Q1,O1:O$2,""))*0.87<=O2,Q1,Q1+1))

    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:
    Sub test()
    Dim lr As Long
    lr = Cells(Rows.Count, "D").End(xlUp).Row
    Range("B1:O" & lr).Sort Key1:=Range("D1"), Order1:=xlDescending, Key2:=Range("E1"), _
      Order2:=xlDescending, Key3:=Range("O1"), Order3:=xlDescending, Header:=xlYes
    Columns("P:Q").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("P2").Formula = "=IF(OR(D2<>D1,E2<>E1),SUM(P1,1),P1)"
    Range("Q2").FormulaArray = "=IF(RC[-1]<>R[-1]C[-1],SUM(R[-1]C,1),IF(MAX(IF(R[-1]C:R2C=R[-1]C,R[-1]C[-2]:R2C[-2],""""))*0.87<=RC[-2],R[-1]C,R[-1]C+1))"
    Range("P2:Q2").AutoFill Destination:=Range("P2:Q" & lr)
    Application.Calculate
    Range("P2:Q" & lr).Value = Range("P2:Q" & lr).Value
    Columns("P").Delete Shift:=xlToLeft
    End Sub
    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
    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

  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 - 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

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

    Re: Grouping of similar data by Macros possible??

    Try
    Sub test()
        Dim a, e, i As Long, ii As Long, txt As String, temp, w, x(), y, n
        With Sheets("sheet1")
            With Intersect(.Columns("b:o"), .UsedRange)
                a = Application.Index(.Value, Evaluate("row(1:" & _
                .Rows.Count & ")"), [{1,3,4,9,14,10,11,14}])
                a(1, 1) = a(1, 1) & " Grouping"
                a(1, 8) = "No. of Column/Wall"
            End With
        End With
        VSortM a, 2, UBound(a, 1), 5
        With CreateObject("Scripting.Dictionary")
            For i = 2 To UBound(a, 1)
                If a(i, 1) <> "" Then
                    For Each e In Array(2, 3)
                        txt = txt & Chr(2) & a(i, e)
                    Next
                    If IsEmpty(.Item(txt)) Then
                        ReDim w(1 To 1)
                    Else
                        w = .Item(txt)
                        ReDim Preserve w(1 To UBound(w) + 1)
                    End If
                    w(UBound(w)) = Application.Index(a, i, 0)
                    .Item(txt) = w
                End If
                txt = ""
            Next
            For Each e In .items
                If UBound(e) > 1 Then
                    n = n + 1: ReDim Preserve x(1 To n)
                    temp = e(1)(UBound(e(1))) * 0.87
                    x(n) = e(1): y = x(n)
                    For i = 2 To UBound(e)
                        If e(i)(UBound(e(i))) >= temp Then
                            y(1) = y(1) & "," & e(i)(1)
                        Else
                            Exit For
                        End If
                    Next
                    y(UBound(y)) = UBound(Split(y(1), ",")) + 1: x(n) = y
                    If i <= UBound(e) Then
                        n = n + 1: ReDim Preserve x(1 To n)
                        x(n) = e(i): y = x(n)
                        For ii = i + 1 To UBound(e)
                            y(1) = y(1) & "," & e(ii)(1)
                        Next
                        y(UBound(y)) = UBound(Split(y(1), ",")) + 1
                        x(n) = y
                    End If
                Else
                    n = n + 1: ReDim Preserve x(1 To n)
                    e(1)(UBound(e(1))) = 1
                    x(n) = e
                End If
            Next
        End With
        For i = 1 To n
            x(i)(1) = SortA(x(i)(1))
        Next
        With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
            .Value = a
            .Rows(2).Resize(n).Value = Application.Index(x, 0, 0)
            .CurrentRegion.Columns.AutoFit
        End With
    End Sub
    
    Sub VSortM(ary, LB, UB, ref)
        Dim i As Long, ii As Long, iii As Long, m, temp
        i = UB: ii = LB
        m = ary(Int((LB + UB) / 2), ref)
        Do While ii <= i
            Do While ary(ii, ref) > m: ii = ii + 1: Loop
            Do While ary(i, ref) < m: i = i - 1: Loop
            If ii <= i Then
                For iii = LBound(ary, 2) To UBound(ary, 2)
                    temp = ary(ii, iii): ary(ii, iii) = ary(i, iii): ary(i, iii) = temp
                Next
                i = i - 1: ii = ii + 1
            End If
        Loop
        If LB < i Then VSortM ary, LB, i, ref
        If ii < UB Then VSortM ary, ii, UB, ref
    End Sub
    
    Function SortA(ByVal txt As String) As String
        Dim x, y, i As Long, ii As Long, m As Object, temp
        x = Split(txt, ",")
        If UBound(x) > 0 Then
            ReDim y(UBound(x))
            With CreateObject("VBScript.RegExp")
                .Global = True
                .Pattern = "\d+"
                For i = 0 To UBound(x)
                    y(i) = Trim$(x(i))
                    If .test(y(i)) Then
                        For ii = .Execute(y(i)).Count - 1 To 0 Step -1
                            Set m = .Execute(y(i))(ii)
                            y(i) = Application.Replace(y(i), m.firstindex + 1, _
                                   m.Length, Format$(m, String(12, "0")))
                        Next
                    End If
                Next
            End With
            For i = 0 To UBound(x)
                For ii = i + 1 To UBound(x)
                    If y(i) > y(ii) Then
                        temp = y(i): y(i) = y(ii): y(ii) = temp
                        temp = x(i): x(i) = x(ii): x(ii) = temp
                    End If
            Next ii, i
        End If
        SortA = Join(x, ",")
    End Function
    Attached Files Attached Files

  10. #10
    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,678

    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

  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??

    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.

  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??

    Ok Richard sir..

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

    Re: Grouping of similar data by Macros possible??

    CutOff all the way...
    Sub test()
        Dim a, e, i As Long, ii As Long, txt As String, temp, w, x(), n As Long
        With Sheets("sheet1")
            With Intersect(.Columns("b:o"), .UsedRange)
                a = Application.Index(.Value, Evaluate("row(1:" & _
                .Rows.Count & ")"), [{1,3,4,9,14,10,11,14}])
                a(1, 1) = a(1, 1) & " Grouping"
                a(1, 8) = "No. of Column/Wall"
            End With
        End With
        VSortM a, 2, UBound(a, 1), 5
        With CreateObject("Scripting.Dictionary")
            For i = 2 To UBound(a, 1)
                If a(i, 1) <> "" Then
                    For Each e In Array(2, 3)
                        txt = txt & Chr(2) & a(i, e)
                    Next
                    If IsEmpty(.Item(txt)) Then
                        ReDim w(1 To 1)
                    Else
                        w = .Item(txt)
                        ReDim Preserve w(1 To UBound(w) + 1)
                    End If
                    w(UBound(w)) = Application.Index(a, i, 0)
                    .Item(txt) = w
                End If
                txt = ""
            Next
            For Each e In .items
                If UBound(e) > 1 Then
                    n = n + 1: ReDim Preserve x(1 To n): x(n) = e(1)
                    temp = e(1)(UBound(e(1))) * 0.87
                    CutOff e, x, n, 2, temp
                Else
                    n = n + 1: ReDim Preserve x(1 To n)
                    e(1)(UBound(e(1))) = 1
                    x(n) = e
                End If
            Next
        End With
        With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
            .Value = a
            .Rows(2).Resize(n).Value = Application.Index(x, 0, 0)
            .CurrentRegion.Columns.AutoFit
        End With
    End Sub
    
    Private Sub CutOff(e, x, n As Long, ref, temp)
        Dim i As Long, y
        y = x(n)
        If ref > UBound(e) Then
             y(UBound(y)) = UBound(Split(y(1), ",")) + 1
             x(n) = y
        Else
            For i = ref To UBound(e)
                If e(i)(UBound(e(i))) >= temp Then
                    y(1) = y(1) & "," & e(i)(1)
                Else
                    y(UBound(y)) = UBound(Split(y(1), ",")) + 1
                    y(1) = SortA(y(1)): x(n) = y
                    n = n + 1: ReDim Preserve x(1 To n): x(n) = e(i)
                    temp = e(i)(UBound(e(i))) * 0.87
                    CutOff e, x, n, i + 1, temp
                End If
            Next
            y(UBound(y)) = UBound(Split(y(1), ",")) + 1
            y(1) = SortA(y(1)): x(n) = y
        End If
    End Sub
    
    Sub VSortM(ary, LB, UB, ref)
        Dim i As Long, ii As Long, iii As Long, m, temp
        i = UB: ii = LB
        m = ary(Int((LB + UB) / 2), ref)
        Do While ii <= i
            Do While ary(ii, ref) > m: ii = ii + 1: Loop
            Do While ary(i, ref) < m: i = i - 1: Loop
            If ii <= i Then
                For iii = LBound(ary, 2) To UBound(ary, 2)
                    temp = ary(ii, iii): ary(ii, iii) = ary(i, iii): ary(i, iii) = temp
                Next
                i = i - 1: ii = ii + 1
            End If
        Loop
        If LB < i Then VSortM ary, LB, i, ref
        If ii < UB Then VSortM ary, ii, UB, ref
    End Sub
    
    Function SortA(ByVal txt As String) As String
        Dim x, y, i As Long, ii As Long, m As Object, temp
        x = Split(txt, ",")
        If UBound(x) > 0 Then
            ReDim y(UBound(x))
            With CreateObject("VBScript.RegExp")
                .Global = True
                .Pattern = "\d+"
                For i = 0 To UBound(x)
                    y(i) = Trim$(x(i))
                    If .test(y(i)) Then
                        For ii = .Execute(y(i)).Count - 1 To 0 Step -1
                            Set m = .Execute(y(i))(ii)
                            y(i) = Application.Replace(y(i), m.firstindex + 1, _
                                   m.Length, Format$(m, String(12, "0")))
                        Next
                    End If
                Next
            End With
            For i = 0 To UBound(x)
                For ii = i + 1 To UBound(x)
                    If y(i) > y(ii) Then
                        temp = y(i): y(i) = y(ii): y(ii) = temp
                        temp = x(i): x(i) = x(ii): x(ii) = temp
                    End If
            Next ii, i
        End If
        SortA = Join(x, ",")
    End Function

  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,666

    Re: Grouping of similar data by Macros possible??

    Replace "CutOff" sub routine with below.
    Private Sub CutOff(e, x, n As Long, ref, temp)
        Dim i As Long, y
        y = x(n)
        For i = ref To UBound(e)
            If e(i)(UBound(e(i))) >= temp Then
                y(1) = y(1) & "," & e(i)(1)
            Else
                Exit For
            End If
        Next
        y(UBound(y)) = UBound(Split(y(1), ",")) + 1
        y(1) = SortA(y(1)): x(n) = y
        If i <= UBound(e) Then
            n = n + 1: ReDim Preserve x(1 To n): x(n) = e(i)
            temp = e(i)(UBound(e(i))) * 0.87
            CutOff e, x, n, i + 1, temp
        End If
    End Sub

  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,666

    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,666

    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,666

    Re: Grouping of similar data by Macros possible??

    Replace "test" sub procedure with the below.
    Sub test()
        Dim a, e, i As Long, ii As Long, txt As String, temp, w, x(), n As Long
        With Sheets("sheet1")
            With .Range("b1", .Range("b" & .Rows.Count).End(xlUp)).Resize(, 14)
                a = Application.Index(.Value, Evaluate("row(1:" & _
                .Rows.Count & ")"), [{1,3,4,9,14,10,11,14}])
                a(1, 1) = a(1, 1) & " Grouping"
                a(1, 8) = "No. of Column/Wall"
            End With
        End With
        ReDim Preserve a(1 To UBound(a, 1), 1 To UBound(a, 2) + 1)
        For i = 2 To UBound(a, 1)
            a(i, UBound(a, 2)) = Join(Array(Format$(a(i, 2), "00000.0000"), _
            Format$(a(i, 3), "00000.0000"), Format$(a(i, 5), "00000.0000")))
        Next
        VSortM a, 2, UBound(a, 1), UBound(a, 2)
        ReDim Preserve a(1 To UBound(a, 1), 1 To UBound(a, 2) - 1)
        With CreateObject("Scripting.Dictionary")
            For i = 2 To UBound(a, 1)
                If a(i, 1) <> "" Then
                    For Each e In Array(2, 3)
                        txt = txt & Chr(2) & a(i, e)
                    Next
                    If IsEmpty(.Item(txt)) Then
                        ReDim w(1 To 1)
                    Else
                        w = .Item(txt)
                        ReDim Preserve w(1 To UBound(w) + 1)
                    End If
                    w(UBound(w)) = Application.Index(a, i, 0)
                    .Item(txt) = w
                End If
                txt = ""
            Next
            For Each e In .items
                If UBound(e) > 1 Then
                    n = n + 1: ReDim Preserve x(1 To n): x(n) = e(1)
                    temp = e(1)(UBound(e(1))) * 0.87
                    CutOff e, x, n, 2, temp
                Else
                    n = n + 1: ReDim Preserve x(1 To n)
                    e(1)(UBound(e(1))) = 1
                    x(n) = e
                End If
            Next
        End With
        With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
            .Value = a
            .Rows(2).Resize(n).Value = Application.Index(x, 0, 0)
            .CurrentRegion.Columns.AutoFit
        End With
    End Sub

  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,678

    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,678

    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