+ Reply to Thread
Results 1 to 11 of 11

Creating a macro to add and subtract from a standing count

  1. #1
    Registered User
    Join Date
    08-04-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    5

    Creating a macro to add and subtract from a standing count

    Hello. First off, I wanted to say that my knowledge of excel is very limited and I have nearly no experience with programming.

    That being said, i'll try to explain what i'm trying to do.

    I'm building a spreadsheet for work to better control a portion of our inventory and streamline workflow. We produce baked goods and ship nationally, so we can't allow our kitchen to bake a large amount....I just realized all of this is unnecessary information.

    Anyways, please see the picture attached.

    I'm trying to create a button where the black area is. The items in the "C" and " i " columns will be entered by a user. Items in the "C" column will be subtracted from items in the "F" column when the button is pressed, and items in the " i " column will be added to items in the "F" column when the button is pressed.

    If someone is willing to help with this issue or to point me towards some easily understood how-tos, i'd be very grateful. thank you.
    Attached Images Attached Images

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Creating a macro to add and subtract from a standing count

    Hi, it would be much easier to help if we could see a sample workbook. That would eliminate a lot of guesswork ...

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Creating a macro to add and subtract from a standing count

    Looking at your JPG I get a feeling that the design of this is going in the wrong direction. What happens to historic data? Where is your trail of stock going out and coming in? What happens when the user enters a number but forgets to hit the button to recalculate and then enters another number?

    What you show in your JPG should at best be a summary table of data that is being held elsewhere. You should have a table for your transactions where you enter date, product type, number coming in, number going out, and calculate the running balance from that. With a layout like that you can trace your data back in time and will be able to find data entry errors (and there WILL be those!)

  4. #4
    Registered User
    Join Date
    06-19-2009
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Creating a macro to add and subtract from a standing count

    I agree with Teylyn. What you describe is feasible, but I think it's dangerous.

    If I understand correctly, what you are trying to do is this. You have a stock at the beginning of the day, and during that day you add orders, and re-stock, and you want to keep track of the stock level.

    I would do something along these lines: 1 sheet for the new orders received, where you list them as you receive them, 1 sheet where you list the restocking, and a 3rd sheet where you do the sum of orders received by item, orders restocked, and show that together with your initial stock.

    My 2 cents!

  5. #5
    Registered User
    Join Date
    08-04-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    5

    Re: Creating a macro to add and subtract from a standing count

    Ha, i was actually going to ask for some advice on how to show a history of items added and subtracted, but I thought that would be too much for my first post. From the sounds of it, that would be a lot of information to type up for a new excel user. Do you know where I can find a good how-to for that type of work?

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Creating a macro to add and subtract from a standing count

    Hi,

    I've attached a quick and dirty Excel solution for you to study.

    The Overview tab is just that: an overview.

    Data is entered on the data tab.

    The workbook uses dynamic ranges, which are defined usind the OFFSET function (and do not show up when you press F5 - GoTo, but only when you click Insert - Names - Define). There are 4 dynamic ranges applied to the first four columns of the data list.

    The daily booking summary on the overview tab uses the SUMPRODUCT function to add up bookings for a particular day for a particular product.

    The data tab uses the List functionality of Excel, which makes it easy to add new lines of data and also copies the formulas into new rows.

    The rest of the formulas are pretty straightforward.

    I've put in explanatory comments, so please study the workbook.

    Hope this'll give you a starting point.

    cheers
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-04-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    5

    Re: Creating a macro to add and subtract from a standing count

    Thank you very much for the guide. I'll try to research the commands as much as possible before I come back here with a question. Thanks again, i'll let you know how it goes.

  8. #8
    Registered User
    Join Date
    08-04-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    5

    Re: Creating a macro to add and subtract from a standing count

    By the way, I saw you're from NZ. I just got back a little bit ago and this was one of the things I had on my list after my vacation. Mind if I ask where you're from? I spent a lot of time around Wanaka, Nelson and Whangarei with brief excursions in between. Not relevant to the help i'm asking for or the help you're providing, but I had to ask after checking to see who spent all that time showing me some excel tips.

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Creating a macro to add and subtract from a standing count

    I live in New Plymouth. It's in the Taranaki region, the blob that sticks out on the West coast of the North Island. Check out my blog for pictures of the mountain.

  10. #10
    Registered User
    Join Date
    08-04-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    5

    Re: Creating a macro to add and subtract from a standing count

    Very nice. Dont believe i ever made it over there.


    Is there any way i can email you a copy of the spreadsheet i'm working on? The one I posted was mainly just to convey the idea of what i was trying to do. The spreadsheet i'm working on doesn't have any sensitive data, I would just rather not post it on a forum.

    I don't want to take up too much of your time, but maybe if you show me how to implement these formulas into a cell or two on my spreadsheet, it'll 'click' with me a little better.

  11. #11
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Creating a macro to add and subtract from a standing count

    I'll send you a private message with my email addy

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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