If Column A = (certain month) Add (Column C)

Here's the dealio:

Variables:
Column A is for the month.
Column C is an amount of money.

End Result
I want to find the sum of the amounts in Column C only if Column A = a specific month

example:

april 10
may 200
april 555
june 360

TOTAL: $565

Macbook Pro, Mac OS X (10.6.3)

Posted on Mar 31, 2010 7:34 PM

Reply
16 replies

Apr 1, 2010 11:44 PM in response to itsalexclark

itsalexclark wrote:
How do I do this same thing if instead of it listed as a month I have a date entered.

for example:
instead of APRIL
I have Apr 12, 2010

How can I extract the month and the find the sum of the amounts?


Assuming you want to sum all of the amounts in April, you'll need to extract the Month (number) from each date, then use the SUMIF function suggested by Jerry to sum the amounts.

User uploaded file

If all your dates are in the same year, or if you want to include all of the amounts from April (eg.) without regard to the year, SUMIF will do the job correctly. If you have dates in more than one year, and are interested in the monthly sums for only one year at a time, you'll also need to extract the Year from the date and use SUMIFS.

Formulas:
Columns A and B on both tables are entered directly. Column B on the Summary table is not necessary to the calculations. Columns D and E on the Data table may be hidden.

Data table:
Column D: =MONTH(A)
Column E: =YEAR(A)

Summary table:

Column C (C2): =SUMIF(Data :: 'Month #',"=1",AMT)

Numbers automatically changes the "A" and "B" references in the formula to the names in the column headers, and specifies the table for the first (Month #) as there are columns with this name on both tables.
Note that the April sum in this column includes the three amounts in 2010 and the three amounts in 2011.

Column D (D2): =SUMIFS(AMT,Data :: 'Month #',"=1",Year,"=2010")

Note that the sums in this column include only the amounts where the date is in 2010.

For either of these formulas, the "=1" comparison must be changed manually for each row to match the Month number for the appropriate month.

For the second formula, change the second comparison to the appropriate year.

The quotation marks enclosing the comparison expression are necessary.

Regards,
Barry

Apr 6, 2010 1:45 PM in response to itsalexclark

Unfortunately that formula will not work. MONTH(A) will not result in an array of the months in the entire column, it will return a single value that is the month from column A in the same row as the formula.

Here is a formula that does not require the "month" column and also has no problem with localized date formats. This example will add up the values for January 2010.

EDIT: The parser for this forum uses the less than and greater than symbols for other things so you often cannot post them as part of formulas. I am replacing them in the formulas with the words, you will have to change them back to symbols

=SUMIFS(C,A,"greater than or equal to"&DATE(2010,1,1),A,"less than"&DATE(2010,2,1))

Here is another where you would put the first of the month (e.g., 1/1/2010) in a cell (I used column F for no reason other than it was available in my table) and the formula references that cell for the date.

=SUMIFS(C,A,"greater than or equal to"&F,A,"less than or equal to"&EOMONTH(F,0))


Message was edited by: Badunit

Message was edited by: Badunit

Apr 6, 2010 2:58 PM in response to Badunit

Hello Badunit

a clever tip to get rid of problems with the messages parser is to post a screenshot of the formula.

For you, it would be easy to apply it.

I can't do that because I work in French and if I run Numbers in English, it uses the decimal comma and the semi-colon as separator.

An other efficient tip is to encapsulate the formula between the AppleScript balises

User uploaded file

--

=SUMIFS(C,A,"≥"&DATE(2010,1,1),A,"l<n"&DATE(2010,2,1))
--


In the AppleScript display, it's not perfectly legible but we may apply copy-paste to use it.

Yvan KOENIG (VALLAURIS, France) mardi 6 avril 2010 23:54:00

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

If Column A = (certain month) Add (Column C)

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