Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

Procedure

It would be great to obtain some help to find the formula to obtain a code to implement the following procedure in numbers, iWork. Basically, I want to compare a cell (lets call the cell "a1") with a range of cells (abbreviated with "ci" where i stands for a range of numbers, e.g.1 to 10 so that we obtain the cell c1, c2 etc). If a1=ci, then I would like numbers to add add the respective values of bi (where b is a different column but the same row "i") and return the value of the sum. I hope my description makes sense.


abc:=proc(a1,c,b) #where c=column and a1=cell, b=column

q:=0
for i from 1 to 10 do #range 1 to 10 for simplification, best would be to add variables to that too

if ci=a1 then

q:=(q+bi);
end if;
end do;

return(q);

end proc;


Any help would be very much appreciated!

Numbers-OTHER

Posted on Aug 30, 2013 4:32 AM

Reply
Question marked as Best reply

Posted on Aug 30, 2013 4:54 AM

there is a function called sumif() that will conditaionally sum a cell in a column if the value in another column meets a condition.


User uploaded file


In this example A1 if the value to test for. Column B is what is conditionally summed, and column C is what is compared to A1


A4=SUMIF(C, A1, B)


column C contains the test values

A1 contains the condition

column B contains the sum values when the valus in the same row matches the value in A1



There is a function reference builting that is pretty helpful. You can open this vy selecting the menu item "View > Show Function Browser"

3 replies
Question marked as Best reply

Aug 30, 2013 4:54 AM in response to j-den

there is a function called sumif() that will conditaionally sum a cell in a column if the value in another column meets a condition.


User uploaded file


In this example A1 if the value to test for. Column B is what is conditionally summed, and column C is what is compared to A1


A4=SUMIF(C, A1, B)


column C contains the test values

A1 contains the condition

column B contains the sum values when the valus in the same row matches the value in A1



There is a function reference builting that is pretty helpful. You can open this vy selecting the menu item "View > Show Function Browser"

Procedure

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