Skip to content

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.

Add up each row. Macro: Calc Macro Pro.

ItemQ1Q2Q3Total
Apples12095140=SUM(B2:D2) → 355
Oranges8011060=SUM(B3:D3) → 250
Pears455070=SUM(B4:D4) → 165

Summarize a column. Macro: Calc Macro Classic, so North is row 1 and the sales figures are B1:B4.

RegionSales
North1200
South950
East1430
West780
Total=SUM(B1:B4) → 4360
Average=AVERAGE(B1:B4) → 1090

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.

ItemQtyUnit priceAmount
Laptop31250=B2*C2 → 3,750
Monitor5320=B3*C3 → 1,600
Cable128.5=B4*C4 → 102
Subtotal=SUM(D2:D4) → 5,452
Tax (8%)=ROUND(D5*0.08,0) → 436
Total=D5+D6 → 5,888

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 caseResultFollow-up
TC-01Pass=IF(B2="Pass","Done","Investigate") → Done
TC-02Fail=IF(B3="Pass","Done","Investigate") → Investigate
TC-03Pass=IF(B4="Pass","Done","Investigate") → Done
TC-04Pass=IF(B5="Pass","Done","Investigate") → Done
TC-05Blocked=IF(B6="Pass","Done","Investigate") → Investigate
Passed=COUNTIF(B2:B6,"Pass") → 3
Pass rate=B7/COUNTA(B2:B6) → 60.00%

Look up a value in the same table with VLOOKUP. Macro: Calc Macro Pro.

CodeProductPrice
A-100Notebook4.5
B-200Pen1.2
C-300Stapler12
Look upB-200=VLOOKUP(B5,A2:C4,3,FALSE) → 1.2
Look upC-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.

QuestionAnswer
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 nameLast nameFull nameTag
AdaLovelace=CONCATENATE(A2," ",B2) → Ada Lovelace=UPPER(LEFT(B2,3)) → LOV
AlanTuring=CONCATENATE(A3," ",B3) → Alan Turing=UPPER(LEFT(B3,3)) → TUR

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.

ValueFormatResult
1234.5678Custom #,##0.00=A2 → 1,234.57
0.256Predefined Percentage=A3 → 25.60%
1234.5Predefined Currency=A4 → $1,234.50
1234.5678Custom 0=A5 → 1235

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.

SprintPoints
Sprint 121
Sprint 234
Sprint 328
Sprint 419
Highest=MAX(B1:B4) → 34
Lowest=MIN(B1:B4) → 19
Gap=MAX(B1:B4)-MIN(B1:B4) → 15

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:

CurrencyRate to USD
EUR1.08
GBP1.27

Second table on the page:

ItemCurrencyAmountAmount (USD)
HotelEUR240=ROUND(C2*0!B2,2) → 259.2
TrainGBP85=ROUND(C3*0!B3,2) → 107.95
Total=SUM(D2:D3) → 367.15