+ Reply to Thread
Results 1 to 9 of 9

SUM of a column if 2 criteria are met

  1. #1
    Registered User
    Join Date
    04-10-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2012
    Posts
    9

    SUM of a column if 2 criteria are met

    Hi,

    I have an excel sheet with column information such as date (J), # of pcs (K), status (N).

    What i want is a formula that sums the K, if J date is within 2014 and N is "xx". I tried working with SUMIF and SOMPRODUCT, but get stuck in either a formula that results in a 0 or some errorr (im aware of ctrl shift enter).

    I have this one that works to sum K if J=2014. But how do i get the last IF in there?
    =SOMPRODUCT((YEAR(J2:J2000)=2014)*(K2:K2000))

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: SUM of a column if 2 criteria are met

    Hi,

    Use SUMIFS() not SUMIF()
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: SUM of a column if 2 criteria are met

    Hi,

    Does this work for you?

    SOMPRODUCT((YEAR(J2:J2000)=2014)*(N2:N2000="xx")*(K2:K2000))
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    04-10-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2012
    Posts
    9

    Re: SUM of a column if 2 criteria are met

    Thanks, I got now
    =SUMIFS(K:K;J:J;YEAR(2014);N:N;"xx")

    but that returns 0? If i try this with another column instead of J it works, so I think im doing something wrong with the "year" function?

  5. #5
    Registered User
    Join Date
    04-10-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2012
    Posts
    9

    Re: SUM of a column if 2 criteria are met

    yes Sweep that works! So my mistake was to make a new matrix of it instead of combining it with the * in the same one.

    Though im still curious what was wrong with my previous SUMIFS formula

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: SUM of a column if 2 criteria are met

    Whilst I'm happy to be corrected, I don't think it's possible to use another function within the SUMIFS criteria.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: SUM of a column if 2 criteria are met

    Quote Originally Posted by veniw View Post
    Thanks, I got now
    =SUMIFS(K:K;J:J;YEAR(2014);N:N;"xx")

    but that returns 0? If i try this with another column instead of J it works, so I think im doing something wrong with the "year" function?
    It depends what column J contains. If dates then YEAR(2014) won't work since that will return the value 1905 being 5 years (2014/365) after 1900.
    You will need to use two date criteria, i.e

    SUMIFS(K:K;J:J;">="&41640;J:J;"<="&42004;N:N;"xx")

  8. #8
    Registered User
    Join Date
    04-10-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2012
    Posts
    9

    Re: SUM of a column if 2 criteria are met

    i see, thanks. For the SUMPRODUCT year 2014 works fine, how come? Why is that formula "able" to read YEAR(2014) properly?

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: SUM of a column if 2 criteria are met

    Quote Originally Posted by sweep View Post
    Whilst I'm happy to be corrected, I don't think it's possible to use another function within the SUMIFS criteria.
    You can use (pretty much) anything to create the criteria. YEAR() should work just fine
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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] Multiple Criteria SUMIF Using Column as Negative Criteria
    By freybe06 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-24-2014, 04:46 PM
  2. [SOLVED] Count of rows in an array that meet criteria in column 2 and different criteria in column3
    By reynoldslarry in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-09-2013, 01:51 AM
  3. Replies: 6
    Last Post: 08-04-2013, 11:53 AM
  4. Need one column total if criteria meets another columns criteria
    By jebrown in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-24-2013, 08:47 PM
  5. Replies: 2
    Last Post: 10-05-2011, 12:43 PM

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