DATEDIF function in LibreOffice with mm/dd/yyyy format
-
- Posts: 7
- Joined: Fri Jun 24, 2016 3:15 am
DATEDIF function in LibreOffice with mm/dd/yyyy format
Hello,
I can't seem to use the datedif function in case my dates are in mm/dd/yyyy and it always returns #NAME as value. I am using datedif(A2,B2,d). If it only works with a certain format is there a way to convert my existing dates to that format?
I can't seem to use the datedif function in case my dates are in mm/dd/yyyy and it always returns #NAME as value. I am using datedif(A2,B2,d). If it only works with a certain format is there a way to convert my existing dates to that format?
LibreOffice 5.1.2.2 on Ubuntu 16.04
Re: datedif function in libreoffice with mm/dd/yyyy format
Are your dates actually text in mm/dd/yyyy or are they numbers in the mm/dd/yyyy format?
You can use Ctrl+F8 to turn on/off Value highlighting to determine this. If you have text, then they will stay/turn black. If they are numbers, then they will turn blue.
The fact that you are getting #NAME, however, makes me wonder if the DATEDIF function (which is one I've never heard of) is valid.
If you are sure the function is valid, then reporting how your data is set up (text/numbers) will help with determining the best way to get the information into a format that the function requires.
You can use Ctrl+F8 to turn on/off Value highlighting to determine this. If you have text, then they will stay/turn black. If they are numbers, then they will turn blue.
The fact that you are getting #NAME, however, makes me wonder if the DATEDIF function (which is one I've never heard of) is valid.
If you are sure the function is valid, then reporting how your data is set up (text/numbers) will help with determining the best way to get the information into a format that the function requires.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: datedif function in libreoffice with mm/dd/yyyy format
A quick look online for help information regarding this function shows that the third parameter needs to be enclosed in quotation marks.
Your post does not show the parameter in quotation marks.
Your post does not show the parameter in quotation marks.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
-
- Posts: 7
- Joined: Fri Jun 24, 2016 3:15 am
Re: datedif function in libreoffice with mm/dd/yyyy format
I did Ctrl + F8 and one of the date columns turned blue the other one didn't. I tried applying format by right-clicking -> format and selecting date to the column that didn't turn blue but it still remains black. I tried quotation marks also but that gives me another date like 08/26/03 instead of no. of days. =DATEDIF(B2,F2,"d") B2 = 07/07/14
, F2 = 03/02/18
, F2 = 03/02/18
LibreOffice 5.1.2.2 on Ubuntu 16.04
Re: datedif function in libreoffice with mm/dd/yyyy format
See also: https://ask.libreoffice.org/en/question ... yy-format/
Please always crosslink posts if you exceptionally start a topic in more than one forum.
Please always crosslink posts if you exceptionally start a topic in more than one forum.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: datedif function in libreoffice with mm/dd/yyyy format
Changing the display format doesn't change the type of value stored in a cell. You could try using Data | Text to Columns - with Detect special numbers checked - to convert the date strings to numeric.I tried applying format by right-clicking -> format and selecting date to the column that didn't turn blue but it still remains black
I'd guess that you imported these dates from somewhere - if from a CSV file make sure the Detect special numbers option is checked.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: datedif function in libreoffice with mm/dd/yyyy format
The LibreOffice help uses ISO strings for demonstration purposes because this is the one and only kind of string that converts unambiguously to a day number. With dates like "1/3/1999" the same formula would return different results in the USA and the rest of the world. In a real spreadsheet you use references to date cells.LibreOffice Help wrote:Birthday calculation. A man was born on 1974-04-17. Today is 2012-06-13.
=DATEDIF("1974-04-17";"2012-06-13";"y") yields 38. =DATEDIF("1974-04-17";"2012-06-13";"ym") yields 1. =DATEDIF("1974-04-17";"2012-06-13";"md") yields 27. So he is 38 years, 1 month and 27 days old.
=DATEDIF("1974-04-17";"2012-06-13";"m") yields 457, he has been living for 457 months.
=DATEDIF("1974-04-17";"2012-06-13";"d") yields 13937, he has been living for 13937 days.
=DATEDIF("1974-04-17";"2012-06-13";"yd") yields 57, his birthday was 57 days ago.
DATEDIF(A1;B1;"m") returns the correct result if A1 and B1 contain day numbers (dates) regardless of any cell formatting.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: datedif function in libreoffice with mm/dd/yyyy format
By the way: DATEDIF() with "d" in the third place doesn't make much sense.
If the dates actually are dates in numerical spreadsheet representation simply is with the disadvantage that negative differences throw an error instead of being passed as the result.
If the dates actually are dates in numerical spreadsheet representation
Code: Select all
=DATEDIF(StartDate;EndDate;"d")
Code: Select all
=EndDate-StartDate
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: DATEDIF function in LibreOffice with mm/dd/yyyy format
You surely entered a "d" in the third position, didn't you?
Calc would try to interpret a d without the doublequotes as a reference to a text (the controlling character) and fail if not a named reference with name d exists.
DATEDIF() doesn't worry about formats as long as you pass dates represented by numbers to it as the first two arguments. The standard representation of dates in spreadsheets is the number of days since 1899-12-30 as day zero.
If you pass text to the function it needs to convert it. This is done as if the DATEVALUE() function is additionally applied first. For this to work correctly the used format must comply with your locale (or an applicable setting under date acceptance patterns; not recommended in this contex).
The only format recognised under any locale for dates given as texts is as specified in ISO 8601 (with delimiters). The code for numeric dates to display in this format would be "YYYY-MM-DD". In fact this is the only reasonable date format at all.
Calc would try to interpret a d without the doublequotes as a reference to a text (the controlling character) and fail if not a named reference with name d exists.
DATEDIF() doesn't worry about formats as long as you pass dates represented by numbers to it as the first two arguments. The standard representation of dates in spreadsheets is the number of days since 1899-12-30 as day zero.
If you pass text to the function it needs to convert it. This is done as if the DATEVALUE() function is additionally applied first. For this to work correctly the used format must comply with your locale (or an applicable setting under date acceptance patterns; not recommended in this contex).
The only format recognised under any locale for dates given as texts is as specified in ISO 8601 (with delimiters). The code for numeric dates to display in this format would be "YYYY-MM-DD". In fact this is the only reasonable date format at all.