+ Reply to Thread
Results 1 to 9 of 9

Use SumIF based on date in adjacent cell

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Cool Use SumIF based on date in adjacent cell

    HTML Code: 
    Lets say I have the above table. I am trying to find out payment dates which are one month (30 days) later than the invoice date. I basically want to operate on row by row basis. In the final column I wan to see the sum of all payments that were made late.

    I have tried this logic

    =SUMIF(C2:C7,">4/1/2012",A2:A7)

    which works for a fixed value. But I want to match it to invoice date next to it.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Use SumIF based on date in adjacent cell

    If invoice date is in D2 try like this

    =SUMIF(C$2:C$7,">"&D2,A$2:A$7)
    Audere est facere

  3. #3
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Use SumIF based on date in adjacent cell

    I tried that already it basically compares to fixed cell D2 which is not desired.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Use SumIF based on date in adjacent cell

    That will be the formula for row 2. If you drag the formula down the column then the D2 will change for each row.....

  5. #5
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Use SumIF based on date in adjacent cell

    Quote Originally Posted by daddylonglegs View Post
    That will be the formula for row 2. If you drag the formula down the column then the D2 will change for each row.....
    Ok this did not work as you said it but when I entered it Shift+Ctrl+Enter, it worked out of the blue. I guess you have to make it an array.

    I need a different solution though because I am emplementing this programatically, probably using SUMIFS

    Thanks for the help

    Correction

    It did not work. It still compares values to one Cell that is D2 even though I specified an array and it seem to give you a value when you enter shift+control+enter.
    Last edited by rocketscience; 05-02-2012 at 05:26 PM.

  6. #6
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Use SumIF based on date in adjacent cell

    Quote Originally Posted by rocketscience View Post
    Ok this did not work as you said it but when I entered it Shift+Ctrl+Enter, it worked out of the blue. I guess you have to make it an array.

    I need a different solution though because I am implementing this programatically, probably using SUMIFS

    Thanks for the help

    correction


    This did not work. It still compares the dates to one cell that D2 even with the array formula.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Use SumIF based on date in adjacent cell

    OK, perhaps I missed your intent, If you want to check if payment date (C2:C7) is more than 30 days after the invoice date (D2:D7) and if so add the amounts from A2:A7 for each row where the condition is met then try SUMPRODUCT like this

    =SUMPRODUCT((C2:C7-D2:D7>30)+0,A2:A7)

    In your example that looks like rows 2 and 6 would qualify so that formula will give the result 25+45 = 70, is that the expected result? If not can you explain what it should be?

  8. #8
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Use SumIF based on date in adjacent cell

    Quote Originally Posted by daddylonglegs View Post
    OK, perhaps I missed your intent, If you want to check if payment date (C2:C7) is more than 30 days after the invoice date (D2:D7) and if so add the amounts from A2:A7 for each row where the condition is met then try SUMPRODUCT like this

    =SUMPRODUCT((C2:C7-D2:D7>30)+0,A2:A7)

    In your example that looks like rows 2 and 6 would qualify so that formula will give the result 25+45 = 70, is that the expected result? If not can you explain what it should be?

    Yes this did it. Thanks!

  9. #9
    Registered User
    Join Date
    04-24-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Use SumIF based on date in adjacent cell

    Can you please explain what is the meaning of +0 in the expression. With out it, it does not work. Displays 0 value.

    =SUMPRODUCT((C2:C7-D2:D7>30)+0,A2:A7)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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