Examples
Each example below is a standard Confluence table. Plain cells hold values you type. A cell written as =FORMULA → result holds a Calc macro with that formula, and result is what the page displays.
Every example names the macro it uses, because the two macros count cells differently:
- Calc Macro Pro — the header row is included. The top-left cell of the table is
A1, so the first data row is row 2. - Calc Macro Classic — the header row is skipped. The first cell below the header is
A1.
To add a formula, insert the macro in a cell, select it, choose Edit, and type the formula in the macro’s cell. See How to use.
Row totals
Section titled “Row totals”Add up each row. Macro: Calc Macro Pro.
| Item | Q1 | Q2 | Q3 | Total |
|---|---|---|---|---|
| Apples | 120 | 95 | 140 | =SUM(B2:D2) → 355 |
| Oranges | 80 | 110 | 60 | =SUM(B3:D3) → 250 |
| Pears | 45 | 50 | 70 | =SUM(B4:D4) → 165 |
Column total and average
Section titled “Column total and average”Summarize a column. Macro: Calc Macro Classic, so North is row 1 and the sales figures are B1:B4.
| Region | Sales |
|---|---|
| North | 1200 |
| South | 950 |
| East | 1430 |
| West | 780 |
| Total | =SUM(B1:B4) → 4360 |
| Average | =AVERAGE(B1:B4) → 1090 |
Quote with tax
Section titled “Quote with tax”Multiply quantity by unit price, then build the subtotal, tax, and total from the results of other formulas. Macro: Calc Macro Pro, with the custom number format #,##0 on every formula.
| Item | Qty | Unit price | Amount |
|---|---|---|---|
| Laptop | 3 | 1250 | =B2*C2 → 3,750 |
| Monitor | 5 | 320 | =B3*C3 → 1,600 |
| Cable | 12 | 8.5 | =B4*C4 → 102 |
| Subtotal | =SUM(D2:D4) → 5,452 | ||
| Tax (8%) | =ROUND(D5*0.08,0) → 436 | ||
| Total | =D5+D6 → 5,888 |
Test run summary
Section titled “Test run summary”Flag cases that need attention, count the passes, and show the pass rate. Macro: Calc Macro Pro. The pass rate uses the predefined Percentage format.
| Test case | Result | Follow-up |
|---|---|---|
| TC-01 | Pass | =IF(B2="Pass","Done","Investigate") → Done |
| TC-02 | Fail | =IF(B3="Pass","Done","Investigate") → Investigate |
| TC-03 | Pass | =IF(B4="Pass","Done","Investigate") → Done |
| TC-04 | Pass | =IF(B5="Pass","Done","Investigate") → Done |
| TC-05 | Blocked | =IF(B6="Pass","Done","Investigate") → Investigate |
| Passed | =COUNTIF(B2:B6,"Pass") → 3 | |
| Pass rate | =B7/COUNTA(B2:B6) → 60.00% |
Price lookup
Section titled “Price lookup”Look up a value in the same table with VLOOKUP. Macro: Calc Macro Pro.
| Code | Product | Price |
|---|---|---|
| A-100 | Notebook | 4.5 |
| B-200 | Pen | 1.2 |
| C-300 | Stapler | 12 |
| Look up | B-200 | =VLOOKUP(B5,A2:C4,3,FALSE) → 1.2 |
| Look up | C-300 | =VLOOKUP(B6,A2:C4,2,FALSE) → Stapler |
Calculate with dates built by DATE. These results do not change over time. Macro: Calc Macro Pro.
| Question | Answer |
|---|---|
| Days from 2026-01-15 to 2026-03-31 | =DATE(2026,3,31)-DATE(2026,1,15) → 75 |
| Weekdays in April 2026 | =NETWORKDAYS(DATE(2026,4,1),DATE(2026,4,30)) → 22 |
| Year of 2026-09-23 | =YEAR(DATE(2026,9,23)) → 2026 |
| Month of 2026-09-23 | =MONTH(DATE(2026,9,23)) → 9 |
Join and reshape text. Macro: Calc Macro Pro.
| First name | Last name | Full name | Tag |
|---|---|---|---|
| Ada | Lovelace | =CONCATENATE(A2," ",B2) → Ada Lovelace | =UPPER(LEFT(B2,3)) → LOV |
| Alan | Turing | =CONCATENATE(A3," ",B3) → Alan Turing | =UPPER(LEFT(B3,3)) → TUR |
Number formats
Section titled “Number formats”Show the same kind of value in different ways. Macro: Calc Macro Pro. The Format column names the format set in the Formula Settings dialog. See Number format.
| Value | Format | Result |
|---|---|---|
| 1234.5678 | Custom #,##0.00 | =A2 → 1,234.57 |
| 0.256 | Predefined Percentage | =A3 → 25.60% |
| 1234.5 | Predefined Currency | =A4 → $1,234.50 |
| 1234.5678 | Custom 0 | =A5 → 1235 |
Highest and lowest
Section titled “Highest and lowest”Find the highest and lowest values and the gap between them. Macro: Calc Macro Classic, so the points are B1:B4. Classic cannot use the result of another macro, so the gap is calculated in one formula.
| Sprint | Points |
|---|---|
| Sprint 1 | 21 |
| Sprint 2 | 34 |
| Sprint 3 | 28 |
| Sprint 4 | 19 |
| Highest | =MAX(B1:B4) → 34 |
| Lowest | =MIN(B1:B4) → 19 |
| Gap | =MAX(B1:B4)-MIN(B1:B4) → 15 |
Reference another table
Section titled “Reference another table”Convert amounts with a rate table elsewhere on the page. Macro: Calc Macro Pro. Tables are numbered from the top of the page starting at 0, so 0!B2 is cell B2 of the first table. See Sheet reference.
First table on the page:
| Currency | Rate to USD |
|---|---|
| EUR | 1.08 |
| GBP | 1.27 |
Second table on the page:
| Item | Currency | Amount | Amount (USD) |
|---|---|---|---|
| Hotel | EUR | 240 | =ROUND(C2*0!B2,2) → 259.2 |
| Train | GBP | 85 | =ROUND(C3*0!B3,2) → 107.95 |
| Total | =SUM(D2:D3) → 367.15 |