1

Consider the following org-table, where the first 3 columns are inputs:

|----------+-------+-------+----------+------+--------|
|     Date | Start |   End | H. slept |      |  Delta |
|----------+-------+-------+----------+------+--------|
| 20230727 |  3:30 |  8:30 |    05:00 | 8:00 | -03:00 |
| 20230728 |  1:00 |  8:30 |    07:30 | 8:00 | -00:30 |
| 20230729 |  1:00 |  9:00 |    08:00 | 8:00 |  00:00 |
| 20230730 |  0:00 |  9:00 |    09:00 | 8:00 |  01:00 |
| 20230731 |  1:45 |  8:50 |    07:05 | 8:00 | -00:55 |
|----------+-------+-------+----------+------+--------|
|     Mean | 01:27 | 08:46 |    07:19 |      | -03:25 |
|----------+-------+-------+----------+------+--------|
#+TBLFM: $4=$3-$2;U::$6=$4-$5;U::@7$2=vmean(@II..@III);U::@7$3=vmean(@II..@III);U::@7$4=vmean(@II..@III);U::@7$6=vsum(@II..@III);U

I would like to delete $5, and put the 8 hours directly in $6 formula instead. How could I do that to produce the same results?

3
  • I guess HMS-Formats is supposed to provide an explanation on how to do that. But unfortunately, I'm not able to understand it (too cryptic for me)...
    – crocefisso
    Jul 31, 2023 at 7:13
  • 1
    You can shorten the #+TBLFM line by using a range on the LHS: #+TBLFM: $4=$3-$2;U::$6=$4-$5;U::@7$2..@7$4=vmean(@II..@III);U::@7$6=vsum(@II..@III);U. And instead of @7, it's probably better to use @> ("the last row" - see References).
    – NickD
    Jul 31, 2023 at 16:23
  • Thank you @NickD, I didn't know about @7$2..@7$4=. However, I find its use problematic since it is incompatible with doing C-u C-= on cells.
    – crocefisso
    Aug 4, 2023 at 6:31

1 Answer 1

2

You can add or subtract seconds to a calc time.

So your formula for column 6 can be:

$6=$4-(8*3600)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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