=DATEVALUE() does not recognize date

homie

Board Regular
Joined
Nov 30, 2014
Messages
66
Hi,

I have a string that contains both date and time and I am trying to turn it into a date and time that Excel recognizes as such. To do so I have used =Datevalue and =Timevalue to extract the date and time, but it doesn't work. I was thinking it was because I am on a european computer with european settings and so datevalue does not recognize the American style dates in this format: m.d.yyyy. The time is in European format (not AM/PM), so 4:25 PM is written like 16:25. However, 4:25 AM is written like this 4:25 (i.e. without the 0 in front), so the number of characters for the time is not consistent, same is true for the date, i.e. 5/12/2017 is 12th of May 2017, and 6/5/2017 is 5th of June. Character length differs.
Here is an excerpt of my data:

Fiat DepositsTimestampDateTime
9/25/2015 19:54,5200,NOK9/25/2015 19:54#VALUE !#VALUE !
12/6/2015 17:27,330,NOK12/6/2015 17:2712.06.201517:27
12/14/2015 17:38,2000,NOK12/14/2015 17:38#VALUE !#VALUE !
12/23/2015 18:05,400,NOK12/23/2015 18:05#VALUE !#VALUE !
5/19/2016 5:28,5000,NOK5/19/2016 5:28#VALUE !#VALUE !
6/13/2016 16:08,500,NOK6/13/2016 16:08#VALUE !#VALUE !
6/22/2016 13:33,9200,NOK6/22/2016 13:33#VALUE !#VALUE !
10/2/2016 4:40,5000,NOK10/2/2016 4:4010.02.201604:40
12/20/2016 16:04,8198,NOK12/20/2016 16:04#VALUE !#VALUE !
12/25/2016 9:01,700,NOK12/25/2016 9:01#VALUE !#VALUE !
12/28/2016 22:40,1000,NOK12/28/2016 22:40#VALUE !#VALUE !
4/3/2017 16:42,5000,NOK4/3/2017 16:4204.03.201716:42
5/24/2017 7:32,100000,NOK5/24/2017 7:32#VALUE !#VALUE !

<tbody>
</tbody>


"Fiat Deposits" (colomun A) is string/text. Timestamp (B) = =LEFT(A2;FIND(",";A2)-1)
Date (C) =DATEVALUE(B2)
Time (D) =TIMEVALUE(B2)

I have tried formatting as date and time and general before and after copying both data and formulas. I have tried adding +0. Nothing works. As you can see from the excerpt the datevalue function incorrectly reads dates as dd.mm.yyyy. That is how I want it to show, but the source data in string in colomun A is not written as that, thus the =Datevalue recognizes the wrong date. In the other ones it just gets an #VALUE ! error because what it thinks is suppose to be the month is >12- E.g. 7/15/2017 it would not be able to read because it thinks it is the 7th day of the 15th month, which doesn't exist.

Times: It seems that if Excel does not understand the date, it doesn't understand the time either. If it understands the dates though, it shows the time correctly every time.

P.S. I have tried seperating the date and time part of the string in col B using =LEFT(FIND()) functions, but it doesn't seem to help. Excel still has trouble recognizing the dates in string even if they are seperated out in cells showing just the date.

Please help :)
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Before I retired I was a Business Improvement Leader for a very large company in London. The only sensible thing to do, imho, is to get the data formatted to meet your requirements before it is sent to you - or even give you access to the raw data. You have had some big guns trying to help you which demonstrates the need for a "rebuild" rather than add on patch repairs.
 
Upvote 0
Before I retired I was a Business Improvement Leader for a very large company in London. The only sensible thing to do, imho, is to get the data formatted to meet your requirements before it is sent to you - or even give you access to the raw data. You have had some big guns trying to help you which demonstrates the need for a "rebuild" rather than add on patch repairs.

Yeah, I tried getting the data formatted to meet my requirements without success. I am not in direct contact with the guy who supplies the data.
 
Upvote 0
you need to ask if you can have a meeting with this guy imho........
He's in America, I'm in Europe. I don't have his contact details either. My friend is hiring this guy, and he's pretty expensive, so I'm guessing my friend wants as few hours billed from him as possible. This is a side project that I'm helping a friend with, so this is not a part of the business of a corporation, i.e. this is not related to my day job.

Even in my day job for a medium sized company I find it sometimes easier to fix things myself than to ask my coworker who supplied the data to fix it. This even though it would take him 5 minutes to get it in a different format and me several hours to work around to fit my model. Because sometimes people are lazy and downprioritize you, and I sometimes have to ask 2-3 times and wait a week for a simple thing to get done. I guess that's just life when you are low on the totem pole in a big company.
 
Upvote 0
TimestampDateTime
9/25/2015 19:54
12/6/2015 17:27col A is text
12/14/2015 17:38
12/23/2015 18:05because the first is 9/25/2015
5/19/2016 5:28we must assume the format is
6/13/2016 16:08
6/22/2016 13:33m or mm /d or dd/yyyy h or hh :mm
10/2/2016 4:40
12/20/2016 16:04this column
12/25/2016 9:01has to be
12/28/2016 22:40UK format
4/3/2017 16:42as I am in UK
5/24/2017 7:32
you can make it USA
format
THIS COLUMN IS TEXTmonthdayhelperdayyeartimehelperhourminutesUK DATEtime
9/25/2015 19:54925/25201519:54195425/09/201519:54
12/6/2015 17:27126/26201517:27172706/12/201517:27
12/14/2015 17:381214/14201517:38173814/12/201517:38
12/23/2015 18:051223/23201518:05180523/12/201518:05
5/19/2016 5:28519/1920165:2852819/05/201605:28
6/13/2016 16:08613/13201616:08160813/06/201616:08
6/22/2016 13:33622/22201613:33133322/06/201613:33
10/2/2016 4:40102/2220164:4044002/10/201604:40
12/20/2016 16:041220/20201616:04160420/12/201616:04
12/25/2016 9:011225/2520169:0190125/12/201609:01
12/28/2016 22:401228/28201622:40224028/12/201622:40
4/3/2017 16:4243/23201716:42164203/04/201716:42
5/24/2017 7:32524/2420177:3273224/05/201707:32
every column in above table is a calculated field
it can be hidden out of sight of course
you need to reference only the last two columns then
the last 2 columns are working dates and times

<colgroup><col><col span="7"><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top