Closed Thread
Results 1 to 5 of 5

Subtract from one column first, then another if remainder

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Vermont
    MS-Off Ver
    Excel 2007
    Posts
    4

    Subtract from one column first, then another if remainder

    Hi y'all --- I've run into another Excel puzzle. I have a single number that I need to subtract from a series of numbers in the same row, rolling the remainder left from the first number over to the next number until the first number has been entirely subtracted out of the number series.

    Eg. Pre-calculation: columnA [] columnB columnC columnD
    300 10 200 300

    Post calculation:

    columnA [] columnB columnC columnD
    300 0 0 210

    Column A's value can be left there or deleted post calculation - it is not important once the calculation is done. I'd ideally like to use a series of formulas to do this instead of writing a macro. I have to give this to someone who is not a macro user.

    Any help/guidance/etc would be very welcome!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Subtract from one column first, then another if remainder

    You cant change what's already in a cell, with a formula in that same cell - you can either have a formula or text/value, not both.

    You could try this in the row below, copied across,,,
    =IF(SUM($B$1:B1)<$A1,0,SUM($B$1:B1)-$A1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    06-06-2013
    Location
    Vermont
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Subtract from one column first, then another if remainder

    Thank you so much! This totally pointed me in the right direction. I did some more playing around with conditional equations and found a combination that worked for my purposes. In column B I put: =IF(SUM($B8:B8)>=$A$8,SUM($B8:B8)-$A$8,0) and then in column C I put: =IF(B13<>0,C8,IF(SUM($B8:C8)>=$A$8,SUM($B8:C8)-$A$8,0)).

  4. #4
    Registered User
    Join Date
    10-21-2018
    Location
    toronto, Canada
    MS-Off Ver
    2007
    Posts
    1

    Re: Subtract from one column first, then another if remainder

    hi,
    I hv same kind of situation where i need to put the remainder if 1st one is not fulfill the demand then consider the 2nd one and keep on going until the remainder get 0. to get the 1st remainder i used the formula=IF(B13<0,0,B13-F13)here B13 is demand and F13 is 1st fillup unit.but cant proceed for the next step. looking for advise/suggestion to solve it.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Subtract from one column first, then another if remainder

    Rokshana Perveen welcome to the forum

    Unfortunately your post does not comply with Rule 4 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

Closed 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