+ Reply to Thread
Results 1 to 13 of 13

sum ifs with date range and multiple criteria

  1. #1
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    sum ifs with date range and multiple criteria

    I am trying to sum an set of expenses that occurred within a specific year and or date range. The challenge is to create a formula that includes multiple criterial. For example, I want to sum the following:
    Total of all costs associated with marketing expenses for company A in 2015
    Total of all costs associated with transportation expenses for company A in 2015
    Total of all costs associated with Office expenses for company B in 2014
    etc....

    See attached example

    Thanks.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-30-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: sum ifs with date range and multiple criteria

    What is wrong with the formula in the example?
    it seems to do what you want already.

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: sum ifs with date range and multiple criteria

    I'd use SUMIFS or SUMPRODUCT.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  4. #4
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    It does not include a date range.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: sum ifs with date range and multiple criteria

    Try with SUMPRODUCT:

    H2:

    =SUMPRODUCT((YEAR($A$15:$A$1000)=YEAR($B$2))*($H$15:$H$1000=G2)*$D$15:$D$1000)

    I2 then drag accross

    =SUMPRODUCT((YEAR($A$15:$A$1000)=YEAR($B$2))* ($H$15:$H$1000= $G2)*($B$15:$B$1000=I$1)*$D$15:$D$1000)
    Quang PT

  6. #6
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    I added a start and end date range, but ended up with #Name?
    =SUMPRODUCT((dates>=B2)*(dates<=B3)*(companies=B15:B24)*(categories=I1)*(G13:G62))

  7. #7
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    This worked great. Is there a way to also include a date range, vs. a year?

  8. #8
    Registered User
    Join Date
    11-30-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: sum ifs with date range and multiple criteria

    this works with your current formula;

    =SUMIFS($D$15:$D$49950, $H$15:$H$49950, $G2, $B$15:$B$49950, $I$1,A15:A49950,">=" & DATE(2014,9,1))

  9. #9
    Registered User
    Join Date
    03-12-2015
    Location
    UK
    MS-Off Ver
    2013 & 2010
    Posts
    27

    Re: sum ifs with date range and multiple criteria

    Generally I am not a fan of helper columns, however when it comes to three way lookups I normally actually endorse one, especially if the data set is large as merging two lookup values to transform a three way lookup into a simple two way lookup ensures your spreadsheet remains fast.

    I would personally go about this particular problem by merging the current year with the company name in cells I1 to Q1 e.g. ="A"&TEXT($B$2,"yyyy") in I1, "B"&TEXT($B$2,"yyyy") in J2 ... resulting in ACURRENTYEAR, BCURRENTYEAR... for the company names.
    If you would prefer to have only company names visible like you currently have, you can still do this by simply hiding the row, and inserting a new row with referenced values e.g. ="I2"&TEXT($B$2,"yyyy") in I1 (hidden row) and "A" in I2 (visible row)

    I would then add a hidden helper column to the input table, turning it into a simple two way lookup e.g. =B15&(RIGHT(TEXT(A15,"yyyy"),4)) for the first row (row 15). I know I could have used the year formula instead of nesting RIGHT and TEXT - this was purposeful, I prefer nesting RIGHT and TEXT to extract date information whenever possible rather than using DAY, DATE, YEAR etc. because it means I don't have to rely on the computer date and time being right. This is only really useful if the data is going to be viewed on a large number of computers, so has become habitual for me. I would Use YEAR instead if I knew no one else would be sent the file.
    Last edited by timiop2011; 03-19-2015 at 01:30 PM.

  10. #10
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    If I add one field for a start date and another for an end date, can that be incorporated into the formula so I do not have to manually type in a greater than date in the formula? See attached updated excel with the yellow highlighted field. Your new formula is in cell i2.
    Thank
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    Hi DrTyack.
    I just wanted to confirm you saw my last post with updated excel file as I may have inadvertently posted it on the main page.

  12. #12
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    Quote Originally Posted by DrTyack View Post
    this works with your current formula;

    =SUMIFS($D$15:$D$49950, $H$15:$H$49950, $G2, $B$15:$B$49950, $I$1,A15:A49950,">=" & DATE(2014,9,1))
    If I add one field for a start date and another for an end date, can that be incorporated into the formula so I do not have to manually type in a greater than date in the formula? See attached updated excel with the yellow highlighted field. Your new formula is in cell i2.
    Thanks
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: sum ifs with date range and multiple criteria

    I found the answer so this is solved.
    =SUMIFS($D$15:$D$49951, $H$15:$H$49951, $G2, $B$15:$B$49951, $I$1,$A$15:$A$49951,">=" & $B$2,$A$15:$A$49951,"<=" & $B$3 )

    Thanks!
    Last edited by Perk1961; 03-29-2015 at 09:38 PM.

+ 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. Date Range with Multiple Criteria
    By Daisy Duke in forum Excel General
    Replies: 2
    Last Post: 06-13-2014, 11:07 AM
  2. multiple criteria within a date range
    By sangomas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-08-2014, 05:44 AM
  3. Replies: 11
    Last Post: 02-07-2013, 02:22 AM
  4. Count - multiple criteria, multiple sheets, and date range.
    By threecliffs in forum Excel General
    Replies: 6
    Last Post: 06-14-2011, 01:36 PM
  5. sum multiple criteria date range
    By emitecaps in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-13-2010, 08:15 AM

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