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

Numbers. Sum cells with conditions

Hello

I have three columns full of numbers; A, B and C.

I need a cell to have a formula that gives me the result of sum the cells of column C when in their corresponding ones in the same row, the value of the cell of A is greater than the value of that of B. That is, if in A5 we have the value 5 and in B5 the value 4, the value of C5 must be sum to that of other values ​​of cells in C where the fact that in the same row the value of A is greater than that of B. I would also need to know the times that happens, that the value of A is greater than that of B in the same row.

Thanks

iPad Pro Wi-Fi, iOS 11, null

Posted on Nov 15, 2017 2:22 PM

Reply
Question marked as Best reply

Posted on Nov 15, 2017 6:31 PM

Hi Francisco,


Try this. This table has a Header Row and two Footer Rows. Add another column (D)

User uploaded file

Formula in D2 (and Fill Down)

=IF(A2>B2,"Yes","No")


Formula in Footer cell D7 =SUMIF(D,"=Yes",C)

Formula in Footer cell D8 =COUNTIF(D,"=Yes")


Regards,

Ian.

10 replies

Nov 16, 2017 3:05 AM in response to franciscofromalmeria

Hi Francisco,


I have edited that table to help me understand the "more complex" problem.

User uploaded file

Please help us to help you, by telling us what Column C contains.


I do not want to have to add additional columns.


You can hide Column D

User uploaded file

User uploaded file

Please tell us about the mysterious Column C. There are many helpful contributors here, but we need more information.


Regards,

Ian.

Nov 16, 2017 2:00 AM in response to franciscofromalmeria

Hi Francis,


If this were possible in Numbers, do you not think one or the other of us would have mentioned it?


OpenOffice (and LibreOffice) were designed to behave very much like MS Excel.

Numbers is not (and was obviously never intended to be) an Excel clone.


MS chose to diversify some functions (such as SUMPRODUCT) to do things beyond what their name suggests. Apple, in the case of Numbers, appears to have chosen to stay within the bounds indicated by the name of the function:


The SUMPRODUCT function returns the sum of the products of corresponding numbers in one or more collections.


IF you want to add condition(s), then you need to use one of the functions with …IF or …IFS in its name. Ian (Yellowbox) chose SUMIF and COUNTIF to get the two results you are looking for.


The collection of test values must be the same size as the collection of sum values, which doesn't permit test values taking two columns and the sum values taking only one. Ian handles that issue by doing the comparison with a formula that produces a single value ("Yes" or "No") indicating whether the pair of values in each row of columns A and B meets the condition for being included or excluded from the SUM or COUNT, making it possible to place the (new) test values in a single column, fulfilling the requirement that the ranges holding the test values and the sum values be the same size.


The extra column is needed for the calculations, but it's not necessary that this column be visible.


You've said that your actual problem is "something more complex." Often the printer's statement that 'the devil is in the details' holds for spreadsheet issues as well. Would you care to share the details of this complexity?


Regards,

Barry

Nov 17, 2017 7:22 AM in response to franciscofromalmeria

franciscofromalmeria wrote:


sumproduct (a > b; c)

Is this possible in numbers?


That's a really handy form of SUMPRODUCT(). It's not really an "extension" of what SUMPRODUCT() does. It's a so-called "array formula" version of SUMPRODUCT(). Excel and some other spreadsheet apps are able to manipulate a list or array of values in memory without taking up space in the cells grid on the spreadsheet. Numbers (with a few exceptions) doesn't support this, so you just to list the values or intermediate calculation in a range of cells. Hence the need for an extra column here.


SG

Numbers. Sum cells with conditions

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