Skip navigation

Procedure

205 Views 3 Replies Latest reply: Aug 30, 2013 5:20 AM by Wayne Contello RSS
j-den Calculating status...
Currently Being Moderated
Aug 30, 2013 4:32 AM

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
  • Wayne Contello Level 6 Level 6 (12,820 points)
    Currently Being Moderated
    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.

     

    Screen Shot 2013-08-30 at 6.49.52 AM.png

     

    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"

  • Wayne Contello Level 6 Level 6 (12,820 points)
    Currently Being Moderated
    Aug 30, 2013 5:20 AM (in response to j-den)

    Greaty.  There are some super helpful people on these forums so post back with other questions.

     

    Best regards,

    Wayne

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.