| LearnOpenOffice.org | |
| Creating calculations
The sample spreadsheet contains columns displaying both cost and Sales price. Let's define a new column called “margin” that gets its values from a formula. To derive margin for an item subtract its cost from the sales price. First, insert a column for margin by right clicking on the column header and selecting insert columns. Next, type the word “margin” as a column title. Next, define a formula. Click a cell to hold the formula and press the 'Equals' key. That's how OpenOffice knows you are entering a calculation rather than just a value. Type C2 (which is the address of the cell containing the price value) minus D2 (the address of the cell containing the cost value) click the “check” button or press enter to save the formula. You'll now see that Calc has calculated “margin” for us based on the formula that was just entered. Of course, you'll want to calculate margin for more than just the first row, you want to calculate it for every item. You could go to each cell and type in a formula but that’s an awful lot of work. You can use Calc to do it the easy way. First, we'll copy the cell that contains the calculation. Then we’ll select every cell in which we want the formula to appear. Then we'll select Paste from the edit menu. Now, we see that Calc has adjusted our formula to make it work for every value in the column. This was all done by the magic of relative cell addresses. |
||