A nice little Calc spreadsheet function: SUMIF

I came across this while working with a spreadsheet that was perhaps a little too fancy to come over from Excel to OpenOffice Calc. Let's say you keep a spreadsheet full of various numbers, and they fall into about five or six categories. You have a bunch of things that are categorizable as:

business expense; donations; mortgage interest
toys; paints and crayons; DVDs; nap supplies
music festivals; improv classes; book club purchases; dance lessons
or other categories.

You want to add up all the items that are in one particular category since you want to know how much you're spending on music festivals; how much on climbing related purchases; etc. But the items are entered like this. Not really well categorized.