+ Reply to Thread
Results 1 to 10 of 10

inv - demand = excess - vba to calculate

  1. #1
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    inv - demand = excess - vba to calculate

    Morning/ afternoon all

    Looking for some help in created a excess statement. I have multiple parts in inventory at different dates and I have a demand statement. I want to automatically reduce the inventory based on demand to give me excess.

    The probelm is I have mutiple Inventory of the same part number and I need to count each one down until demand is covered - if that makes sense


    for example if I have part number A with 3 entires qty: 1, 5 , 9 and a demand of 2 : the excess for that should read 0, 4, 9


    Appreciate if anyone could help.

    Thanks

    P.S couldnt attach sample file

    https://www.excelforum.com/attachmen...1&d=1528979536
    Attached Files Attached Files
    Last edited by cmcconna; 06-14-2018 at 08:33 AM. Reason: trying to attach file

  2. #2
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: inv - demand = excess - vba to calculate

    Did you have a problem uploading a file?
    Perhaps it was too big.
    You should make a sample file with a few records, the problem and the expected result in a certain cell.
    A sample workbook could do so much more if help is needed.
    Even a little help can be a big help !!
    1. A sample workbook says more then words. Add problem description and solution so we can understand the problem.
    2. Your appreciation is accepted by clicking the star "Add Reputation" at the lower left of the post.
    3. If your problem is solved, mark it as [SOLVED]: See "FAQ : " https://www.excelforum.com/faq.php
    4. Use [CODE] [/CODE] tags to illustrate your code: see here

  3. #3
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Re: inv - demand = excess - vba to calculate

    Yeah I have that for reference, however when I clicked on the attachment button only a long blank box appeared. so I couldnt upload it.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: inv - demand = excess - vba to calculate

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Re: inv - demand = excess - vba to calculate

    Quote Originally Posted by davsth View Post
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    File there now cheers

  6. #6
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Re: inv - demand = excess - vba to calculate

    Any help on this one would eb much appreciated.. Thanks

  7. #7
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: inv - demand = excess - vba to calculate

    cmcconna,

    I hope i found a solution to your problem.
    I attached your modified file with extra VBA code.

    I added a function from CPearson to find all matching cells within a range.

    http://www.cpearson.com/excel/findall.aspx

    And i took the testcode also from Cpearson to get things working.

    See the code in the VBE editor.

    Test the file by changing the values in cells F2:F5.
    The result should be as requested.
    THe only thing you should think about is, when a demand is greater then the parts stock.

    Hope this helps.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Re: inv - demand = excess - vba to calculate

    MarMo - Many Thanks

    Tried running the script but getting a " Method Range Of Object_Global failed" error when it reached
    Please Login or Register  to view this content.
    TargetCell is declared as public so Im not sure why this isnt running?


    Please Login or Register  to view this content.

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

    Re: inv - demand = excess - vba to calculate

    UDF

    C2
    =Excess(A2,$E$1:$F$5,A$2:B2)

    and copy down

    To a Standard Module
    Please Login or Register  to view this content.
    Last edited by jindon; 06-18-2018 at 07:49 AM.

  10. #10
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Re: inv - demand = excess - vba to calculate

    Thanks guys for the info.

+ 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 Average Demand Intervall (ADI)
    By IndigoSK in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-18-2018, 06:20 AM
  2. Formula to calculate demand intervals
    By fabian_andrew in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-07-2017, 12:44 PM
  3. [SOLVED] Calculate Defined Weekly Demand Based on Current Date
    By d_striker in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-09-2013, 03:24 PM
  4. How to calculate days of supply given variable demand per month
    By hkaushal in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-14-2013, 10:31 AM
  5. SEL On Demand
    By Berrywoods in forum Excel General
    Replies: 4
    Last Post: 02-16-2010, 05:02 PM
  6. Fomula to calculate supply vs Demand - Stock
    By Achard in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 09-17-2008, 02:13 PM
  7. [SOLVED] Calculate the intersection of supply and demand curve
    By Angus in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-04-2005, 11:06 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