+ Reply to Thread
Results 1 to 18 of 18

if formula that keeps subtracting in a range of values

  1. #1
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    if formula that keeps subtracting in a range of values

    I want to use an if formula that keeps subtracting monthly sales (not average) until stock cover = zero



    Closing Stock Closing Stock Cover Months (not average) Jan-17 Feb-17 Mar-17 Apr-17

    72,074 127 12 13,186 7,961
    369 28 150 675 195

    i need to know how many months would each item covers by subtracting the sales of every month with 18 months available

    thank you

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: if formula that keeps subtracting in a range of values

    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.
    Quang PT

  3. #3
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    this is the file i want to work on.
    rolling forecast data is available along with stock and item codes

    thank you
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    No data ??!!!

  5. #5
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    sorry for the inconvenience
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    You will either need to use "helper" columns OR VBA to calculate the cumulative monthly totals.

  7. #7
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    yes i know that, can you help me with it ?

    i have tried but this is my first time using vba

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    Please Login or Register  to view this content.
    =months_cover($B4,$D4:$O4)
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    what if i want the formula to read from cell A1 where i include the month and to calculate based on the forecast of the next month onwards ?

    i dont want the formula to stop at 12 months

    maybe i add the next year forecast and want to include it in the formula, should i expand the range ?

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    Simply extend the highlighted range

    =months_cover($B4,$D4:$O4)

    in VBA change

    Months_Cover = 12


    to required number of months if ample stock.

    If you are going to use the month in A1 then set all the dates in D3 onward to be excel dates formatted as "mmmm" (otherwise if you have more than a year's data we won't know which month/year).

    This also requires changing in you require the range to be dynamic based on A1

    =months_cover($B4,$D4:$O4)

  11. #11
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    so you suggest every month i update the file i adjust the range to match my needs

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    First, set the dates in row 3 to Excel dates for as long a period as you require (1 year, 2 years ...choice is yours).

    You can then base the range to be selected by starting at the date in A1 and continuing for as many months as you require.

    It is your choice as how you manage this.

  13. #13
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    thank you very much for your support and help.

    i will get back in case i needed any additional info.

    you got me a real solution hear

    God bless you

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    Attached has an example:

    =months_cover($B4,$O4:INDEX($D4:$O4,,MATCH($A$1,$D$3:$O$3,0)))

    I would also move the Total Qty/ Total Price columns to columns D & E, so your monthly data starts in F and you then have an "infinite" range. (F4:XFD4)
    Attached Files Attached Files
    Last edited by JohnTopley; 04-28-2018 at 04:23 PM.

  15. #15
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    hi, sorry to disturb again.

    the formula is showing 12 when the stock is higher than rolling forecast in range, is there any solution it doesn't show like that ?

  16. #16
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: if formula that keeps subtracting in a range of values

    In "R4"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: if formula that keeps subtracting in a range of values

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    04-23-2018
    Location
    Lebanon
    MS-Off Ver
    2017
    Posts
    10

    Re: if formula that keeps subtracting in a range of values

    mmmm

    thank you.

    this would do well i guess.

    i will get back if i need anything.

    thank you guys for he 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. Replies: 2
    Last Post: 09-06-2015, 12:03 AM
  2. [SOLVED] Subtracting values
    By BradleyN1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-16-2013, 12:34 PM
  3. formulae for subtracting a value from different values
    By semeer in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-29-2013, 08:55 AM
  4. [SOLVED] subtracting based on available values
    By Ted Metro in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  5. [SOLVED] subtracting based on available values
    By Ted Metro in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. [SOLVED] subtracting based on available values
    By Ted Metro in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. What formula is used for subtracting a range of different cells f.
    By tim in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2005, 06:06 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