views:

238

answers:

1

Hi,

I'm trying to calculate F-scores (using the formula 2 * a * b / (a + b)) in OpenOffice.org Calc, and would like a and b to be the previous two cells in the same row.

My problem is that while trying to define a function in OpenOffice.org Basic, I get an error that the ADDRESS and INDIRECT methods aren't defined.

How would you define a function that when run on a cell can refer to adjacent cells?

Edit: A bit of clarification. I'm actually looking for a way that if a function (let's call it F) is run in cell C1, the function automatically fetches the values from cells B1 and A1. Basically, calling =F() in C1 should return the result without my having to specify A1 and B1.

Also, if it could be run for a whole column, that would be helpful too.

A: 

Cell values:

A1 1

B1 2

C1 =(2*A1*B1)/(A1+B1)

in C1 everything goes in, including the = sign. The = sign designates the contents of the cell as a formula.

jhamm
Please check the edit on the original question.
Jory
Sorry. I realize your question was for a OO Basic function, but I am not familiar with OO Basic. I was able to come up with another set of formulas. I think formulas allow this solution to be more flexible.Cells: a b c1 =SUM(A2:A3) =SUM(B2:B3) =(2*A1*B1)/(A1+B1)2 1 23 1 2The formulas in A and B can be extended to cover the whole column by changed the second number to the last row number of your column.Ex: if you have 525 records, A1 formula would be =SUM(A2:A525)Is there a specific reason to use a function rather than using formulas?
jhamm