Results 1 to 11 of 11

Summarizing Data

Threaded View

  1. #1
    Registered User
    Join Date
    01-03-2020
    Location
    US
    MS-Off Ver
    2019
    Posts
    85

    Question Summarizing Data

    Hi,
    I have a sample excel data which has 5 columns. I want to summarize them based on IDs and Work Time. So, for each ID, I need to sum its corresponding Work Time values and at the same time, keep other corresponding data too. For better understandings, I provided my desired final solution in sheet 2 (the answer should be written in a new sheet).
    I think that I need to use VBA Dictionary.
    Please help me out (Please note that I just need VBA code, not Power Pivot).

    I wrote a code but I couldn't continue. I failed to complete the code. I'm new to VBA Dictionaries and don't have enough understandings of dictionary usage in different situation yet.
    Sub test()
        Dim a, i As Long, txt As String, dic As Object
        Set dic = CreateObject("Scripting.Dictionary")
        a = Sheets("Sheet1").Range("A1:E11")
        For i = 1 To UBound(a, 1)
            txt = Join(Array(a(i, 1), a(i, 2), a(i, 3), a(i, 4)), "~")
            dic(txt) = dic(txt) + a(i, 4)
        Next
        With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
            .Value = Array("ID", "Farm", "Department", "Work Time", "Date")
    Attached Files Attached Files
    Last edited by fa2020; 08-15-2020 at 01:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Summarizing data
    By icevinson in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-19-2015, 08:47 PM
  2. Help with summarizing data
    By ppalmerirs in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-05-2014, 09:15 AM
  3. Data summarizing!?
    By Crebsington in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-18-2011, 02:10 AM
  4. Summarizing data
    By Just James in forum Excel General
    Replies: 2
    Last Post: 04-27-2011, 07:54 AM
  5. Summarizing Data
    By C90RanMan in forum Excel General
    Replies: 11
    Last Post: 06-10-2010, 02:30 PM
  6. Summarizing raw data
    By sonyap in forum Excel General
    Replies: 1
    Last Post: 10-31-2009, 09:48 AM
  7. Summarizing data
    By Pedro AM in forum Excel General
    Replies: 1
    Last Post: 07-03-2006, 03:35 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