2015 Archives by date, by thread · List index

# Re: [libreoffice-users] time and date difference

```At 01:46 24/04/2015 -0700, Simone Serra wrote:
```
I am using LibreOffice Version: 4.3.0.4 and I am having issues calculating time differences. I would like to calculate the time difference in hours between the following
```date/times:
E14 = 23/04/2015 15:30
E15 = 25/04/2015 16:20
E16 = DAYS(E15;E14)

But I get a value error ...
```
```
```
This should work (if your date locale is set appropriately) if these are genuine date values, i.e. numbers formatted as "DD/MM/YYYY HH:MM" - but not if the cell contents are text values.
```
```
```so I split data:

F14 = 23/04/2015
F15 = 25/04/2015
F16 = DAYS(F15;F14)  ---> Ok, I get 2, multiply  x 24 = 48h and it's fine
```
```
This mean that you *do* now have these values as genuine dates, not text.

```
```then for the hours

G14 = 15:30
G15 = 16:20
G16 = (G15<G14)+G15-G16 (as suggested by the wiki:
https://help.libreoffice.org/Calc/Calculating_Time_Differences)
but again I have a value error..
```
```
```
If you really have put a formula including G16 into G16, then you have a circular reference, and you may see Error 522.
```
```
```does anyone knows how can I solve this??
```
```
If you use
=(G15<G14)+G15-G14
it should work (whether you have times or text).

```
It's important to understand the effect of cell formatting in spreadsheets. When you type something into a cell, the value may be converted and the cell formatting may be changed. Such changes may not be immediately evident, but you need to appreciate them if you are to see why formulae work or don't work. There are two facilities that may help:
```
```
o Unless you have specifically set cell alignment, text values will be left-aligned and numbers (including date/times) will be right-aligned.
```
```
o Go to View | Value Highlighting (or Ctrl+F8). Text values show in black and numbers (including date/times) in blue.
```
I trust this helps.

Brian Barker

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
```