+ Reply to Thread
Results 1 to 15 of 15

SUMPRODUCT between two dates

  1. #1
    Registered User
    Join Date
    11-22-2006
    Posts
    9

    SUMPRODUCT between two dates

    Hi all I'm looking to use the below forumla

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A12)*--('Monthly Release''s'!$M$3:$M$2500=B$11))

    but change the green underlined value to be BETWEEN two dates.

    Any ideas ???

    Thanks

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by danviggers
    Hi all I'm looking to use the below forumla

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A12)*--('Monthly Release''s'!$M$3:$M$2500=B$11))

    but change the green underlined value to be BETWEEN two dates.

    Any ideas ???

    Thanks
    Hi,

    easiest would be to make the green >= and add another condition as <=

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    11-22-2006
    Posts
    9
    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006>=5/10/2006))

    OK so I've done this and the value comes out as 23, when it shoudl be 1.

    There are 23 records that coincide with 'Monthly Release''s'!$G$3:$G2500=$K12, but there should be only 1 record that coincides with that AND has the date which has been shown above.

    I don't think I'm writing the date right.

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by danviggers
    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006>=5/10/2006))

    OK so I've done this and the value comes out as 23, when it shoudl be 1.

    There are 23 records that coincide with 'Monthly Release''s'!$G$3:$G2500=$K12, but there should be only 1 record that coincides with that AND has the date which has been shown above.

    I don't think I'm writing the date right.
    Hi,

    How about

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006>=5/10/2006))

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006)*--('Monthly Release''s'!$K$3:$K$2500>=5/10/2006)))

    added, >= 2/10 ___ then <=5/10 ?

    (untested)
    Last edited by Bryan Hessey; 11-30-2006 at 06:54 AM.

  5. #5
    Registered User
    Join Date
    11-22-2006
    Posts
    9
    Thanks for the help.

    Tried the formula =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006)*--('Monthly Release''s'!$K$3:$K$2500>=5/10/2006)) ... and it gives the number '0'.

  6. #6
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by danviggers
    Thanks for the help.

    Tried the formula =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$K12)*--('Monthly Release''s'!$K$3:$K$2500=2/10/2006)*--('Monthly Release''s'!$K$3:$K$2500>=5/10/2006)) ... and it gives the number '0'.
    Good, that works

    Try the new date test (blue stuff)

    --

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    You should be careful about the worksheet name in your formula ...

    '' appears in the middle of 'Monthly Release''s'!

    My suggestion, if need be is to change the worksheet name to
    Monthly Releases ... to avoid all possible problems ...

    HTH
    Carim

  8. #8
    Registered User
    Join Date
    11-22-2006
    Posts
    9
    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A31)*--('Monthly Release''s'!$K$3:$K$2500>=2/10/2006)*--('Monthly Release''s'!$K$3:$K$2500<=5/10/2006))

    Still gives me a '0'.

    Once again thanks for your help.

  9. #9
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Carim
    Hi,

    You should be careful about the worksheet name in your formula ...

    '' appears in the middle of 'Monthly Release''s'!

    My suggestion, if need be is to change the worksheet name to
    Monthly Releases ... to avoid all possible problems ...

    HTH
    Carim
    '' is as is required for names containing a ' (tick)

    ---

  10. #10
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by danviggers
    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A31)*--('Monthly Release''s'!$K$3:$K$2500>=2/10/2006)*--('Monthly Release''s'!$K$3:$K$2500<=5/10/2006))

    Still gives me a '0'.

    Once again thanks for your help.
    hmm, just to test, try the >=2/10 as = the date sought, and the same for the <=5/10

    trying for a 1

    or .zip and post a sample of your sheet for testing.

    ---

  11. #11
    Registered User
    Join Date
    11-22-2006
    Posts
    9
    Right I've got it now, thanks for your help.

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A31)*--('Monthly Release''s'!$K$3:$K$2500>DATE(2006,10,2))*--('Monthly Release''s'!$K$3:$K$2500<=DATE(2006,10,5)))

  12. #12
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by danviggers
    Right I've got it now, thanks for your help.

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A31)*--('Monthly Release''s'!$K$3:$K$2500>DATE(2006,10,2))*--('Monthly Release''s'!$K$3:$K$2500<=DATE(2006,10,5)))
    Hi,

    good to see, I was just about to post a =SUMPRODUCT(--($G$3:$G5=$A3)*--($K$3:$K$5>=$H$1)*--($K$3:$K$5<=DATE(2006,11,11))) to show either put the date in a cell or 'date' it'


    Thanks for the response.

    ---

  13. #13
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Quite often, when dealing with dates in a sumproduct() formula, it is far better to have dates stored in their own separate cells ...

    1. To allow for easy changes
    2. and, more importantly, to avoid all the headache of date formatting

    HTH
    Carim

  14. #14
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Carim
    Quite often, when dealing with dates in a sumproduct() formula, it is far better to have dates stored in their own separate cells ...

    1. To allow for easy changes
    2. and, more importantly, to avoid all the headache of date formatting

    HTH
    Carim
    True, my preference is for a cell usually on row one or two, the latter if headers prevent row 1 being used.

    ---

  15. #15
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702
    Quote Originally Posted by danviggers
    Right I've got it now, thanks for your help.

    =SUMPRODUCT(--('Monthly Release''s'!$G$3:$G2500=$A31)*--('Monthly Release''s'!$K$3:$K$2500>DATE(2006,10,2))*--('Monthly Release''s'!$K$3:$K$2500<=DATE(2006,10,5)))
    Note: the suggested syntax here is a little confused. You never need *-- together, either use just the *, e.g.

    =SUMPRODUCT((A1:A10="x")*(B1:B10="y")) or use

    =SUMPRODUCT(--(A1:A10="x"),--(B1:B10="y"))

+ 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