+ Reply to Thread
Results 1 to 10 of 10

Sum cell values into another sheet IF values in cells from two sheets match

  1. #1
    Registered User
    Join Date
    01-25-2018
    Location
    Southeast
    MS-Off Ver
    2016
    Posts
    19

    Sum cell values into another sheet IF values in cells from two sheets match

    For simplification I have two sheets in a workbook. I have a product ID in col A for both sheets.

    In Sheet(1) I have a Qty ordered adjacent to the product ID. I wish to sum all the Qty(s) for a product ID into sheet(2) in the cell adjacent to the same product ID.

    The selection of data in Sheet(1) will change with each processed order that is appended to the first blank row. The solution will need to expand dynamically with data added to sheet(1) and include the new data into the total of the static sheet(2).

    MANY THANKS!!!


    Hopefully this helps with clarity:

    sheet1.PNG

    Sheet2.PNG

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Try this code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

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

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    1) To ThisWorkbook code module
    Please Login or Register  to view this content.
    2) To a Standard code module
    Please Login or Register  to view this content.
    3) Sheet2 code module
    Please Login or Register  to view this content.
    Will update automatically.

  4. #4
    Registered User
    Join Date
    01-25-2018
    Location
    Southeast
    MS-Off Ver
    2016
    Posts
    19

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Added reputation for your answer, thank you. I was unable to get the code to work for me however. Are there areas in your code other than the sheets("name") that I should change to suit my needs?

  5. #5
    Registered User
    Join Date
    01-25-2018
    Location
    Southeast
    MS-Off Ver
    2016
    Posts
    19

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Added reputation for your answer also Jindon. However, I was unable to get the code to work for me. Can you explain what changes I should make to allow it to work on my sheets, or explain how the three separate modules are supposed to work together?

    Thank you also

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

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Upload your workbook.

  7. #7
    Registered User
    Join Date
    01-25-2018
    Location
    Southeast
    MS-Off Ver
    2016
    Posts
    19

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Workbook attached. I've left the tab names as they are for the real sheet.

    What the code should do is look at the "Historical" tab and add all the Qty cells for a single product ID then place that Sum into the "Tallies" sheet in the adjacent cell to the same product ID in the Count column.

    The historical tab will change throughout each month as more data is added, and the tallies sheet will need to update with the updated data to create a total of all product IDs ordered in the Historical tab and sum them in the tallies sheet for the same ID.
    Attached Files Attached Files

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

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    No need of vba.

    Formula: C2 in 'Tallies' sheet

    =SUMIFS(Historical!C:C,Historical!A:A,A2,Historical!B:B,B2)

    then copy down.

  9. #9
    Registered User
    Join Date
    01-25-2018
    Location
    Southeast
    MS-Off Ver
    2016
    Posts
    19

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    Beautiful, thank you again Jindon!

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

    Re: Sum cell values into another sheet IF values in cells from two sheets match

    You are welcome and thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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] Match criteria between sheets and copy cell values to existing record in master sheet
    By Hirad001 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-05-2015, 04:28 PM
  2. Replies: 2
    Last Post: 11-21-2013, 10:01 AM
  3. Replies: 6
    Last Post: 09-13-2013, 01:29 AM
  4. Replies: 1
    Last Post: 04-11-2013, 01:02 PM
  5. Replies: 5
    Last Post: 02-21-2013, 07:17 PM
  6. Replies: 0
    Last Post: 01-23-2012, 02:49 PM
  7. Copy cell values if cells match on two diff sheets
    By dan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2006, 09:10 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