# Simple Table Math A plugin for Obsidian that performs mathematical operations on Markdown tables. It dynamically calculates and displays results within your tables as you edit them. You can also copy the results to your clipboard, either via a keyboard shortcut or via the context menu. https://github.com/user-attachments/assets/af3b295f-5bbd-497f-b507-696e9fcbb690 ## How to Use The plugin allows you to perform calculations (sum, average, minimum, maximum, subtraction, multiplication) on columns or rows of numbers within your Markdown tables. To trigger a calculation, place a special tag within a table cell. The tag follows this format: `[operation][direction][start:end][currency]` * **`[operation]`**: A three-letter code indicating the operation: * `SUM`: Calculates the sum of the values. * `AVG`: Calculates the average of the values. * `MIN`: Finds the minimum value. * `MAX`: Finds the maximum value. * `SUB`: Subtracts the subsequent values from the first value. * `MUL`: Multiplies all the values together. * **`[direction]`**: Indicates the direction of the values to operate on: * `^`: Looks at the cells above the current cell in the same column. * `<`: Looks at the cells to the left of the current cell in the same row. * **`[start:end]`** (Optional): Specifies a range of cells to include in the calculation. * If omitted, it defaults to all applicable cells in the specified direction. * Use a colon-separated format (e.g., `1:3` for the first three cells). The indices are 1-based. * You can also just specify a start (e.g., `2`). * **`[currency]`** (Optional): A 2-4 letter currency code (e.g., `USD`, `EUR`, `GBP`). If provided, the result will be formatted with the specified currency symbol. ## Examples **A simple summing example:** ``` | Just Numbers | | -----------: | | 100.00 | | 50.00 | | 25.00 | | 12.50 | | SUM^ | ``` **Calculating the average and sum of columns:** ``` | Name | Jan | Feb | Mar | Total | |:----------- |:---- |:---- |:---- |:----- | | Alice | 10 | 20 | 15 | SUM< | | Bob | 5 | 12 | 8 | SUM< | | **Average** | AVG^ | AVG^ | AVG^ | | ``` **Combining operations and displaying currency symbols:** ``` | Item | Price | Quantity | Total | | :---------- | :----: | :------: | ---------: | | Apple | $ 1.00 | 5 | MUL `Community plugins`. 3. Make sure `Safe mode` is off. 4. Click `Browse` and search for "Simple Table Math". 5. Click `Install` and then `Enable` the plugin. ### Manually: You can install it either by using [BRAT](https://obsidian.md/plugins?id=obsidian42-brat) or manually by following the instructions below: 1. Download the latest release from the [Releases](https://github.com/eatcodeplay/obsidian-simple-table-math/releases) page. 2. Extract the downloaded ZIP content into a new folder in your Obsidian vault's plugins folder (e.g., `/.obsidian/plugins/simple-table-math`). 3. **Note:** On some operating systems, the `.obsidian` folder might be hidden. Make sure to show hidden files in your file explorer. 4. Open Obsidian. 5. Go to `Settings` -> `Community plugins`. 6. Make sure `Safe mode` is off. 7. Find "Simple Table Math" in the list and enable it. ## Contributing If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/eatcodeplay/obsidian-simple-table-math/). ## License [MIT License](LICENSE) --- **Enjoy doing math in your Obsidian tables!**