+ Reply to Thread
Results 1 to 7 of 7

Sum

  1. #1
    Forum Contributor
    Join Date
    07-26-2006
    Posts
    141

    Sum

    I am trying to create a formula on a Sheet 1 to Sum data on Sheet 2. I need to sum column M if the Month in Column C is January. I have tried the following formulas and I am getting an error or 0.

    =SUM(IF(MONTH(Sheet2!C2:C25)=1|Sheet2!M2:M25|0))
    =SUMPRODUCT(MONTH(Sheet2!C2:C25)=1|Sheet2!M2:M25)
    =SUMIF(Sheet2!C:M|MONTH(Sheet2!C:C)=1|Sheet2!M:M)
    Last edited by billykiller05; 03-11-2015 at 11:38 AM.

  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

    Hi,

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


    This assumes column C contains month names rather than the numbers 1-12 representing January-December. If not change the criteria to the value 1 rather than "January".
    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 Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum

    The SUMIF won't work, because you can't manipulate the criteria range with another function like MONTH.
    It can only work with the data in the cell exactly as it exists.

    The SUMPRODUCT doesn't work because you need to coerce the True/False values to 1/0 values
    =SUMPRODUCT(--(MONTH(Sheet2!C2:C25)=1)|Sheet2!M2:M25)

    The SUM(IF formulas should work (if it's entered with CTRL + SHIFT + ENTER)
    If it's not, it's either of the following 3 problems.

    1) Dates in column C are NOT really dates, they're text strings that look like dates.
    Test for this with =ISNUMBER(Sheet2!C2) and fill down
    TRUE = Date, FALSE = TEXT string.

    2) The numbers in column M are not really numbers, just text strings that look like numbers (also called "Numbers Stored As Text")
    Also test with
    =ISNUMBER(Sheet2!M2) and filled down.

    3) The formula was not entered with CTRL + SHIFT + ENTER

  4. #4
    Forum Contributor
    Join Date
    07-26-2006
    Posts
    141

    Re: Sum

    The CTRL + SHIFT + ENTER works with =SUM(IF(MONTH(Sheet2!C2:C25)=1|Sheet2!M2:M25|0)) however if increase C2:C25 to C:C and M2:M25 to M:M to include all possible cells I get an error.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum

    Quote Originally Posted by billykiller05 View Post
    however if increase C2:C25 to C:C and M2:M25 to M:M to include all possible cells I get an error.
    I would assume you have Text headers in row 1
    MONTH(text) = #Value! Error

    I highly reccommend NOT using entire column references in an array formula.
    Because excel will do the work on every single row on the sheet.
    That creates ALOT of unnecessary work on blank rows.

    Stick to a defined set of rows.

    Pick a reasonable number that represents the most rows you expect to ever have, and add 10%

  6. #6
    Forum Contributor
    Join Date
    07-26-2006
    Posts
    141

    Re: Sum

    Ok, that works. Thank you very much.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum

    You're welcome.

+ 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