+ Reply to Thread
Results 1 to 19 of 19

Running total VBA

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Exclamation Running total VBA

    I am creating a spreadsheet for inventory use. I want to have a running total in (1) cell based upon a new/different number being entered into a different cell.

    Column B, Row 1 (This will be a new/different number entered every day - inventory in or out, so positive or negative number)
    Column D, Row 1 (This will be a running total based on numbers inserted in previous 2 columns)

    Basically what I have is a key inventory. So there is column A with key number, B should be keys IN, C should be keys OUT, or ideally B would be IN and OUT meaning, for inventory IN input a positive number and for inventory OUT input a negative number, and D Should be total.

    Column E represents number of keys currently in the inventory. I was going to hide the current inventory column so all you see is IN/OUT and total.
    So what I need is to be able to just come in and type in a number in the IN and/or OUT column, without having to add/subtract it with the number already in that column.

    Bottom line, I’d like to be able to use IN and/or OUT columns to just type in numbers as they come and not have to worry about what’s already in those columns and get correct total number.

    Can someone please help me with this?

    Thanks!


    Ok here it is. Attached worksheet shows
    Column A - Key Numbers...No data value
    Column B - Inventory IN
    Column C - Inventory OUT
    Column D - Total
    Column E - Current Inventory(Starting point)

    So the formula I used to get what i currently have is (=B2-C2+E2). This way whatever i input in columns C and C. totals out in D. But this way every time I want to add/subtract a number in B and C, i have to add to the number already in the column. I'd like to be able to type in a number in B and C as i go and still have a correct total. I wouldn't mind having just one column for in/out and use positive and negative numbers to differentiate inventory in or out.

    I hope this makes sense. Thanks
    Key Inventory - Test.xlsx

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    re: Running total VBA

    I took a different direction....I redid your data....now you can enter the key number, the date (Cntl+Semi-colon) and the transaction amount (Qty). You just keep adding to the that. Then the pivot table that is setup, all you have to do refresh and all your amounts are updated and you can group by months/years on the date column....this may not be what you are looking for, but I hope it helps. If nothing else to give a different look....have fun....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    re: Running total VBA

    * Thank you so much! I'll try this!

  4. #4
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    re: Running total VBA

    Quote Originally Posted by judgeh59 View Post
    I took a different direction....I redid your data....now you can enter the key number, the date (Cntl+Semi-colon) and the transaction amount (Qty). You just keep adding to the that. Then the pivot table that is setup, all you have to do refresh and all your amounts are updated and you can group by months/years on the date column....this may not be what you are looking for, but I hope it helps. If nothing else to give a different look....have fun....
    * Thank you so much! I'll try this!

  5. #5
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    re: Running total VBA

    @judgeh59, @TMS I am sorry if i created a problem. I was told that this was a different thread problem so I copied it to a different/more appropriate forum thread. I still haven't gotten an answer i'd like so you are not wasting your time. Again, I apologize if i am creating confusion.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    re: Running total VBA

    I appreciate your frustration. However, ...

    If you had marked the original thread as Solved, or if you had provided links to the other threads, everyone would be aware that others might be working on a solution for you. You now have at least three people involved, independently, in trying to answer your question. That is wasting time and effort ... not least of all yours. It's all the same people looking at this stuff.

    You didn't need to start a new thread, although I understand you might have thought that was what I was suggesting. Just saying that a VBA solution was acceptable would have been enough. Lesson for the future, for both of us. I should maybe just have asked the question
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    re: Running total VBA

    Quote Originally Posted by TMS View Post
    I appreciate your frustration. However, ...

    If you had marked the original thread as Solved, or if you had provided links to the other threads, everyone would be aware that others might be working on a solution for you. You now have at least three people involved, independently, in trying to answer your question. That is wasting time and effort ... not least of all yours. It's all the same people looking at this stuff.

    You didn't need to start a new thread, although I understand you might have thought that was what I was suggesting. Just saying that a VBA solution was acceptable would have been enough. Lesson for the future, for both of us. I should maybe just have asked the question
    Again, I am sorry for the confusion. I am new on here and confused myself at what i am supposed to do. Thanks for your input, I appreciate it and as you said, good lesson for future. Thanks again.

  8. #8
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Running total VBA

    Quote Originally Posted by judgeh59 View Post
    I took a different direction....I redid your data....now you can enter the key number, the date (Cntl+Semi-colon) and the transaction amount (Qty). You just keep adding to the that. Then the pivot table that is setup, all you have to do refresh and all your amounts are updated and you can group by months/years on the date column....this may not be what you are looking for, but I hope it helps. If nothing else to give a different look....have fun....
    Thank you for your input, but unfortunately this is not what i need.
    What i need is very minimal... I need to know how to make it where when i insert a number in a designated column the total updates accordingly.
    The column i insert the number into, needs to be just independent if that makes sense, meaning, i can input numbers and next time input another one over it and it will still update my total regardless of what was in that column previously. So I need start inventory column, ever-changing column to input inventory in and out, and a total that gets updated as the numbers are imputed.

    This is a key inventory where we are constantly taking keys in and out of inventory and i just need to be able to go in the spreadsheet and type in one in, 2 out for example and go on....

    Is this something you could help me with? Is it even possible?

    Thanks.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    Re: Running total VBA

    You were given an answer in one of your other threads based on my suggestion of a VBA Worksheet Change Event handler.

    Whilst I can understand your desire for a simple input mechanism, the solution you are seeking provides no audit trail. It would be very simple to input a value twice and you would have no record if you had "double hit". I would advocate a) clearing the input after entry and b) logging the transactions in a separate audit sheet. Blanking the input fields would prevent inadvertent duplicate input, though clearly it would not stop manual re-keying. The transactions could be date and time stamped to give a record which would help to identify any anomalies.

    Regards, TMS

  10. #10
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,712

    Re: Running total VBA

    Does not the simple auto sum do the work

    This is not an expert by expert though

    Find attached , feed details on sheet 2 and sheet one is auto
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,712

    Re: Running total VBA

    Though it way beyond simple , but it does the work as to its simplest extreme ?

  12. #12
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Running total VBA

    Quote Originally Posted by makinmomb View Post
    Does not the simple auto sum do the work

    This is not an expert by expert though

    Find attached , feed details on sheet 2 and sheet one is auto

    No, that doesn't work because i want to be able to input numbers in IN/OUT column without depending what's already in there.
    So, have a start number column, IN/OUT column that is pretty much a blank column and whatever you input in adds to the current total regardless of the previous number entered, and then have a total column in which numbers change/update according to IN/OUT column input.

    Bottom line, i just want to be able to come in type in 3 keys IN, 6 OUT, and the total updates without me having to add/subtract from what's already in that column.

    I hope that makes sense.

    Thanks.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    Re: Running total VBA

    OK, I'm not hugely comfortable about this but, as you asked so nicely, here you go ...

    Please Login or Register  to view this content.

    Please see the attached updated workbook. Note that it is now a macro enabled workbook.


    Regards, TMS
    Attached Files Attached Files
    Last edited by TMS; 04-15-2014 at 07:08 PM.

  14. #14
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Running total VBA

    Quote Originally Posted by TMS View Post
    OK, I'm not hugely comfortable about this but, as you asked so nicely, here you go ...

    Please Login or Register  to view this content.

    Please see the attached updated workbook. Note that it is now a macro enabled workbook.


    Regards, TMS
    OMG! This is awesome! Thank you sooooooooooooooooooooooo much!
    This is exactly what i needed! You are awesome!
    Thank you, Thank you, Thank you!

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    Re: Running total VBA

    You're welcome. Thanks for the rep.

    Guess I can mark this one down as a success then



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  16. #16
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Exclamation Re: Running total VBA

    TMS.....You are going to kill me...... I need your help one more time please?
    What you gave me works amazing, but i don't understand macros and i am not sure how to apply what you made to the rest of the sheet.
    Can I add 3 macros? Please see attached.
    Attached Files Attached Files

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    Re: Running total VBA

    Always a problem when you over-simplify the requirement


    Please Login or Register  to view this content.

    Regards, TMS
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    03-27-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Running total VBA

    Thank you very much! Sorry to bother you again!

  19. #19
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,411

    Re: Running total VBA

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Pivot Chart Running Total - Removing Current Year Future Total
    By car3489 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 07-27-2013, 03:35 AM
  2. [SOLVED] Grand Total and Running Total Together!
    By simon123 in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 12-06-2012, 06:43 AM
  3. Running total of multiple running totals
    By ashncg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2011, 05:20 PM
  4. Summing total & running total?
    By jackiejackie in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 12-14-2008, 02:19 PM
  5. % of Running Total to Grand Total in Pivot Table
    By David in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2005, 04:05 PM

Tags for this Thread

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