+ Reply to Thread
Results 1 to 8 of 8

Dynamic month and year criteria in Sumifs formula

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2007 or Excel 2010.
    Posts
    65

    Dynamic month and year criteria in Sumifs formula

    Hi,

    Please help me with Dynamic Sumifs formula.

    Requirement: The below data set contains spend for different years and all I want the Sumifs formula to do is give me the current month and current year spend against each individual so for example we are in March 2016 so from the attached data set the result should be like.

    Result: Colin $467,731 similarly as the month progresses the sumifs formula should show the current month and current year spend for each individual for example when file is opened in April the formula should show April 2016 spend for each individual. I have tried month(now()) and year(now()) but it didn't work. Appreciate your assistance

    Name Date spend
    colin 10-07-2015 $521,888
    David 09-30-2015 $798,174
    Mary 02-11-2015 $73,724
    John 12-05-2014 $89,495
    colin 03-20-2016 $185,742
    David 04-02-2015 $43,370
    Mary 07-14-2015 $73,724
    John 10-07-2015 $89,495
    David 09-30-2015 $185,742
    colin 03-26-2016 $281,989

    Thanks!
    4gurus
    Attached Files Attached Files
    Last edited by 4gurus; 03-13-2016 at 12:38 PM.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Dynamic month and year criteria in Sumifs formula

    Enter formula in F3 and copy down

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Dynamic month and year criteria in Sumifs formula

    Hello my India friend,

    Why don't you do a Pivot Table and filter it by this month and year. NO formulas needed. See the attached for my example.
    PT for current Month and Year.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Dynamic month and year criteria in Sumifs formula

    I think a year must be included too..

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Dynamic month and year criteria in Sumifs formula

    4gurus,

    Try the attached.

    Month to date Formula in F4:

    =SUMIFS(C:C,A:A,E4,B:B,"<="&F$2,B:B,">="&DATE(YEAR(F$2),MONTH(F$2),1))

    (Add all the values in Col C where the date in Col B is between the start of the month in F2 and today's date in F2, and the name in Col A is whatever is in E4)

    Copy that down against each name in Col E

    Year to Date Formula in G4:

    =SUMIFS(C:C,A:A,E4,B:B,"<="&F$2,B:B,">="&DATE(YEAR(F$2),1,1))

    (Add all the values in Col C where the date in Col B is between the first day of the year in F2 and today's date in F2, and the name in Col A is whatever is in E4)

    Copy that down against each name in Col E

    Hope it helps

    Ochimus
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-11-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2007 or Excel 2010.
    Posts
    65

    Re: Dynamic month and year criteria in Sumifs formula

    Hi Alkey,
    Yes, sumproduct works but my only concern will be the length and time taken by sum product formula when applied on real data set as I need to multiply other conditions; hope it doesn't slow down the calculation and result in freezing of excel. Thanks for your help much appreciated.

    Hi Ochimus,
    I tried your formula but it failed when I changed some of the dates to March 2016 in the date column. Not sure why but let me know if the formula can be further altered.

    Hi MarvinP,
    Yes, I am familiar with Pivot and I currently have my data set in a pivot but I was trying to use some macro to copy and paste the new data set and pivot doesn't allow that so thought of using formula.

    Thank you all again and let me know if Sumifs can be further altered to work dynamically.

    4gurus

  7. #7
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Dynamic month and year criteria in Sumifs formula

    4gurus,

    Sorry you had problems.

    I can only think it is the date format in Col B on your machine?

    As you can see on the revised attachment, I changed all the Col B dates to 2016, and the values in Cols F & G changed automatically.

    I even put a "Checksum" in C12 adding up all the rows, and it matches the Year to Date value in G8.

    Hopefully it will work when you "play" with the dates in Col B, including putting some in previous years?

    One quick point, though - if you set any of the dates to later than today, the formula won't count them, because it only counts anything up to Today's date in F2

    Shout if it still goes wrong

    Ochimus
    Attached Files Attached Files
    Last edited by Ochimus; 03-13-2016 at 02:13 PM.

  8. #8
    Registered User
    Join Date
    02-11-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2007 or Excel 2010.
    Posts
    65

    Re: Dynamic month and year criteria in Sumifs formula

    Hi Ochimus,

    Yes it works, and I think that EOmonth formula should be used probably in G2 along with the formula in F2 which finds last day of the month in order to get the right spend for the month. That way we can get the date range.

    Thank you Ochimus for making it work using Sumifs. I will close this as solved.

    Once again thank you all for your wonderful assistance

    4gurus

+ 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] Using SUMIFs with Month and Year
    By rikkyshh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-15-2016, 05:24 AM
  2. [SOLVED] Sum costs for a month and year using sumifs
    By bberger1985 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2014, 01:08 PM
  3. Replies: 18
    Last Post: 09-08-2014, 05:06 PM
  4. [SOLVED] Sumproduct/SUMIFS refrencing Month/Year
    By cartica in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2014, 03:15 PM
  5. [SOLVED] SUMIFS and Date Criteria (Month Year etc...) but without helper column?
    By JungleJme in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-16-2013, 07:21 AM
  6. [SOLVED] Use TEXT function as Criteria on Sumifs to convert month/year to date format
    By chico.corrales in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2012, 07:49 PM
  7. SUMIFS by month/year
    By Lyric in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-15-2011, 02:39 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