+ Reply to Thread
Results 1 to 9 of 9

Thread: Sum calculation between two date also inbetween two columns

  1. #1
    Forum Contributor
    Join Date
    07-12-2007
    Posts
    176

    Sum calculation between two date also inbetween two columns

    We have two sheet one is data & secode is result.

    In data sheet :
    column A is : Invoice date
    column B is : order date
    column C is : amount
    *************************
    I required in result sheet :
    column A is : month
    column B is : amount

    Now we required formula in result sheet in B2 between two date & also invoice date & order date between april-09 and in column B3 between may-09.
    Attach file for your ready ref.
    Attached Files Attached Files
    Last edited by avk; 03-10-2010 at 01:24 PM.

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Sum calculation between two date also inbetween two columns

    Hi,

    See attached sample ...

    HTH
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    07-12-2007
    Posts
    176

    Re: Sum calculation between two date also inbetween two columns

    If we have change year in data sheet suppose all apr-09 & may-09 changed with apr-08 & may-08 respectively after that in result sheet total not showing zero.

    Please note that, in that sheet number of records & index in receipt number only. In that sheet we don't want to sorting or indexing because our other data may be mismatch. We required all a1 to a65000 and b1 to b65000 in those column record of apr-08, apr-09, may-08, may-09 & so on upto mar-08 & mar-09.

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Sum calculation between two date also inbetween two columns

    Hi,

    You can adjust the ranges to fit your requirements with following
    =SUMPRODUCT((MONTH(data!$A$2:$A$113)=MONTH(A2))*(MONTH(data!$B$2:$B$113)=MONTH(A2))*(YEAR(data!$A$2: $A$113)=YEAR(A2))*(YEAR(data!$B$2:$B$113)=YEAR(A2))*(data!$C$2:$C$113))
    HTH

  5. #5
    Forum Contributor
    Join Date
    07-12-2007
    Posts
    176

    Re: Sum calculation between two date also inbetween two columns

    ..
    SUMPRODUCT((MONTH(GRR!$G$2:$G$65000)=MONTH(A2))*(MONTH(GRR!$I$2:$I$65000)=MONTH(A2))*(YEAR(GRR!$G$2: $G$65000)=YEAR(A2))*(YEAR(GRR!$I$2:$I$65000)=YEAR(A2))*(GRR!$AB$2:$AB$65000))
    ..
    After input your above formula amount show correctly. If inv date & oa date both between april-09.
    But if oa date between april-09 & inv date after april-09 i.e. may-09, june-09, july-09
    in that case amount not calculate.

    I explain in detail:
    If oa date between 01-april-09 to 30-apr-09 & if total amount is : 100/-

    1] If oa date & Inv date between 01-april-09 to 30-apr-09 & total amount : 70/-

    2] If oa date between 01-april-09 to 30-apr-09 & inv date after 30-apr-09 & total amount is : 30/-
    As per your suggested formula amount show : 70/- but amount 30/- not show. In that case can be suggest you.

    I attach file with example for more clarity.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    07-12-2007
    Posts
    176

    Re: Sum calculation between two date also inbetween two columns

    bump no reply. Awaiting reply.

  7. #7
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Sum calculation between two date also inbetween two columns

    I woudl first make the point that using Arrays / SUMPRODUCTs over large ranges is generally going to kill the performance of your file - these functions are "expensive".

    On that basis - to try and limit the damage as much as possible I would first suggest creating a Named Range, eg:

    Name: _Data
    RefersTo: =data!$A$11:INDEX(data!$C:$C,MATCH(9.99E+307,data!$A:$A))
    with the above setup - and assuming I've understood:

    C2:
    =SUMPRODUCT(--(INDEX(_Data,0,1)>=$A2),--(INDEX(_Data,0,1)<=$B2),--(INDEX(_Data,0,2)>=$A2),--(INDEX(_Data,0,2)<=$B2),INDEX(_Data,0,3))
    
    D2:
    =SUMPRODUCT(--(INDEX(_Data,0,1)>$B2),--(INDEX(_Data,0,2)>=$A2),--(INDEX(_Data,0,2)<=$B2),INDEX(_Data,0,3))

  8. #8
    Forum Contributor
    Join Date
    07-12-2007
    Posts
    176

    Re: Sum calculation between two date also inbetween two columns

    Firstly thanks for coopration.
    I have little quary regarding name define explain meaning of 9.99e+307

  9. #9
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Sum calculation between two date also inbetween two columns

    It is simply a Big Number... 9.99E+307 being 9.99*10^307 ... it used to determine the row in which the last number is found within specified range.

+ 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.2.0