+ Reply to Thread
Results 1 to 13 of 13

conditional sum derived from a date interval

  1. #1
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    conditional sum derived from a date interval

    Hi,

    I'm trying to sum each months visa purchases. The data is in three columns: date,value and payment type.

    I can't get this formula to work:-

    {=SUM(IF(AND(Purchases!C6:C999>DATE(2009,12,28),Purchases!C6:C999<DATE(2010,1,29)),IF(Purchases!K6:K999="Visa",Purchases!H3:H999)))}


    It's returning a value of 0 (and if that were true I'd be delighted!)

    Thanks in advance.
    Last edited by tghcogo; 02-22-2010 at 03:25 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: conditional sum derived from a date interval

    If you don't want to use a CSE formula then how about...

    =SUMPRODUCT(--(C6:C10>DATE(2009,12,28)),--(C6:C10<DATE(2010,1,29)),--(K6:K10="Visa"),H6:H10)
    Last edited by jeffreybrown; 02-21-2010 at 09:53 PM.

  3. #3
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    Thanks for the suggestion, but it won't work, I don't mind CSE, that's not an issue,

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: conditional sum derived from a date interval

    I still think Rocky has the right idea, though not the right formula:

    =SUMPRODUCT(--(C6:C999>DATE(2009,12,28)), --(C6:C999<DATE(2010,1,29)), --(K6:K999="Visa"), H6:H999)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: conditional sum derived from a date interval

    Try...

    =SUM(IF(Purchases!C6:C999>DATE(2009,12,28),IF(Purchases!C6:C999<DATE(2010,1,29),IF(Purchases!K6:K999="Visa",H6:H10))))

  6. #6
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    Thanks for the quick response, unfortunately for some reason that still gives a zero value!

    This relates to JBeaucaire's reply , you guys are too fast, I'll try Rocky1's now
    Last edited by tghcogo; 02-21-2010 at 10:00 PM.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: conditional sum derived from a date interval

    Post up a workbook with usable sample data showing the formula not working for you.

    Click GO ADVANCED and use the paperclip icon to post up your workbook.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: conditional sum derived from a date interval

    It works for me...

    =SUM(IF(Purchases!C6:C999>DATE(2009,12,28),IF(Purchases!C6:C999<DATE(2010,1,29),IF(Purchases!K6:K999="Visa",Purchases!H6:H999))))

    If you cut and paste the formula I posted look at the end...H6:H10 should be Purchases!H6:H999

  9. #9
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    Thamks, but taking out the AND doesn't seem to work either.

    (wanders off scratching head)

  10. #10
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    Thanks Rocky, I have been cutting and pasting and CSE

  11. #11
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    @JBeaucaire I'll post a sample tomorrow, I'm going to bed now, IT's 2.00am here Waaaaah!

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: conditional sum derived from a date interval

    The formula is not CSE. SUMPRODUCT() is already an array function, so not typical to need to CSE on it.

  13. #13
    Forum Contributor
    Join Date
    06-10-2004
    Posts
    121

    Re: conditional sum derived from a date interval

    Thanks, managed to get the sumproduct to work

+ 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