+ Reply to Thread
Results 1 to 9 of 9

Cumulative total in single cell

  1. #1
    Registered User
    Join Date
    10-05-2015
    Location
    Alburgh, VT
    MS-Off Ver
    2010
    Posts
    5

    Cumulative total in single cell

    Hi,
    I have been struggling with an issue for about one week, I'm reaching out to others to find a solution. I am trying to link data from one worksheet to another and create a cumulative total in a single cell. Cell F4 represents the progress of a particular job on my master production schedule (ie: if item X has run 40,000 units out of 100,000 scheduled, F4 will read 40,000). Currently, F4 is being updated manually, each shift adding their respective production to its total. To eliminate math errors and redundancy, I would like F4 to update automatically via inputs from each shift's production report located in another workbook (titled WEEKLY SUMMARYY). Due to production variables, item X is not always listed in the same cell from shift to shift on the individual production reports. Sometimes it is not listed at all. In order to skirt around this and still get the result that I need, I used the following formula in F4 (Shortened to show only one shift, the actual formula is a sum of 21 shifts)

    [=(IF(COUNTIF('[WEEKLY SUMMARYY (9) (2).xls]Monday'!$C$10:$C$37,C4)>0,INDEX('[WEEKLY SUMMARYY (9) (2).xls]Monday'!$K$10:$K$37,MATCH(C4,'[WEEKLY SUMMARYY (9) (2).xls]Monday'!$C$10:$C$37,0)),0)+IF(COUNTIF................]

    Where C4 is the cell that lists item X, C10:C37 is all of the items that ran for that particular shift, and K10:K37 is the respective production quantities for each item. C4 is located on the master schedule, C10:C37 and K10:K37 are located on the production report.

    The above works beautifully, with only one issue. On Monday morning the production reports are wiped clean, thereby making the total in F4 zero. I need help maintaining the total in F4 while eliminating the previous week's quantities in the production reports. I have searched through forums and found others solved this issue using VBA. However all examples were for cells with manual inputs, I attempted to replicate for my cell. All was well when I tested using manual inputs, but once I added the formula I received no results. I have tried everything that I can think of: Creating a circular reference to F4; Making F4 an IF function based on day of week and time of day in order to give myself a window to clear the production report...... Nothing is working out. Sorry for the book that I have written above, any help that could be offered would be appreciated.

    Thanks,

    Josh

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Cumulative total in single cell

    What is the procedure used on Mondays to clear the data? I'm assuming someone physically goes through and deletes the values. I see two options. 1) Update your formula to include the value of an accumulation cell somewhere. Then, before clearing the data on Mondays, copy the current value of f4 to the accumulation cell (replacing the existing value), or 2), use VBA to copy the value and clear the data so it could all be done with a single button click.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    10-05-2015
    Location
    Alburgh, VT
    MS-Off Ver
    2010
    Posts
    5

    Re: Cumulative total in single cell

    You are correct, the data is cleared manually on Mondays. I have considered a process similar to what you have laid out in option 1. I am holding on to that as a last resort, however, as I would like to eliminate as many manual operations as possible. Option #2 is more what I am looking for, but I don't really know how to write the code to create this shortcut. My excel knowledge is more or less self taught and I have never encountered the need for VBA (or perhaps my ignorance toward the usefulness of VBA has led me to work without it??) Can you help with the code please?

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Cumulative total in single cell

    The easiest way would be to just start the macro recorder, go through your clearing steps, then stop the recorder. Plan your steps out in advance to avoid wasted motions. Even then, it's going to add a lot of unnecessary garbage. Start with that, though. Then paste the code here (used code tags please), and I'll help you with cleaning it up. You don't need to include the accumulation cell piece at this point, but let me know where it will be.

  5. #5
    Registered User
    Join Date
    10-05-2015
    Location
    Alburgh, VT
    MS-Off Ver
    2010
    Posts
    5

    Re: Cumulative total in single cell

    OK.... Here is the code to clear out the variables (shortened to show clearing out Monday only)

    Please Login or Register  to view this content.
    Accumulator cells will go in column R, starting at R4.
    Heading out for the day, thanks for helping me get started with this. I'll check back tomorrow.

  6. #6
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Cumulative total in single cell

    This should do it.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-05-2015
    Location
    Alburgh, VT
    MS-Off Ver
    2010
    Posts
    5

    Re: Cumulative total in single cell

    OK, that works well within a single workbook, but the accumulator cell and the data to be cleared are located in different workbooks. I tweaked the code as follows and received these messages after an unsuccessful test:

    Run-time error '1004'
    Method 'Range' of object'_Global' failed

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Cumulative total in single cell

    Ok, I made adjustments. This is assuming that the code module and the R4 and F4 cells are in the "Master" workbook, from which you will be running the code, and that "Workbook1" is already open. Adjust the workbook and sheet names as needed.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-05-2015
    Location
    Alburgh, VT
    MS-Off Ver
    2010
    Posts
    5

    Re: Cumulative total in single cell

    Perfect! Still needs a little bit of tweaking to get it to do exactly what I want, but I can handle it from here. Thank you so much for your help!

+ 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. Calculate cumulative total based on given number in cell
    By channguyen in forum Excel General
    Replies: 5
    Last Post: 10-02-2015, 04:44 AM
  2. Cumulative Total
    By laura1812 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-23-2014, 06:03 PM
  3. [SOLVED] 1 Cell to Formulate Cumulative Total Excluding Top & Bottom 10%
    By benishiryo in forum Excel General
    Replies: 6
    Last Post: 10-05-2012, 09:18 PM
  4. Cumulative Total with Single Data Entry
    By George Cooper in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2011, 03:31 AM
  5. Cumulative Total with Single Data Entry
    By Infman in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-07-2009, 09:56 AM
  6. [SOLVED] Cumulative Total
    By Paul Black in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-15-2006, 12:30 AM
  7. [SOLVED] in the one cell add 5+13+22+6+ to get cumulative total each time?
    By hirsch in forum Excel General
    Replies: 2
    Last Post: 04-16-2006, 06:00 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