How to Sum Numbers Across Different Tables in LibreOffice Writer

LibreOffice Writer can handle some of the very basic tools that are part of Calc (the LibreOffice version of Microsoft Excel) with its Table function. For example, to sum up the contents of multiple cells and place the total in a new cell, you use the exact same formula, “=sum<[cellstart]:[cellfinish]>.

But what if you’re using multiple tables, and you need to insert mathematical formulas with inputs from one table and results from another? Like, say, you have a table of sales from one quarter, and a second table with sales from another quarter, and you want to combine both of those totals in a third table? Well honestly, at this point you should probably be using Calc. But if you’d rather not, it’s an easy solution.

Here’s an example of three tables in Writer. The first two tables contain sales for two separate quarters. For the third table, I want to combine the totals of the corresponding cells in the first and second table. The sum formulas in the last column will then give me the combined totals for both quarters.

The key here is a hidden property of each table: its name. LibreOffice Writer gives each table a default name in ascending order when you insert the table. On this page, the tables are named Table1, Table2, and Table3. For the sake of example, let’s change those names to something more specific.

First, click View > Toolbars and make sure “Table” is enabled. The toolbar will be docked to the bottom of the Writer window by default.

Now, click anywhere inside the first table to make it active, and then click the “Table properties” button (the one on the far right) of the toolbar.

In the “Table” tab, the first property is the table name. For this example, I’m going to change the names of my three tables to “FirstQ,” “SecondQ,” and “Year.” Click “OK” to apply the changes.

Next, go down to the third table and click cell B2. We want to combine the values of the B2 cells in tables FirstQ and SecondQ.

Type “=” to start a formula. Note that the cursor jumps to the formula toolbar at the top of the page.

Now you can begin a formula just like any other, but you’ll have to use some special syntax to call on cells from other tables. For any given cell, to distinguish it as a cell from another table, type the table name, a period, and then the cell name, and put that whole thing inside angle brackets (the less than/greater than symbols). So, for example, to insert the value of the B2 cell from our FirstQ table, we’d type:

<FirstQ.B2>

With these table differentiations, you can do anything you’d do with a normal cell value. Since we want to add the B2 cell values from the first two tables together, the total formula becomes:

=<FirstQ.B2>+<SecondQ.B2>

Press Enter in the formula toolbar and the formula is applied to the table, giving us the total.

Here, we’ve repeated this process across the entire third table, adding together the values from the various cells from the first two tables. Note that the formulas for the totals in the fifth column still work, even though those formulas (like =sum:<B2:D4>) are only being applied to the third table itself.

Remember to add the table name, period, and close the value with angle brackets, and you can use pretty much any available formula while calling values from other tables. You can auto-apply the table and cell in the formula toolbar by clicking them.

Michael Crider has been covering technology on the web since 2011. His interests include folk music, football, science fiction, and salsa verde, in no particular order. He wrote a novel called Good Intentions: A Supervillain Story, and it's available on Amazon. You can follow him on Twitter if you want.