At the end of section 3.5.1 of org manual there's a discussion of remote references, that's exactly what you're looking for:
You may also reference constants, fields and ranges from a different
table, either in the current file or even in a different file. The
syntax is
remote(NAME-OR-ID,REF)
where NAME can be the name of a table in the current file as set by a
‘#+NAME: Name’ line before the table.
Here, you should simply name your first table and enter a formula using the remote reference in the chosen cell, :=remote(attendance,@5$2)
.
#+NAME: attendance
| time | grade |
|--------+-------|
| week 1 | 1 |
| week 2 | 4 |
| week 3 | 2 |
|--------+-------|
| grade | 2 |
#+TBLFM: @5$2=vmean(@I..@-I)
#+NAME: grades
| assignment | grade |
|-------------+-----------|
| attendance | 2 |
| paper 1 | 2.5 |
| paper 2 | 2.5 |
|-------------+-----------|
| final grade | 2.3333333 |
#+TBLFM: @2$2=remote(attendance,@5$2)::@5$2=vmean(@I..@-I)
To update the tables, use M-x org-table-recalculate-buffer-tables
or M-x org-table-iterate-buffer-tables
if you set up complex table dependencies.
Note that in this particular case, it's certainly better to use @>$2
(last line, column 2): the @5$2
won't be updated automatically in the 'grades' table if you later add lines to the 'attendance' table. Another, more general, way to avoid this kind of problem is to use named references. Here, we name the cell grade
so that we can reference it as $grade
.
#+NAME: attendance2
| | time | grade |
|---+--------+-------|
| | week 1 | 1 |
| | week 2 | 4 |
| | week 3 | 1 |
|---+--------+-------|
| | grade | 2 |
| ^ | | grade |
#+TBLFM: @5$3=vmean(@I..@-I)
#+NAME: grades2
| assignment | grade |
|-------------+-----------|
| attendance | 2 |
| paper 1 | 2.5 |
| paper 2 | 2.5 |
|-------------+-----------|
| final grade | 2.3333333 |
#+TBLFM: @2$2=remote(attendance2,$grade)::@5$2=vmean(@I..@-I)