+ Reply to Thread
Results 1 to 5 of 5

Subtract from one column until zero, then another, than another.

  1. #1
    Forum Contributor
    Join Date
    12-02-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    152

    Subtract from one column until zero, then another, than another.

    Hello and thanks for taking the time to read this.
    I am trying to figure out of there is a way to subtract from one column until that reads zero then move onto another. So, this is for accounting where there are non taxable, taxable, and tax costs in separate columns and I am trying to see if I can input a number into one cell that will pay, first, to the non taxable costs, then taxable, then tax. I am not sure if I am explaining this adequately as I am not great at this but I am attaching a workbook that will hopefully clear it up.
    If there are any other questions I will gladly try to answer.

    Thanks in advance.
    Thomas
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Subtract from one column until zero, then another, than another.

    Looks like J3 and K3 are reversed. If so, and were corrected,

    J5: =MAX(0,E5-I5)
    K5: =MAX(0,F5-MAX(0,I5-E5))
    L5: =MAX(0,G5-MAX(0,I5-SUM($E5:F5)))
    M5: =H5-I5

    Select J5:M5 and fill down.

  3. #3
    Forum Contributor
    Join Date
    12-02-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Subtract from one column until zero, then another, than another.

    Thank you hrlngrv,
    You were correct, I had the second set of categories swapped. That does exactly what I was asking for, the problem is I was asking the wrong question.... When I put this into my test page (where I am building an accounting sheet) I realized that I need exactly the opposite of what I asked for. Instead of leaving a remainder is it possible to show what was actually paid to each category?

    Attached is a new workbook reflecting what I actually need......


    Thanks.
    Thomas
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Subtract from one column until zero, then another, than another.

    You changed starting row, but that's not a big deal. You added other columns, but that's NBD.

    Note: you have a typo in O12 that propagates into P12.

    M4: =MIN(L4,G4)
    N4: =MIN(H4,MAX(0,L4-G4))
    O4: =MIN(J4,MAX(0,L4-SUM(G4:H4)))
    P4: =L4

    Do you really need column P except as a check that the sum of columns M to O match column L?

    The main point here is that when balance remaining is given by =MAX(0,starting_balance-payment), then payment applied is given by =MIN(starting_balance,payment).

  5. #5
    Forum Contributor
    Join Date
    12-02-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Subtract from one column until zero, then another, than another.

    Looks like that does it. I apologize for adding into the workbook, it is, as they say, a work in progress but I hope that didn't cause too much confusion. Thanks for pointing out the typo, it's just a tester currently but that stuff bugs me. The P column was only there for a self check (which obviously didn't work as I still had the wrong figure in O12).

    I've got some other issues with this workbook that I am trying to build but I like to try to figure things out on my own first. I'd say this one is solved. Thanks again for you help.

    Thomas

+ 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. Subtract values from Column B but only when matching criteria in Column A
    By dtpunshon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-12-2020, 06:25 AM
  2. Replies: 1
    Last Post: 12-28-2015, 08:43 AM
  3. Replies: 7
    Last Post: 11-13-2014, 04:46 PM
  4. Formula to subtract 7th column values from the column before the 1st (loop)
    By saya_26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2014, 09:13 AM
  5. VBA code to Subtract values in Column F with Column E if found non-blank
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 04:34 AM
  6. [SOLVED] Subtract value in a column when a certain range in crossed in another column
    By DexterG in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-10-2012, 06:06 AM
  7. [SOLVED] find max in column then subtract number til 0 from column
    By carden2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2012, 10:58 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