+ Reply to Thread
Results 1 to 5 of 5

Date range in SUMPRODUCT

  1. #1
    Registered User
    Join Date
    07-15-2004
    Location
    Göttingen, Germany
    MS-Off Ver
    MS Office Pro Plus 2016
    Posts
    60

    Date range in SUMPRODUCT

    Hi all,

    I am trying to sum figures within a specific date range in the following formulae.

    =SUMPRODUCT(--(Bookings!G$7:G$576=B17),--(AND(Bookings!A$7:A$576>=$C$12,Bookings!A$7:A$576<$C$12+7)),Bookings!J$7:J$576)

    Currently I get an error and I am certain it is in this part;

    (AND(Bookings!A$7:A$576>=$C$12,Bookings!A$7:A$576<$C$12+7))

    This is trying to look for dates that are greater than or equal to the one in $C$12 AND less than 7 days later.

    Can anyone see why this will not work?

    Thanks

    Paul
    Last edited by filky; 02-03-2009 at 05:19 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date range in SUMPRODUCT

    one way (the most common)

    =SUMPRODUCT(--(Bookings!G$7:G$576=B17),--(Bookings!A$7:A$576>=$C$12),--(Bookings!A$7:A$576<$C$12+7),Bookings!J$7:J$576)

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Date range in SUMPRODUCT

    Try
    =SUMPRODUCT(--(Bookings!G$7:G$576=B17)*--(Bookings!A$7:A$576>=$C$12)*--(Bookings!A$7:A$576<$C$12+7)*Bookings!J$7:J$576)

  4. #4
    Registered User
    Join Date
    07-15-2004
    Location
    Göttingen, Germany
    MS-Off Ver
    MS Office Pro Plus 2016
    Posts
    60

    SOLVED: Date range in SUMPRODUCT

    Thank you both - I tried both formulae and they each worked. The use of the * was interesting, I have not seen that before.

    Thanks for your help.

    Kind regards

    Paul

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date range in SUMPRODUCT

    There's no need to use -- if using * ... if you do you're essentially duplicating the coercion of the Booleans.

    If you did opt for * approach you would use:

    =SUMPRODUCT((Bookings!G$7:G$576=B17)*(Bookings!A$7:A$576>=$C$12)*(Bookings!A$7:A$576<$C$12+7)*Bookings!J$7:J$576)

    Double unary is arguably quicker & is also slightly better in terms of handling the summation range should it contain non-numerics
    (ie should any cell in J7:J576 be a string like "Apple" the * approach would generate a #VALUE! error result whereas -- method would not (the Apple entry would simply be ignored)).

+ 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