6

Is there any way to have time constant in an Org spreadsheet formula? For example, i would like to have something like this:

@>$3=@>$5-'08:00:00'*vcount(@2..@-1)

to calculate how much longer I've been at work than I have to be :) The @>$5 is the total sum of hours I've been at work and @2..@-1 are the rows with days I've been working.

1
  • 3
    “to calculate how much longer i've been at work than i have to be” while this doesn’t answer the question, the best way to achieve this goal might be to use org-clock-in.
    – Malabarba
    Oct 8, 2014 at 9:04

1 Answer 1

3

Org mode formulas use Calc mode under the covers and Calc has a format for specifying hours, minutes and seconds. See the Emacs manual.

You can therefore use 8@ to specify 8 hours, 0 minutes and 0 seconds.

I found that to get it to work I had to calculate the vcount first. So something like this:

@>$3=vcount(@2..@-1) * (@>$5-8@)
3
  • this doesn't work for me at all :( i get this result: pastebin.com/eBe6nuqT
    – user19689
    Oct 10, 2014 at 13:44
  • I'm not sure exactly what you're trying to do since in your paste vcount(@2..@-1) returns 1 and @>$5 is an empty/blank field. So the formula results in 1 * (0 - 8 hours). The result shown in @>$3 is quite correctly -8@ 0' 0." i.e. -8 hours, 0 minutes and 0 seconds. See pastebin.com/Xzam2S8m where I have changed your time format to the calc format, summed it up into @>$5 and subtrated 8 hours from it. (vcount(@2..@-1) is still returning 1 though).
    – conorbev
    Oct 10, 2014 at 15:25
  • thanks, this works if you don't use HH:MM:SS format, which is fine for my case
    – user19689
    Oct 13, 2014 at 12:31

Your Answer

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

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