At 14:53 21/01/2009 +0100, Peter Schramm wrote:
I want to calculate a number of days with the "days?" "TAGE"-function in OO 2.4.1. The two values should contain a date and a time in one field each and the result should be a float value of days. A college of mine wants it like that and has stated that it was functioning in earlier times ;-)) Can I get an example how the date and time value has to be written to realize that or is this function lost due to the 2.4.1 version of OO.

If I understand you correctly, this may be easier than you think: you will not need a function. You have two date-and-time values in spreadsheet cells and you want to calculate the difference as a numeric, fractional number of days - is that right?

Date and time values are stored in Calc as fractional numbers of days; they display as they do only because of the cell formatting. If you calculate the difference between two such values - using =B1-A1 or similar - you will have the answer you need, with the only problem being that the result will naturally display as a date and time, which is not what you want. Select the result cell, go to Format | Cells... | Numbers, choose Numbers under Category, and then make an appropriate choice under Format (or construct your own). Note that the General format will not work, as the differences will then show as dates or times.

An alternative way to force the result to be seen as a number rather than a date or time is to use the VALUE() function. If you use =VALUE(B1-A1), the General format in the result cell will work for you.

I trust this helps.

Brian Barker


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to