Formula Help - Converting Date String into an Actual Date

Johnny Thunder

Well-known Member
Joined
Apr 9, 2010
Messages
693
Office Version
  1. 2016
Platform
  1. MacOS
Hello All,

Working on a weird issue here. Look on the interwebs and found nothing for my specific issue. The DateValue syntax doesn't seem to work in the event the data string makes no sense.

So here is how some of the dates come in;

Date as it comes inConverted to General
10/31/2019 11:00 PM

<colgroup><col></colgroup><tbody>
</tbody>
43769.95833

<colgroup><col></colgroup><tbody>
</tbody>
01/01/2055 11:00 PM

<colgroup><col></colgroup><tbody>
</tbody>
56615.95833

<colgroup><col></colgroup><tbody>
</tbody>
10/14/2019 10:52 PM

<colgroup><col></colgroup><tbody>
</tbody>
43752.95278

<colgroup><col></colgroup><tbody>
</tbody>

<tbody>
</tbody>









So, it seems that the issue is coming from the system putting in the last two characters in the date incorrectly. I think the system actually puts in "20" and excel is converting that to "2055" for some reason. Does anyone know of a way to convert this automatically going forward so that when "21" shows up the formula can handle that without doing Find/Replace?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If I type 1/1/55 11:00 PM, my Excel converts that to 1955 not 2055.

How did you get that exactly and what is this 21 you are talking about?
 
Upvote 0
1. Sorry, I wasn't clear, in our web based system people have entered in the year as a 2 digit format which is causing the error of having the output show up 2055. I think the system is actually trying to resolve the data and spits out the "2055". Hopefully there is a trick to clean this up thru a formula?

2. I meant 2021 when i wrote "21" similarly how I was mentioning "20" for 2020. Hope that clarifies. I just meant that in the event the code throws another weird year in the date that whatever solution that is proposed it will account for any variation of incorrect year. I was hoping that maybe there was something embedded in the weird "56615.95833" formatted version of the date that would provide a key to creating the correct date.
 
Upvote 0
The General format shows the date as Excel stores dates, The Integer part is the number of days since January 1, 1900. The decimal part is the fractional part of the day to represent time (.5 is 1/2 a day and is noon, for example).

I guess you could check for future years, what would be the most amount of years ahead of today's date that would still be deemed acceptable?
2055 is 36 years from now. So at what point do you determine whether the year should be in the past or in the future?
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

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