+ Reply to Thread
Results 1 to 20 of 20

Summarize Data

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Summarize Data

    Hello:

    Please refer to attached file.
    Have lots of purchase data in sheet1

    Sheet1:
    column D is the purchase date
    Column E is the Item#
    Column E is Item Description
    Column H is the cost per item.

    I need a VB Code to summarize these data in Sheet3 with UNIQUE Item # in column A, Its item description in Column B and
    Average cost of the item for each month in column D thru O.

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Summarize Data

    How about using a pivot table?
    (with some extra calculated fields)
    Attached Files Attached Files
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi GC excel:

    Thanks a lot with this solution.
    However I am not good at Pivot Table and hence i prefer VB Code. I may be able to use this...Thanks
    Riz
    Last edited by rizmomin; 06-21-2015 at 12:59 PM.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    Hi,

    There are some rows with negative Qtty, such as row 257, 258, 607-610, etc, is this expected or an error typing ?
    Also, there is one item at row 28 which not on the same year with others, is this expected ?

    Meanwhile, this is the code :
    Please Login or Register  to view this content.

    Regards

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Seems to work, I will be sure after further testing.
    Just need small correction in the code.
    The data in column H is Per item, so please correct the code accordingly.
    Thanks and Please let me know if you have any questions.
    Thanks.

    Riz

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    You are welcome.

    Please change this line in previous code :
    Please Login or Register  to view this content.
    to this :
    Please Login or Register  to view this content.

    Please let me know if this is not worked as expected.



    Regards

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Super work...seems to work great and very fast.
    I need one more feature added.
    I would have a list of some main Item# and what i want to do is highlight that row in the final output in Sheet2.
    Item # of interest would be from cell O2 down in Sheet1.

    Thanks a lot
    Riz
    Last edited by rizmomin; 06-21-2015 at 06:21 PM.

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    You are welcome rizmomin, thank you for the reputation points.

    This is the modified code as your request.

    Please Login or Register  to view this content.

    Regards
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Thanks a lot for great help.
    Just wanted to clarify that the highlight should go in the final output sheet3 and not sheet1
    I need to take this one step further.

    Hello:

    Please refer to attached revised file.
    As mentioned Sheet1 has data of purchase
    Column A has Store #
    Column D date of Purchase
    Column E is Item#
    Column G is Qty

    I need a VB Code which will give Qty for each store for the item mentioned in cell D3:W3 for each store tab.


    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  10. #10
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    You are welcome.

    The code in #8 doesn't highlight anything in sheet1, I do it manually to make you easier spot the pointed items. If you remove all highlighted color in sheet1 and then run the code, you will find that the code does not change anything in this sheet.

    This is new code as your request in #9 :

    Please Login or Register  to view this content.


    Regards

  11. #11
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Very smart and very fast...works like a charm.
    Thanks a lot....as i was using formula's to do this and it was taking long time to calculate.
    Now it is on the fly...this is why i like VB Code a lot more when you have too much calculation.
    Once again, thank you so much and will contact you further if any assistant is needed.

    Riz

  12. #12
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    You are welcome rizmomin,

    Yes, that is what the power of kernel mode is, learning programming language is nothing useless at all.

    Regards

  13. #13
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hello karedog:

    Whild testing in my real workbook, it gave an error.
    Please refer to attached as part of Real workbook.
    Sheet1 is now "Inv_Sum" in my real workbook.
    Your macro is called "SortStore" and the code is in "Summary" module.
    Please run and see the error.

    While doing this, if you can see in column T thru AD, i am using formulas and those takes long time.
    Would appreciate if i can get VB Code for that as below:

    For each store, i need Date, Inv # and Total Qty Shipped as shown.

    Please let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  14. #14
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    Hi Riz,

    Your data is messy, you should tidy it up a little bit.
    For example, sheet 43227 is fine, but for sheet 10687 and 10693 you must delete row 3:6 first (so row 7 become row 3), to make all data uniform.

    Here is the code according to your new layout :

    Please Login or Register  to view this content.
    And this is the code to replace existing functions in columns T:AD :

    Please Login or Register  to view this content.

    Regards

  15. #15
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Its is strange, the code inserts the 3 rows as you had mentioned.
    Please refer to attached file and run the code.
    Also in the code for Column T:AD, the code needs to consolidate the result as shown.
    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    I have no idea what you are talking.

    Here is what I do :
    - First, I make a copy of each store sheet (10687 --> Copy 10687, etc)
    - Then I run the Sub SortStore()
    - Then I compare the unmodified original sheet (Copy 10687 etc) which use functions, with the sheet which macro is applied (10687 etc)
    - The result is exactly the same

    As for columns T:AD, you want to sum them by dates (no breakdown per items), so I create a new sub Test4() for this purpose.

    Note :
    The copy of original sheets (Sheets with name : Copy ....) will slow down the final process, since they still have so many functions in them. After these sheets are deleted, the result will be much faster. I purposely keep these sheets so you can compare before and after.




    Regards
    Attached Files Attached Files
    Last edited by karedog; 06-23-2015 at 07:06 AM.

  17. #17
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi karedog:

    Seems to work now.
    As for column T:AD, what changes in the code i will need to add total which is on column P instead of column G.
    Please refer to updated excel file.
    (Note: just to let you know that there will be some blank columns between G and P).
    Also since i am not going thru VBA and wants to avoid the formulas, i have added 3 sheets
    Credit_10687,Credit_10693 and Credit_43227
    In these sheets, i need VB code to do as follows:
    The data source would be Inv_sum.
    if the value in column P is negative AND Item# Column E is NOT blank then copy that row data A:P into appropriate Credit sheet for each store (Column A) starting in row 2.

    Please let me know if you have any questions.
    Thanks a lot...........Super work.

    Riz
    Attached Files Attached Files
    Last edited by rizmomin; 06-23-2015 at 11:22 AM.

  18. #18
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    Well, it's kind a strange when nothing is changed but the code suddenly begin to work.

    As for you new request , I have create a new sub in the attached file.



    Regards
    Attached Files Attached Files

  19. #19
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Summarize Data

    Hi Karedog:

    Thank you so much for such a great help.
    This is far better then lots of formula's and it was slowing down.
    Love it and will do more testing and will contact you if any further issue or help is needed.

    Once again Thanks

    Riz

  20. #20
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Summarize Data

    You are welcome, glad I can help.


    Regards

+ 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. Looking for help to summarize data
    By hp801 in forum Excel General
    Replies: 4
    Last Post: 02-02-2014, 08:59 PM
  2. Summarize Data from one tab to another
    By tdorsi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2011, 12:13 AM
  3. Summarize Data
    By kgsggilbert in forum Excel General
    Replies: 1
    Last Post: 06-08-2005, 05:05 PM
  4. Summarize data
    By blstone in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-11-2005, 06:06 PM
  5. Summarize Data Set
    By Jim in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-07-2005, 11:06 AM

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