Static vs. dynamic time

Hi,

I use the formula IF(A1<>"";NOW()) copied to every cell of column B.
It gives me the correct time every time I type anything on a line of column
A.
But this is refreshed constantly by the time of the computer, not the time I
typed something in column A.
I tried looking for a static version of NOW() or playing with iterations
(probably not correctly) or looking for a way to stop recomputing this
specific column to no avail.
Is there a way to set on column B the time of the typing on each line of
column A and keep it as a static time.

I am usually good with formulas, but this very basic need escapes me.
As far as usability is concerned, a STATICNOW() function seems much more
useful than the current NOW() function. Or inserting a 0,1 argument for
staticness or something.
So far, I am forced to type or insert the time manually each time.
Let me repeat it: Manually each time! Me! :wink:

Thanks,
Chimel.

I use the formula IF(A1<>"";NOW()) copied to every cell of column B. It gives me the correct time every time I type anything on a line of column A. But this is refreshed constantly by the time of the computer, not the time I typed something in column A. I tried looking for a static version of NOW() or playing with iterations (probably not correctly) or looking for a way to stop recomputing this
specific column to no avail. Is there a way to set on column B the time of the typing on each line of column A and keep it as a static time.

This is a simple question but unfortunately does not appear to have a simple answer. But - like with your other question - you can do something using a recursive formula. Enter into B1
=IF(A1="";"";IF(B1="";NOW();B1))
Once again, you need to have Tools | Options... | LibreOffice Calc | Calculate | Iterative References | Iterations ticked.

This almost works, in that if A1 is empty and you enter something there, then B1 will change to record the time. But if you now simply overtype what is already in A1, B1 will not change. There is an easy workaround, however: before typing your new value into A1, just press Delete to empty A1 (B1 will now be empty too) and then enter your new value (B1 becomes the new time).

So far, I am forced to type or insert the time manually each time.

No longer!

I trust this helps.

Brian Barker

This is exactly the formula I needed, it works just fine every time. Thanks
again, Brian.

Hi,

I use the formula IF(A1<>"";NOW()) copied to every cell of column B.
It gives me the correct time every time I type anything on a line of column
A.
But this is refreshed constantly by the time of the computer,

Yes, that's the point with the NOW() function. It's usually used for
calculating time, for instance how long ago a certain date was, for
instance =NOW()-A1, which you then format to whatever format you like. With
no formatting you get it in days.

not the time I

typed something in column A.

That's correct and intended.

I tried looking for a static version of NOW() or playing with iterations

(probably not correctly) or looking for a way to stop recomputing this
specific column to no avail.
Is there a way to set on column B the time of the typing on each line of
column A and keep it as a static time.

Yes, I actually do that in a Google Spreadsheet, but it can be done in all
spreadsheets that support macros or scripts, I think.

I am usually good with formulas, but this very basic need escapes me.

It's probably because there is no cell function for that. You have to
create your own.

As far as usability is concerned, a STATICNOW() function seems much more

useful than the current NOW() function.

It depends on what you want to do. See above. I find both useful, but in
different situations.

Or inserting a 0,1 argument for
staticness or something.
So far, I am forced to type or insert the time manually each time.
Let me repeat it: Manually each time! Me! :wink:

I'll experiment a bit with a macro for this. I'm back when done, if nobody
beats me to it.

Kind regards

Johnny Rosenberg

Some disappointment:

Now I'm not so sure any more that this is possible. My idea was to check
the currently selected cell, but it has two big flaws:
1: When updating cell contents, any cell can be selected.
2: ThisComponent.CurrentSelection.getValue() seems to always return 0 in a
situation like that, no matter which cell is selected and no matter its
value… but even if that part worked, the whole thing wouldn't work anyway,
see 1.
So I simply failed to make it work. Sorry.

In my Google Spreadsheet, I have a script that fills in the corresponding
cell in column A if one of a few cells in the same row was filled, but
there doesn't seem to be any (easy) way to trigger a macro to run when a
cell was changed in LibreOffice. Maybe trying with listeners, but I never
studied those so I'm totally clueless about them.

In Google Spreadsheets you only have to create a function and call it
OnEdit(). It will run every time a cell is changed. In that function, you
just write code to find out what cell was changed and if a cell in a
certain column or cell range was changed, just fill in the current date
and/or time value in your time- or date column at the same row as the cell
that was changed. It's actually very straight forward.

Anyway, odd that I couldn't find an easy way to do it in LibreOffice Calc.
I'm sure it's possible, but I don't have a clue how to do it, at the
moment. I'm sure I'm overlooking something. This should be easy, shouldn't
it?

A few simple workarounds that comes to mind:

Use the pre-defined keyboard shortcuts to insert date, time or date and
time. I don't remember the shortcuts now, because I changed mine (to Ctrl+↵
for date), but maybe it is Ctrl+; that is the same as in Excel?
Another workaround is to use the NOW() function and when finished just
select all date cells and then hit Ctrl+c Insert ↵. Ctrl+c for copying the
cell range, Insert for Paste Special (or is that just another one of those
keyboard shortcuts that I changed on my own setup?) and ↵ for executing the
paste.

Or write a macro that replaces all date cell's formulas with their values
automatically and run it before saving your spreadsheet. Or maybe let the
same macro also save the spreadsheet and use that macro instead of Ctrl+s
for saving.

Kind regards

Johnny Rosenberg

What does this have to do with LO?

When I have needed a static date or time in Libreoffice Calc, I have found
that the only way to do this is to enter the date or time directly into the
spreadsheet and not to use a formula.

As an example of this, I have been using Calc to measure the drift of
timepieces compared to a time standard at weekly intervals over a 26 week
period. I pre-enter the dates at which the measurements are to be made.
At the required date, I simply enter the time as shown on the timepiece and
the time as shown on the time standard at the same instance. These times
are then converted to seconds and the difference between in seconds is then
calculated and charted to show the time drift. These times and dates are
static and can be used for later referral.

I am not sure if there is a way to use a formula or macro to enter a static
date. If there is, it is beyond my capabilities. Entering dates and times
directly seems very straightforward to me.

Mike
email: michaelgmanning@gmail.com
Libreoffice https://www.libreoffice.org/

Was looking for options on this, but haven't found exactly what I'm
looking for.
Closest I've found is Ctrl + ; that inserts current date
and Ctrl + Shift + ; that inserts the current time.
Both seem to be the fixed value?

But have found no way to do that in a formula??

Recall long ago in either Lotus or Quattro, you could use now() and then
{Calc} and it would convert the current time to the fixed value. But that
was long long ago. Macro recorder doesn't seem to record that kind of
stuff, and entering formulas don't either.

There is an option that I have found accidentally: If you want to enter the present time as static, use Insert > Time  or Ctrl+Shift+;

But if you want to enter the present time as dynamic use =NOW().

Dan

<!--
/* Font Definitions */
@font-face
  {font-family:"Cambria Math";
  panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
  {font-family:Calibri;
  panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
  {margin:0cm;
  font-size:11.0pt;
  font-family:"Calibri",sans-serif;}