Obs147|簡易試算表外掛:CalcCraft,運算式儲存格

|300

Markdown的表格格式雖然簡單,但有時還是會有計算的需求,CalcCraft外掛提供了簡單的表格計算功能。
想要在Obsidian裡使用較完整的試算表功能的話,可以嘗試SpreadsheetsWorkbooks等外掛。

1. 儲存格(Calc Cell)運算式

  • colum-row notation: [+-]?[0-9]c[+-]?[0-9]r,c2=3c2r (column 3, row 2)
  • 相對位置:用+-表示目前儲存格的相關位置
    • =sum(c2:c4) 等於 =sum(+0c2r:+0c-1r) (+0c: 目前所在行,-1r: 上方一列)
  • 範圍表示:[Cell-start:Cell-end],例如[e2:e99],會以迴圈的方式處理
  • 游標移入運算格時,相關儲存格會高亮顯示
Row SKU Quantity (c) Unit Price (d) Amount (e) Test (f) > 3000 > 3000 range vector sum
2 Galaxy A21s Blue 10 100 =c2 * d2 =3c2r =e2>f5 =[e2:e99]>f5 =sum(c2:c4) =[c2:c4]+[d2:d4]
3 Galaxy A21s Black 20 200 =(-2c+0r * -1c+0r) =c2 =e3>f5 =sum(c2:c99)
4 Galaxy A21s white 30 300 =(-2c+0r * -1c+0r) =e4>f5 =sum(c2:d99)
5 Summary =sum(+0c2r:+0c-1r) =sum(+0c2r:+0c-1r) 3000
=sum(c2:c4)

gh

1.1. 行、列互換 =transpose()

  • 行列數必須一致
Row SKU Quantity (c) Unit Price (d) Amount (e) transpose
2 Galaxy A21s Blue 10 100 =c2 * d2 =transpose([c2:e4])
3 Galaxy A21s Black 20 200 =(-2c+0r * -1c+0r)
4 Galaxy A21s white 30 300 =(-2c+0r * -1c+0r)
5 Summary =sum(+0c2r:+0c-1r) =sum(+0c2r:+0c-1r)

gh

1.2. 對角 =diag

Row SKU Quantity (c) Unit Price (d) Amount (e) diagonal
2 Galaxy A21s Blue 10 100 =c2 * d2 =diag([c2:e4])
3 Galaxy A21s Black 20 200 =(-2c+0r * -1c+0r)
4 Galaxy A21s white 30 300 =(-2c+0r * -1c+0r)
5 Summary =sum(+0c2r:+0c-1r) =sum(+0c2r:+0c-1r)

gh

矩陣操作還有很多個,請自行參考作者GitHub網站說明。

  • matrix vector multiplication
  • determinant
  • conditionals
  • generate numbers and map them
  • test if it's numeric
  • change units

2. 相關鏈接

3. 教學影片

https://youtu.be/Ussk4xnIP2w

##

您可能也會有興趣的類似文章

您可能也會喜歡…

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *