SUMIFS with Date Range and Condition

Hi, I have search in the forums and read the online numbers guide but can't seem to get the formular working in Numbers.


I want to sum up a column of durations, if they are in between 2 dates and meet the condition to belong to one project. I have the following table:



project

total duration

project

start

end

duration

date range start

date range end

one

0

one

02.01.2013

02.01.2013

15:30

01.01.2013

31.01.2013

two

0

one

03.01.2013

03.01.2013

15:30



three


two

04.01.2013

04.01.2013

15:30



four


two

05.01.2013

05.01.2013

15:30



five


three

06.01.2013

06.01.2013

15:30



six


three

07.01.2013

07.01.2013

15:30



seven


three

08.01.2013

08.01.2013

15:30




I have the following formular but it does not give me any value: =SUMIFS(F,C,A5,D"≥"$G$2,E"≤"$H$2)


What am I doing wrong 😟


User uploaded file


Thank you for your help.

Numbers-OTHER, OS X Mountain Lion (10.8.2)

Posted on Mar 5, 2013 5:22 PM

Reply
12 replies

Mar 7, 2013 6:03 PM in response to a_me

Provided what is being displayed as 00:42 is really a duration value, and means o houns and 42 minutes, the same formula should work. The difference in display is simply a difference in format choice,


Here's the results table from my example with the Durations formatted to match your choice:

User uploaded file

Note that the zeroes in rows 7 through 10 have not been formatted, as the sum defaults to a nnumber value where there have been no values to sum.

(Ignore the 256 in the middle—I was using the table as a scratch pad in connection with a different question.)


Regards,

Barry

Mar 7, 2013 4:32 PM in response to a_me

DURATION converts a series of numbers into a Duration value. If your values to be summed are already durations, DURATION is unnecessary, and should be dropped.



SUMIFS requires 1 + 2n arguments, where n is the number of conditions that must be met.


=SUMIFS(sum-values,test-values,condition,test-values,condition)



The first argument is the range of cells containing the values to be summed.


The second and third (and each pair after that) are the range of cells containing the test-values, then the condition that those values must meet.


With respect to syntax, your formula, shown here with returns entered to separate the elements, looks correct.


=

SUMIFS(

Andreas::Table 1::L;

Andreas :: Table 1 :: H;">="&$C$2;

Andreas :: Table 1 :: J;"<="&$D$2;

Andreas::Table 1::D;"="&B4

)


(Note: The last condition is revised in my example)


Column L: This column should contain the values to be summed. These should be Duration values.


Column H contains the starting date for (the section of) the project recorded on a row. The condition states this date must be equal to or later than the date in cell C2 of the table containing the formula.


Column J contains the end date for (the section of) the project recorded on a row. The condition states this date must be equal to or later than the date in cell D2 of the table containing the formula.


Column D contains the name of (the section of) the project recorded on a row. The condition states this text must match the text in cell B4 of the table containing the formula.


Here's my sample data table, which contains data only in the columns used in the formula:

User uploaded file

Here is the table containing the formula (and the results):

User uploaded file

Formula, placed in B2 and filled down


=SUMIFS(Table 1::L,Table 1 :: H,">="&$C$2,Table 1 :: J,"<="&$D$2,Table 1::D,"="&A)


Duration values were set to provide an easy check of how many projects have been summed on each project (one for each of projects one, two, four and five, two for project three, and none for lines six, seven, eight and nine).


Three rows were not summed:

Row 1 (project four): Starting date before January 1, 2013

Row 9 (Project one): End date after January 31, 2013

Roow 10 (Project two): End date after January 31, 2013


Note: As There is only one Table 1 included in the document, the Sheet name (Andreas) was dropped from the formula by Numbers. With "Table 2" renamed as "Table 1, Numbers automatically revised the formula to include th Sheet name:


=SUMIFS(Andreas::Table 1::L,Andreas::Table 1 :: H,">="&$C$2,Andreas::Table 1 :: J,"<="&$D$2,Andreas::Table 1::D,"="&A)


Regards,

Barry

Mar 6, 2013 5:23 PM in response to a_me

Thank Wayne, I actually got the "" and "" from Apple's help pages: http://help.apple.com/functions/mac/3.0/#ffa59150db

I have tried your corrected function but could not get it to work either.


Jerry,

I do have all the data in seperate tables, I just made an example sheet, because I thought I would understand the function better. So here comes the function I have so far:


=SUMIFS(Andreas::Table 1::L,Andreas :: Table 1 :: H,">="&$C$2,Andreas :: Table 1 :: J,"<="&$D$2,Andreas::Table 1::D,"="&B3)


Andreas::Table 1::L = time values to add up

Andreas :: Table 1 :: H = start date range

$C$2 = analyzed time period start

Andreas :: Table 1 :: J = end date range

$D$2 = analyzed time period end

Andreas::Table 1::D = project values

B3 = analyzed project name


I used to have the formular working in Excel like this

=SUMIFS(Andreas!L:L;Andreas!H:H;">="&Overview_2013!$C$2;Andreas!J:J;"<="&Overvie w_2013!$D$2;Andreas!D:D;Overview_2013!B3) but since moving to Numbers I could not get it to work anymore

Mar 5, 2013 7:42 PM in response to a_me

A,


I'd like to suggest a change of layout. I don't like to see your summary data straddling your log data. They should be in separate tables.


Then, I think you should take another look at the examples for SUMIFS. The comparison operators, as you are using them, need to be strings.


For example, E"≤"$H$2), the last condition expression in your expression, is neither a string nor a proper condition.


Once you untangle the data and summary we can help with the SUMIFS details.


Jerry

Mar 6, 2013 5:32 PM in response to Jerrold Green1

Thank you, semicolons made Numbers recognize and colorize the fields again 🙂 but does not sum up the different values. I have even added the DURATION infront


=DURATION(SUMIFS(Andreas::Table 1::L;Andreas :: Table 1 :: H;">="&$C$2;Andreas :: Table 1 :: J;"<="&$D$2;Andreas::Table 1::D;"="&B4))


Any pointer is highly appreciated.

Mar 6, 2013 5:40 PM in response to a_me

A,


There is a Duration format and there is a Duration Function. You don't need the Function here, but you do need the Format. The Format is applied from the Format menu or the Cells Inspector.


I suggest that you read Chapter 4 of the Numbers User Guide, downloaded from the help menu. It discusses formatting cells. If you haven't already done so, it would be a good idea to also read Chapter 3, perhaps first.


Jerry

Mar 7, 2013 3:13 PM in response to a_me

Andreas,


The reason I suggested that you read the chapters on tables and cells is that your expression


=DURATION(SUMIFS(Andreas::Table 1::L;Andreas :: Table 1 :: H;">="&$C$2;Andreas :: Table 1 :: J;"<="&$D$2;Andreas::Table 1::D;"="&B4))


is not a proper one. I thought that you may be confused about the difference between applying a format to a cell and writing a DURATION function in a cell.


It can't hurt to read the guide, but I'm sorry that you didn't find any useful information to apply to your current problem.


Jerry

Mar 7, 2013 4:52 PM in response to Barry

Hi Barry,


thank you very much for your detailed reply.


The first difference I spot is that my duration is in hours:minutes 00:00 but this should not make a difference, right? I attach you here some sample data:


Project

Start date

Start time

End date

End time

Duration

Project 1

07.01.2013

11:00

07.01.2013

11:42

00:42

PINC: 1

07.01.2013

16:11

07.01.2013

17:11

01:00

Theatro

07.01.2013

19:50

07.01.2013

19:54

00:03

Project 3

08.01.2013

11:19

08.01.2013

13:30

02:11

Project 1

09.01.2013

12:32

09.01.2013

13:02

00:30

PINC: 1

09.01.2013

17:55

09.01.2013

18:29

00:34

Project 3

09.01.2013

18:29

09.01.2013

19:36

01:06


And I will go through my formular again and check if everything is correct.

Many greets, Andreas

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.

SUMIFS with Date Range and Condition

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