+ Reply to Thread
Results 1 to 14 of 14

Array Formula with Sumif and between dates

  1. #1
    Registered User
    Join Date
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Array Formula with Sumif and between dates

    I've hit a major brick wall and hoping someone will be able to help! I've written an array formula to replace a pivot table (long story) anyway, they now want to be able to filter the data by date (between two dates) i'm using the current formula:

    {=SUM(IF('SAP Data Current'!$A$2:$A$39802='Payment Block by Ac. Clerk Cal'!$B$84,IF('SAP Data Current'!$I$2:$I$39802='Payment Block by Ac. Clerk Cal'!$C101,IF('SAP Data Current'!$B$2:$B$39802='Payment Block by Ac. Clerk Cal'!S$2,'SAP Data Current'!$AA$2:$AA$39802,0),0),0))}

    I know I need to put it at the beginning, but not sure how! I have the following formula for between dates:

    =SUMIF(B2:B24,"<="&F7,C2:C24)+SUMIF(B2:B24,"<="&F8,C2:C24)

    but then this isn't working right either!

    anyone got any ideas?

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

    Re: Array Formula with Sumif and between dates

    Try

    =SUMIF(B2:B24,">="&F7,C2:C24)-SUMIF(B2:B24,">"&F8,C2:C24)

    where F7 contains start date and F8 contains end date
    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
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Array Formula with Sumif and between dates

    Many Thanks - it makes that part work - how would I intergrate this into the array formula?

    Thanks

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

    Re: Array Formula with Sumif and between dates

    In what way... the ranges are different in your array formula and the other formula?

    What exactly are all the conditions you want met and what is to be summed in the end?

  5. #5
    Registered User
    Join Date
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Array Formula with Sumif and between dates

    the rough is

    if between date 1 and date 2, if = a1, if = a2, if = a3 then sum a4

    That make sense?

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

    Re: Array Formula with Sumif and between dates

    No, not really.

    Here is the basic syntax you can try

    =Sumproduct(--(Range1=Criteria1),--(Range2=Criteria2),...etc, --(RangeX>=StartDate),--(RangeY<=EndDate),SumRange)

    This formula is not a CSE formula. That means, just confirm with ENTER only...

  7. #7
    Registered User
    Join Date
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Array Formula with Sumif and between dates

    Sorry - I did explain that rather badly, I have a Table of data which is roughly 35000 lines, from that I need to filter what I need (hence a array) so


    {=SUM(IF('SAP Data Current'!$A$2:$A$39802='Payment Block by Ac. Clerk Cal'!$B$3,
    IF('SAP Data Current'!$I$2:$I$39802='Payment Block by Ac. Clerk Cal'!$C4,
    IF('SAP Data Current'!$B$2:$B$39802='Payment Block by Ac. Clerk Cal'!D$2,
    'SAP Data Current'!$AA$2:$AA$39802,0),0),0))}

    “Logic of Formula”

    Series One: If ‘SAP Data Current between ranges A2 & A39802 = INF1
    Series Two: If ‘SAP Data Current between ranges I2 & I39802 = Dups & Cred’d Paymt
    Series Three: If ‘SAP Data Current between ranges B2 & B39802 = 1
    Once the above series has been done, it will then add (sum) between ranges AA2 and AA39802

    But now I need to filter with between dates aswell

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

    Re: Array Formula with Sumif and between dates

    Which column are the dates in? And where is the Start/End date cells?

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

    Re: Array Formula with Sumif and between dates

    ... ah, a fellow Colcestrian.

    If you're using XL2007 as implied by your profile you could use SUMIFS function which is like SUMPRODUCT is not an Array but is accepted to be more efficient... though not backwards compatible with pre XL2007 versions.

    Please Login or Register  to view this content.
    replace the ? with references as appropriate for the date range / criteria dates - not clear.

    Note: even though the above is more efficient than either SUMPRODUCT/Array given the range volume it will still be quite slow.

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

    Re: Array Formula with Sumif and between dates

    ]Basically the same as post # 6... just fill in the blanks...

    Sumproduct:

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 01-15-2010 at 11:01 AM. Reason: typo - SUMIFPRODUCT :)

  11. #11
    Registered User
    Join Date
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Array Formula with Sumif and between dates

    IF('SAP Data Current'!$I$2:$I$39802='Payment Block by Ac. Clerk Cal'!D$2, (date)

    the start and end date will be on a summary page, but position to be decided...

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

    Re: Array Formula with Sumif and between dates

    Neil, I think both NBVC & I have resolved your problem you just need to tell us in which column your dates are stored on the 'SAP Data Current' sheet - you may have done so already but I'm afraid we've not noticed.

    Try and be as clear as possible... remember we can't see your file and thus are basing everything entirely off the narrative you provide - the clearer you are regards the ranges the more tailored our response can be - ie plug & play solution.

  13. #13
    Registered User
    Join Date
    01-15-2010
    Location
    Colchester
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Array Formula with Sumif and between dates

    Thanks for your help all - DonkeyOte - it worked really well and reduced the processing time of having to use a array formula ****Gold star for you****

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

    Re: Array Formula with Sumif and between dates

    Up the U's

    Remember though that the SUMIFS won't work pre XL2007... if that's an issue you should revert to the SUMPRODUCT (will perform perhaps marginally quicker than the Array but does not require CTRL + SHIFT + ENTER entry so is more robust from that perspective...)

    Other new to XL2007 formulae that may become of interest to you would be: COUNTIFS, AVERAGEIF, AVERAGEIFS - most of which can avert need for Arrays as required in earlier versions...

+ 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