Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Having a problem with SUMIF

I'm new to numbers and I am having a problem with SUMIF. Here is my formula:


=SUMIF(MONTHNAME(MONTH(Checking::Transactions::$B3:$B24)),B1,Checking::Transacti ons::$F3:$F24)


The error says that SUMIF requires that all range arguement are the same size.


This basic, same formula is used on the same sheet and it works just fine ( =SUMIF(Actual Montly Expenses::$Month,B1,Actual Montly Expenses::$Amount) ).


There are 2 differences. My new formual uses data from another sheet for the columns. In the formula where it works, the 2 columns are next to each other, whereas in the formula that doesn't work, the columns are separated by 4 columns. Does this make a difference?


Expenditure

Month

Amount

Insurance

January

$2,000

Trash Collection

January

$406

Lighting

January

$197

Landscaping

January

$479

Legal/Audit/Taxes

January

$80

Snow Removal

January

$1,250

Trash Collection

February

$406

Snow Removal

February

$1,250

Lighting

February

$198














I tried using column header titles, but for some reason, the selected areas are different sizes.


Any suggestions?


User uploaded file

iMac, OS X Mavericks (10.9.1)

Posted on Feb 21, 2014 7:09 AM

Reply
16 replies

Feb 21, 2014 1:24 PM in response to Jerrold Green1

Apparently, my post didn't include everything. The example you suggest is really the same as the one I posted that works, just yours uses the explicit columns. The formula that doesn't work is this:

=SUMIF(MONTHNAME(MONTH(Checking::Transactions::Date)),B1,Checking::Transactions: :Debit Amount)


Here is a screen shot of the broken formula and sheet and wasn't in the original post.


User uploaded file

User uploaded file


Message was edited by: DaveH123 The image was embedded. Instead of pasting, I'll use the Insert Image button. Oops, Grab doesn't save images in the format that the discussion likes.

Feb 21, 2014 2:02 PM in response to DaveH123

Hi Dave,


You could try making sure the month names in B1 and down (in your original screenshot) are text. One way to do that is type them as 'January 'February , etc. (with a leading single quote, that disappears after you hit enter).


I'm guessing Numbers thinks they're date-time strings, so they won't which match the results of your MONTHNAME(MONTH()).



SG

Feb 21, 2014 7:52 PM in response to DaveH123

DaveH123 wrote:


Apparently, my post didn't include everything. The example you suggest is really the same as the one I posted that works, just yours uses the explicit columns. The formula that doesn't work is this:

=SUMIF(MONTHNAME(MONTH(Checking::Transactions::Date)),B1,Checking::Transactions: :Debit Amount)


Here is a screen shot of the broken formula and sheet and wasn't in the original post.


User uploaded file

User uploaded file


Message was edited by: DaveH123 The image was embedded. Instead of pasting, I'll use the Insert Image button. Oops, Grab doesn't save images in the format that the discussion likes.

Dave,


There are two problems with your approach. You do have unequal ranges, as if obvious in the screen shot in your last post and as was reported by Numbers. More importantly, you are not using SUMIF properly.


The syntax for SUMIF is:


SUMIF(test-values, condition, sum-values)


"Test-values" and "sum-values" are range specifications.


MONTHNAME(MONTH(Checking::Transactions::Date)) is not a range specification and SUMIF will not work with that approach.


Jerry

Feb 21, 2014 9:20 PM in response to DaveH123

Dave,


Checking::Transactions::Date would be a range. When you wrap it in MONTHNAME(MONTH()) it is no longer a range. I'm not sure exactly what it is. Not sure where you were going with all that nesting!


If you uncheck this in Numbers > Preferences:


User uploaded file


then it may be easier to recognize the ranges in your formulas.


Jerry's simple example is the way to go to get things working, though I would input the months as 'January and 'February etc., i.e. as text rather than as shown. Otherwise, Numbers internally stores what look like simple month names as date-time strings (i.e. with a specific month, day, year, and time) so January (actually 1/1/2014, 12:00:00 AM on my machine) will work this year but maybe not next year, when it will look the same but the year may no longer match.


SG

Feb 22, 2014 6:48 AM in response to SGIII

SGIII wrote:


Dave,


Checking::Transactions::Date would be a range. When you wrap it in MONTHNAME(MONTH()) it is no longer a range. I'm not sure exactly what it is. Not sure where you were going with all that nesting!


If you uncheck this in Numbers > Preferences:


User uploaded file


then it may be easier to recognize the ranges in your formulas.


Jerry's simple example is the way to go to get things working, though I would input the months as 'January and 'February etc., i.e. as text rather than as shown. Otherwise, Numbers internally stores what look like simple month names as date-time strings (i.e. with a specific month, day, year, and time) so January (actually 1/1/2014, 12:00:00 AM on my machine) will work this year but maybe not next year, when it will look the same but the year may no longer match.


SG

SG,


MONTHNAME(MONTH(Checking::Transactions::Date)) would be the name of the month of the Date entered in the current row of the column Date in table Transactions in Sheet Checking. Certainly not a Range, as you say.


Jerry

Feb 22, 2014 10:28 AM in response to Jerrold Green1

MONTHNAME(MONTH(Checking::Transactions::Date)) would be the name of the month of the Date entered in the current row of the column Date in table Transactions in Sheet Checking.


Jerry,


That is true if the expression is in the table where the Date column is, as shown here in column D:

User uploaded file


But it's not true when the expression is in another table referencing that table:

User uploaded file


In this example it seems to generally think it's the last value it's encountered in the range referenced within. But it can get a little confused. Maybe it's all that snow removal!


Again, I would supplement your advice about keeping it simple by adding that is best not to just enter month names in the column. That's because Numbers's smart date recognition (too smart, I think) promptly attaches a day, year, and time, as shown here:

User uploaded file

So it won't match as expected across years. Generally better to make sure the month names are text by first typing a '.


SG

Feb 22, 2014 11:05 AM in response to Jerrold Green1

You can outsmart the automatic Date recognition by preforrmating the cell of the first entry as Text or by appending a leading apostrophe to the first entry.


Jerry,


That's exactly what I'm recommending. Don't just enter month names or you'll likely end up scratching your head after the year changes. Just entering them builds a stealth time bomb, because they may look like simple month names but they aren't. They're year-specific. I say, "Outsmart the smart date recognition now or eventually it will outsmart you!"


SG

Feb 22, 2014 2:43 PM in response to Jerrold Green1

Jerry,


I'm not sure what you are driving at here. For the month names in column A below I followed your instructions upthread exactly: "Type January in the first cell and Fill Down." As you can see, following those instructions results in what looks like month names. But, under the hood, they are not month names. They are date-time values. And they stay that way.


User uploaded file


I'm recommending that people take care not to just "Enter January and (Auto)fill Down" when matching on month names will be important, as it is here. Instead, be sure to outsmart the smart date recognition so that the values do not end up as date-time values with a specific year attached that won't match as expected in subsequent years.


One way is to do this, as described upthread, is to type 'January (with a leading apostrophe) and fill that down. Another is to specifically format the cells beforehand. And be cautious of month names in Pop-Up Menu.


Don't you think this is good advice? It seems like a small point but it's not if you're trying to match on month names. Certainly, knowing this would have saved me headaches before I was fully aware of the consequences of smart date recognition.


SG

Having a problem with SUMIF

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.