0

In my org file I have the table:

|   | Start date             | End date               | State | Task     | Duration/days | Duration (hours) |
|---+------------------------+------------------------+-------+----------+---------------+------------------|
| # | <2018-01-02 Wed 10:30> | <2018-01-02 Wed 12:00> | Taken | some url |        0.0625 |         01:30:00 |
| # | <2018-01-02 Wed 14:00> | <2018-01-02 Wed 18:00> | Taken | some url |      0.166667 |         04:00:00 |
| # | <2018-01-03 Tue 10:30> | <2018-01-03 Wed 12:00> | Taken | some url |        0.0625 |         01:30:00 |
| # | <2018-01-03 Thu 13:30> | <2018-01-03 Thu 18:00> | Taken | some url |        0.1875 |         04:30:00 |
|---+------------------------+------------------------+-------+----------+---------------+------------------|
|   |                        |                        |       |          |               |                  |

#+TBLFM: $6=date(<$3>)-date(<$2>)::$7=60*60*24*$6;T

I have a formula to calculate duration. Nice.

But also I need formulas for total sums in columns Duration/days and Duration/hours

So result must be like this:

|   | Start date             | End date               | State | Task     | Duration/days | Duration (hours) |
|---+------------------------+------------------------+-------+----------+---------------+------------------|
| # | <2018-01-02 Wed 10:30> | <2018-01-02 Wed 12:00> | Taken | some url |        0.0625 |         01:30:00 |
| # | <2018-01-02 Wed 14:00> | <2018-01-02 Wed 18:00> | Taken | some url |      0.166667 |         04:00:00 |
| # | <2018-01-03 Tue 10:30> | <2018-01-03 Wed 12:00> | Taken | some url |        0.0625 |         01:30:00 |
| # | <2018-01-03 Thu 13:30> | <2018-01-03 Thu 18:00> | Taken | some url |        0.1875 |         04:30:00 |
|---+------------------------+------------------------+-------+----------+---------------+------------------|
|   |                        |                        |       |          |      0.479167 |         11:30:00 |
  • I have added a very general solution there: emacs.stackexchange.com/a/46862/2370. There you do not need the duration in days anymore and you can add org time durations to get the total duration. – Tobias Jan 4 at 1:21
3

The following formulas work:

#+TBLFM: $6=date(<$3>)-date(<$2>)::$7=60*60*24*$6;T :: @>$6 = vsum(@I..@II) :: @>$7 = vsum(@I..@II);T

vsum is a calc function that adds the components of a 'vector' (here the contents of a column between the first and second hline separators). The last column needs a T format to tell calc that these are HMS values. @>$6 is org mode notation for the last row of column 6. See the References section in the org mode manual for more examples.

  • Is it possible to calc amount of hours WITHOUT column "Duration/days"? – Alexei Jan 4 at 8:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.