+ Reply to Thread
Results 1 to 8 of 8

VB Code to consolidate 2 days of data

Hybrid View

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

    VB Code to consolidate 2 days of data

    Hello:

    Please refer to attached file.
    I have 2 days of data as shown in Sheet2, Column A thru C for Day1 and Column E thru F for Day2
    I need VB Code to combine the 2 dyas in column I thru K.
    I feel the best way would be to find unique list by combining column A and E and paste unique list at cell I4.
    Then add corresponding items from column B and E in column J, add corresponding items from column C and G in column K.

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VB Code to consolidate 2 days of data

    Can you attach another sheet showing the complete result you are expecting?

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

    Re: VB Code to consolidate 2 days of data

    Hello John:

    Please refer to attached file.
    I have manually added few data as shown.
    Let me know if you have any questions.
    Thanks.
    Attached Files Attached Files

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

    Re: VB Code to consolidate 2 days of data

    @ Alkey

    Hi there...Does OP perhaps want the Totals of all above as well?
    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!!!

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: VB Code to consolidate 2 days of data

    It could've been done with two short formulas
    Enter in J15
    Formula: copy to clipboard
    =SUMIF(A:A,I15,B:B)+SUMIF(E:E,I15,F:F)

    and in K15
    Formula: copy to clipboard
    =SUMIF(A:A,I15,C:C)+SUMIF(E:E,I15,G:G)
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

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

    Re: VB Code to consolidate 2 days of data

    Hi Rizmomim

    Does it have to be code or will a array formula suffice
    This in J4 and copy down
    Formula: copy to clipboard
    =SUM(IF($A$4:$G$18=$I4, $B$4:$G$18, 0)) 
    CTRL + SHIFT + ENTER
    And This in K4 and copy down
    =SUM(IF($A$4:$G$18=$I4, $C$4:$G$18, 0))
    CTRL + SHIFT + ENTER
    Attached Files Attached Files
    Last edited by Sintek; 04-14-2017 at 09:07 AM. Reason: Added sample result file

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: VB Code to consolidate 2 days of data

    There is a better way than the one suggested earlier
    For calculation in Col J and K enter formula in J4 and copy across and down.
    Formula: copy to clipboard
    =SUMIF($A:$E,$I4,B:F)

    then for the TOTAL SALE enter in J15 and copy across to K15
    Formula: copy to clipboard
    =SUMIF($A:$E,$I15,B:F)

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

    Re: VB Code to consolidate 2 days of data

    Hello Alkey:

    Thanks a lot...seems to work.
    Will let you know if any problem..
    Thanks
    Riz

+ 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. need macro code or any function to consolidate the data with counts
    By girishhb in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-26-2014, 12:17 PM
  2. Code to consolidate data on a single tab
    By alchavar in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-31-2013, 12:24 PM
  3. [SOLVED] Macro to consolidate entries from days to weeks
    By Seraph122 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-09-2013, 05:41 PM
  4. [SOLVED] HELP With VBA Code to consolidate lines of data using an identifier
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 07-27-2012, 11:09 AM
  5. VB Code to Consolidate data from different files / tabs
    By tt388 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-29-2011, 11:53 AM
  6. Excel 2007 : How to consolidate same days and total revenue?
    By techboy2011 in forum Excel General
    Replies: 5
    Last Post: 04-12-2011, 03:30 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