Here's the code:
(defun bill/calc (end)
(goto-char end)
(re-search-forward "\n")
(when (org-at-table-p)
(org-table-analyze)
(let* ((table-start (point))
(rows (1- (length org-table-dlines)))
(table-end (re-search-forward "\n" nil t rows))
(inside (<= table-start action-key-depress-prev-point table-end)))
(when inside
(goto-char action-key-depress-prev-point)
(org-table-maybe-eval-formula))
(goto-char table-start)
(call-interactively 'org-table-recalculate)
(org-table-align))))
(defib recalc ()
"recalculate a table"
(save-excursion
(let* ((pos (point))
(eol (progn (re-search-forward "\n") (point)))
(bol (progn (re-search-backward "\n" nil t 2) (1+ (point))))
(start (progn (goto-char pos) (re-search-backward "<" bol t)))
(end (progn (goto-char pos) (re-search-forward ">" eol t))))
;;(message "pos: %s, prev: %s" (point) action-key-depress-prev-point)
(and start end (string-match "<recalc[> ].*" (buffer-substring start end))
(hact 'bill/calc end)))))
Here's an example table you can put anywhere. Just shift-middle-click on it to recalculate the org-mode table. Also, if you type a formula (and keep the cursor on the same line) and then shift-click recalc, it'll handle the formula:
<recalc>
| a | 12 |
| a | 5 |
#+TBLFM: @1$2=3*4::@2$2=2+3