+ Reply to Thread
Results 1 to 11 of 11

Summarizing Data

  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.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by fa2020; 08-15-2020 at 01:32 PM.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Summarizing Data

    you can do this with code, but you might also be able to pull it off with a simple function. try putting this in any test cell on sheet1 and see if you can use it to get what you need in any place in the workbook:
    Please Login or Register  to view this content.

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

    Re: Summarizing Data

    This is a sample data. My real data has thousands if rows. I need to automate this procedure which its output is an input for other procedures and further calculations.
    I'm sure VBA dictionaries can do it. I tried some parts of it but I failed to continue.

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Summarizing Data

    can you post what you've already tried? the code to do this is very simple, but i would be interested to see what you've tried first. and by the way, SUMIF() will work for millions of lines of data. the count of rows is irrelevant. I just thought you could use it to your advantage.

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

    Re: Summarizing Data

    Quote Originally Posted by vba_php View Post
    can you post what you've already tried? the code to do this is very simple, but i would be interested to see what you've tried first. and by the way, SUMIF() will work for millions of lines of data. the count of rows is irrelevant. I just thought you could use it to your advantage.
    I need to use VBA dictionar.
    Please Login or Register  to view this content.
    I learned this type of code in a tutorial but the tutorial aim was something else. I tried to solve my problem by that dictionary method but I failed. I'm sure VBA dictionary can do it.
    Last edited by fa2020; 08-15-2020 at 01:45 PM.

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

    Re: Summarizing Data

    I think I found my own answer:
    Please Login or Register  to view this content.

  7. #7
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Summarizing Data

    ummmmm....probably don't use the dictionary object? according to microsoft, it was modeled after PERL. that might just add confusion:

    https://docs.microsoft.com/en-us/off...tionary-object

    what about this?

    Please Login or Register  to view this content.
    that will work with the sample you uploaded. you can change the static range obviously to dynamics. I will let you take it from here.

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Summarizing Data

    Although it looks like you might have solved this, here is another code that may help. It's not pretty, but it worked for me on your data. I compared this outcome with that of Post#6 and found you must identify the whole range in that code, but this code can dynamically size to the data automatically.

    Please Login or Register  to view this content.
    Last edited by maniacb; 08-15-2020 at 11:49 PM. Reason: Corrections to response

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

    Re: Summarizing Data

    Quote Originally Posted by fa2020 View Post
    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.
    Did you?
    https://www.excelforum.com/excel-pro...-a-report.html

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Summarizing Data

    Your result of 103 should be 5 not 3.9...
    Please Login or Register  to view this content.
    Last edited by Sintek; 08-16-2020 at 05:42 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

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

    Re: Summarizing Data

    Quote Originally Posted by jindon View Post
    I asked similar question before, but I made some changes to correspond this new problem. Actually, you helped me
    Last edited by fa2020; 08-16-2020 at 09:03 AM.

+ 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] 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. [SOLVED] 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