Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to calculate averages on my expenses spreadsheet, so I figured out I could do something like this:
- get all cells that have the text "electric bill"
- get the cell at the right of that one, get that value
- average all the values

How can I script this in OO calc? excel tips may work also.

share|improve this question
up vote 2 down vote accepted

In Excel 2007/2010 you can use AvereageIf. Assuming bill in column A and amount in column B:

=AVERAGEIF(A2:A10,"electric bill",B2:B10)

AverageIf in Excel

If OpenOffice doesn't support that, try SumIf divided by Countif:

=SUMIF(A2:A10,"electric bill",B2:B10)/COUNTIF(A2:A10,"electric bill")
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .