+ Reply to Thread
Results 1 to 4 of 4

Sum the values in cells based on the condition

  1. #1
    Registered User
    Join Date
    12-02-2009
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    16

    Sum the values in cells based on the condition

    Hi,

    I have data as below

    A B
    12/01/2009 5
    12/02/2009 3
    12/03/2009 7
    12/04/2009 8
    12/05/2009 9

    Now when i enter the from and to date respectively in c1 and d1 cells, E1 should show the sum of b between those days.

    For example, if c1 is 12/02/2009 and d1 is 12/05/2009, e1 result should be 27..

    I am breaking my head to find how to do this.. Anyone help pleaseeeeeeeee

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

    Re: Sum the values in cells based on the condition

    One of many ways, put this formula in E1:

    =SUMPRODUCT(--($A$1:$A$5>=C1), --($A$1:$A$5<=D1), $B$1:$B$5)
    _________________
    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!)

  3. #3
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Sum the values in cells based on the condition

    Try:

    =SUMPRODUCT((A1:A5>=C1)*(A1:A5<=D1)*(B1:B5))

    HTH,
    Jason

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Sum the values in cells based on the condition

    Another option that will let you easily change the date criteria is the DSUM function.

    A Pivot Table is also a viable choice here.

    See attached.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

+ 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