+ Reply to Thread
Results 1 to 6 of 6

Subtracting column values based on another column having a date in it

  1. #1
    Registered User
    Join Date
    02-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    3

    Subtracting column values based on another column having a date in it

    DISCLAIMER: I am a complete noob. 24 hours into Excel and I have a decent inventory, accounts payable sheet going on. I want to find out what my outstanding balance to my Vendor is.

    I have a column for Date Paid To Vendor (Q), the data that goes in here is a date.
    I have a column for Individual Payment to Vendor (N)
    I have a column for Total Payout to Vendor (AC), which is the sum of all the money in column N


    What I want to do is this:
    Every time any cell from Q2-Q100 has a date in it, I want the payment in the corresponding column (N) to be subtracted from the Total Payout to Vendor (cell AC):

    Example: Payment to vendor happened on 2/9/12 (column Q) for 10.00 (column N). If the total balance was $100 (cell AC), when I enter the date into (Column Q) I want it to subtract the number in Column N from AC.

    I want this to happen anytime I enter a date into Column Q. So it should subtract any value in the corresponding N column and row.

    I tried to do this with the IF function, but it got me nowhere.

    I basically want to say IF Q is equal to a date, then minus the corresponding row in column N from the amount in column AC3.

    Any help would be greatly appreciated.
    Last edited by laptopgraveyard; 02-09-2012 at 11:01 PM. Reason: Poor Title

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Subtracting column values based on another column having a date in it

    Try, in your new column:

    =IF(Q2<>"",AC2-N2,"")

    copied down to row 100
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Subtracting column values based on another column having a date in it

    Thanks for the quick response. I will definitely use this as an example.. But I only want the sum of the equation happening in one cell. For instance the result should end up in AC5. How would I go about that?

    So to be more clear, I took your example and did this:
    =IF(Q:Q<>"DATE",AC3-N2,"SUM")..While it gave me the result, it only gave me the result for N2.

    That only gives me the result for one cell (N2) minus the Total I owe the vendor (AC3). I want a universal formula so that anytime I enter a date in column Q, it subtracts the corresponding value of that row from AC3..but as a total.

    So in other words if I have

    excel.jpg



    Because I have entered a date in Q3, it subtracts N3 from the total in AC3. And I want it to do that everytime I enter a date in Column Q. I also tried =IF(Q:Q<>"DATE",AC3-N:N,"SUM"), but that cancels itself out. Is what I am trying to do even possible?
    Last edited by laptopgraveyard; 02-09-2012 at 07:04 PM.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Subtracting column values based on another column having a date in it

    Put this array* formula in cell AC5:

    =AC3 - SUM(IF(P2:P100<>"",N2:N100))

    * An array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) rather than the usual <Enter>. If you do this correctly then Excel will wrap curly braces { } around the formula when viewed in the formula bar - do not type these yourself. If you need to amend the formula subsequently you will need to use CSE again.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    02-09-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Subtracting column values based on another column having a date in it

    Quote Originally Posted by Pete_UK View Post
    Put this array* formula in cell AC5:

    =AC3 - SUM(IF(P2:P100<>"",N2:N100))

    * An array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) rather than the usual <Enter>. If you do this correctly then Excel will wrap curly braces { } around the formula when viewed in the formula bar - do not type these yourself. If you need to amend the formula subsequently you will need to use CSE again.

    Hope this helps.

    Pete
    It worked! Thanks so much, you guys are geniuses! Now why did it work lol... So as I understand anytime you are doing anything that requires a range of cells to be computed it is an array formula? So this formula breaks down to:

    Subtract any value in N2 through N100 if P has any value in it from AC3? I would hate to just walk away with the right answer without understanding it.

    Thanks so much for the help guys.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Subtracting column values based on another column having a date in it

    Yeah, you seem to have got it.

    Please mark the thread as Solved, and you can also express your thanks by clicking the "star" icon in the bottom left corner of any post that has helped you.

    Pete

+ 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