+ Reply to Thread
Results 1 to 9 of 9

SUMIF with date range

Hybrid View

  1. #1
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    258

    SUMIF with date range

    ***I'm using Excel 2003***

    This seems like it should be a no-brainer, but I just can't figure it out, but then again I'm not that advanced so I'm flailing away a bit here.

    In column A. I have a bunch of dates in the format dd/mm/yy. In column V, I have the corresponding sales figures. In column W, I'm trying to code a formula that will sum all the sales for the month. So when the end of the month comes along the total sales for that month will be calculated in column W. The catch is that, since this sheet will be used for different years, the row where the end of months occur are not none ahead of time, so I have to refer back to column A to find the end of the month. There are also blank cells in column V.

    Here's one formula I've tried without any success. The first part finds the end of month with no problem, but the SUMIF portion doesn't work.
    =IF(A5=WORKDAY(DATE(YEAR(A5),MONTH(A5)+1,1),-1),SUMIF(MONTH(A1:A7),MONTH(A5),V5:V4244,0)

    Col A------Col V------Col W
    1/2/15-----$15-------Blank
    1/15/15----Blank-----Blank
    1/23/15----$10------Blank
    1/30/15----Blank-----Blank
    1/31/15----$15------$40
    2/1/15-----$25------Blank
    2/7/15-----$10------Blank

    (Apologies for rough sketch, but table feature was not working properly)
    Last edited by Big.Moe; 05-01-2015 at 09:34 PM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF with date range

    Will there always (eventually) be an end of month date for each month?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    258

    Re: SUMIF with date range

    Yes, there is always an end of the month for each month.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF with date range

    Here's one way...

    Data Range
    A
    B
    C
    1
    Date
    Sale
    Subtotal
    2
    1/2/2015
    $15
    3
    1/15/2015
    4
    1/23/2015
    $10
    5
    1/30/2015
    6
    1/31/2015
    $15
    40
    7
    2/1/2015
    $25
    8
    2/7/2015
    $10
    9
    2/25/2015
    $12
    10
    2/28/2015
    $7
    54


    This formula entered in C2 and copied down:

    =IF(A2=EOMONTH(A2,0),SUMIF(A$2:A2,">="&A2-DAY(A2)+1,B$2:B2)-SUMIF(A$2:A2,">"&EOMONTH(A2,0),B$2:B2),"")

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF with date range

    Note that the EOMONTH function requires the Analysis ToolPak
    add-in be installed if you're using a version of Excel prior to
    Excel 2007. If you enter the formula and get a #NAME?
    error look in Excel help for the EOMONTH function. It'll tell you
    how to fix the problem.

  6. #6
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    258

    Re: SUMIF with date range

    Thanks Tony, I guess you posted your answer while I was typing my solution I found. Will study yours.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMIF with date range

    Good deal. Thanks for the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  8. #8
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    258

    Re: SUMIF with date range

    Alright I figured-out what I was doing wrong. Here's the formula that ended working for me:

    =IF(C37=WORKDAY(DATE(YEAR(C37),MONTH(C37)+1,1),-1),SUM(IF(MONTH($C$5:$C$4244)=MONTH(C37),$V$5:$V$4244)),0)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] SUMIF Date Range
    By TylerJamison in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-04-2015, 04:36 PM
  2. SUMIF and date range
    By Exel_question_RS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2014, 03:26 AM
  3. [SOLVED] Sumif when range is date + time and crieteria is date
    By lokpal.panwar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-05-2013, 06:46 AM
  4. Using SUMIF on a Date Range
    By mcmuney in forum Excel General
    Replies: 1
    Last Post: 11-11-2010, 08:26 PM
  5. [SOLVED] SUMIF within date range as a function of today()'s date
    By irvine79 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-06-2006, 01:00 PM

Tags for this Thread

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