DEV Community

Cover image for What Graphium can do 03: Calculate between cells of a table
Masaya Kumagai
Masaya Kumagai

Posted on

What Graphium can do 03: Calculate between cells of a table

When you write down a bread recipe, you often want the hydration: the weight of the water divided by the weight of the flour. A Graphium note has a calculation block that works things out as you type, with variables and units. Write cell("table", "row", "column") there, and it reads one cell from a table in the same note, so you can calculate between cells.

water = cell("Dough", "Water", "Weight")
flour = cell("Dough", "Flour", "Weight")
water / flour * 100
Enter fullscreen mode Exit fullscreen mode

The row is found by the name written in the table's first column. You can also point at a row by its number, but then adding or reordering rows makes the line read a different value, and the line doesn't tell you which value it used. Since a note is a record, I wanted the line itself to read as "water weight over flour weight", so I made it look rows up by name. Units are read cell by cell, so even in a column that mixes g and mL, each value goes into the calculation with its own unit.

A Dough recipe table and a calculation block that reads the water and flour weights with cell() and works out the hydration

An empty cell isn't read as zero; the line says which cell is empty. It reads tables in the same note only.

How to write cell() is covered in the "Reading one cell" section of the manual. Available since v0.101.0 (2026-10-28).

https://kumagallium.github.io/Graphium/manual/notes-and-editor#reading-one-cell

Graphium is open source on GitHub.

https://github.com/kumagallium/Graphium

Top comments (0)