1

Let's say I have two tasks with some duration in HH:MM format and value (points). I'd like to calculate the velocity (you can think of points as km and time in hours, you get km/h)

| task |     time | points | velocity |
|------+----------+--------+----------|
| A    |     0:45 |      2 | 2/0      |
| B    |     1:30 |      1 | 30       |
| Sum  | 02:15:00 |        | #ERROR   |
#+TBLFM: @4$2=vsum(@2..@3);T::$4=$3/$2

I can easily sum the duration adding ;T at the end of the sum formula (@4$2=vsum(@2..@3);T). However, the division of a number (the points in column 3) by a time in HH:MM format ($4=$3/$2) doesn't work out of the box.

How can I do it?

7
  • In the final row, $3 is not defined, so $2/$3 does not make sense. Did you mean to specify it somehow?
    – NickD
    Dec 20, 2021 at 14:39
  • Divide points by time? That does not make any sense to me. What do the "points" represent, what does the time represent and what are you trying to calculate?
    – NickD
    Dec 21, 2021 at 0:11
  • @NickD it's a velocity measure. Think of points as of km. You made 20 km in 0:20 hours (i.e. in 20 minutes), your velocity ("ratio") is 60. With time duration and points is common in project management (prioritisation is given to the task with higher velocity).
    – Max Li
    Dec 21, 2021 at 11:16
  • I was wondering about that. You should add that description in your question: if you had, we would not need all this discussion to get here.
    – NickD
    Dec 21, 2021 at 14:27
  • You should also edit your question to fix it: ATM it's very misleading because the description ("... the division of HH:MM format by a number...") is the exact opposite of the operation ($3/$2).
    – NickD
    Dec 21, 2021 at 15:00

1 Answer 1

1

I think the problem is in the structure of the division so time/number give a result if you add ;T.

Instead of $3/$2 (ratio/time), try $2/$3 (time/ratio):

| task |     time | points |    ratio |
| ---- | -------- | ------ | -------- |
| A    |     0:45 |      2 | 00:22:30 |
| B    |     1:30 |      1 | 01:30:00 |
| Sum  | 02:15:00 |        | 01:52:30 |
#+tblfm: @4$2=vsum(@2$2..@3$2);T::@3$4=$2/$3;T::@4$4=vsum(@2$4..@3$4);T
5
  • actually, $3/$2 instead of $2/$3 was a typo, sorry for that, in the table formula is was $2/$3. ";T" at the end of the formula worked indeed (i thought i tried it out). Thanks for the answer.
    – Max Li
    Dec 20, 2021 at 14:23
  • It's not quite clear what the OP really wants, but the basic error in his formula is that $3 is not defined in the final row. You have modified his formula to something else, so I'm not sure you are answering his question - although the fact that he has accepted your answer has confused me :-)
    – NickD
    Dec 20, 2021 at 14:41
  • @NickD thanks for formatting the tables. Looks like even without specifying $3 in the last row, the formula fills in $4 all the rows but the final one (for which it throws an error).
    – Max Li
    Dec 20, 2021 at 15:19
  • The formula in the answer is different from the formula in the question, so I'm not sure which formula you are talking about.
    – NickD
    Dec 20, 2021 at 15:45
  • @NickD actually, you were right that it wasn't clear that OP wants. I actually want to divide points by hour (I'll correct the question), and this doesn't work with ;T at the end of the division formula.
    – Max Li
    Dec 20, 2021 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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