+ Reply to Thread
Results 1 to 6 of 6

Grouping similar items in excel

Hybrid View

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    ksa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Grouping similar items in excel

    have Some Values in excel
    and I wish to collect them as this pic. how can i do this in vba untitled.JPG

  2. #2
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Grouping similar items in excel

    =sumif

    if aaa is at a1 and value at b
    beside aaa cell put =sumif(a1,a:a,b:b)

  3. #3
    Registered User
    Join Date
    01-21-2013
    Location
    ksa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Grouping similar items in excel

    I Need this to be done using vba (the below table to be created with the values from the upper table)

  4. #4
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Grouping similar items in excel

    can specific the column and row for the name and value? thanks..

  5. #5
    Registered User
    Join Date
    01-21-2013
    Location
    ksa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Grouping similar items in excel

    Column A for name
    Column B for Value

  6. #6
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Grouping similar items in excel

    Sub TEST()
    
    Dim LastRow As Long
    
    LastRow = Worksheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
    
    For i = 1 To LastRow
        
        If IsEmpty(Worksheets("sheet1").Range("A" & i)) = False Then
            
            Worksheets("sheet1").Cells(i, 4) = Worksheets("sheet1").Range("A" & i)
            Worksheets("sheet1").Cells(i, 5) = Application.SumIf(Range("A:A"), Range("A" & i), Range("B:B"))
        
        End If
        
    
        
    Next i
    
    For i = 1 To LastRow
    
        If Worksheets("sheet1").Cells(i + 1, 4) = Worksheets("sheet1").Cells(i, 4) Then
        
            Worksheets("sheet1").Cells(i, 4).Clear
            Worksheets("sheet1").Cells(i, 5).Clear
            
        End If
    
    Next i
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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