Opening CSV In EXCEL date data is wrong

Keegan4123

New Member
Joined
Mar 30, 2022
Messages
29
Office Version
  1. 2016
Platform
  1. Windows
Is there any way to change the default settings for how a file is opened in excel when in CSV in regards to dates?

I have a csv from a program that exports out okay, but when I try to open it all the dates either do not even come in as dates, or if they do they have month/day messed up.

I have tried the text to columns, but it doesn't fix both, will usually only fix the non dates, but the wrong dates remain wrong.

The odd thing is if I open the exact file in google sheets, everything works as it should. Really don't want to have to add that step as this will be a monthly thing

Here is the txt of the data:
Vehicle,Type,Work Order,Completion Date,Labor Subtotal,Parts Subtotal
CV02,COMBO,#6240,05/25/2022 1:02 PM,$465.54,$264.57---Non Date
CV02,COMBO,#6446,05/10/2022 11:00 PM,$534.18,$589.07 ---Real Date but October 5th
CV02,COMBO,#6521,05/31/2022 11:00 PM,$91.11,$141.13---Non Date
CV03,COMBO,#6427,05/03/2022 11:00 PM,$0.00,$114.32---Real Date but March 5
CV03,COMBO,#6428,05/05/2022 11:00 PM,$0.00,$0.00---Real Date but May 5
CV03,COMBO,#6502,05/24/2022 11:00 PM,$0.00,$0.00---Non Date
CV03,COMBO,#6507,05/25/2022 11:00 PM,$121.48,$0.00---Non Date
CV04,COMBO,#6400,05/24/2022 2:40 PM,$485.92,"$1,248.95"---Non Date
CV04,COMBO,#6458,05/11/2022 11:00 PM,$60.74,$0.00---Real Date but Nov 5
CV04,COMBO,#6496,05/23/2022 11:00 PM,$410.21,$0.00---Non Date


I am at a bit of a loss. Have reached out the software vendor for help but they are struggling too.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
This is what I get when I open that up into excel:

Keegan4123.csv
ABCDEFG
1VehicleTypeWork OrderCompletion DateLabor SubtotalParts Subtotal
2CV02COMBO#62405/25/2022 13:02$465.54$264.57
3CV02COMBO#64465/10/2022 23:00$534.18$589.07
4CV02COMBO#65215/31/2022 23:00$91.11$141.13
5CV03COMBO#64275/3/2022 23:00$0.00$114.32
6CV03COMBO#64285/5/2022 23:00$0.00$0.00
7CV03COMBO#65025/24/2022 23:00$0.00$0.00
8CV03COMBO#65075/25/2022 23:00$121.48$0.00
9CV04COMBO#64005/24/2022 14:40$485.92$1,248.95
10CV04COMBO#64585/11/2022 23:00$60.74$0.00
11CV04COMBO#64965/23/2022 23:00$410.21$0.00
12
Keegan4123
 
Upvote 0
I suspect that you are not in the US and the dates are in US format and your preferences are set for European Format. You may want to change your settings to US format to allow for proper alignment for this particular project.
 
Upvote 0
Assuming your Region Date setting is dd/mm/yyyy and you don't want to change it then importing the file with some VBA code or Power Query is the easiest option.

Text to Columns will work but it is easier if you only want the date portion and don't need the time portion.

To use Text to Column, go to text to columns and select delimite of "space". This will give you 3 columns 1 for date and then time in 2 columns with the last having PM in it.

For the Date column set it to the incoming date format of MDY.
If you can live without the time then skip the next 2 columns.

If you need the time don't skip the other columns but you would need a formula to put the 2 columns back together in which case you may as well use a formula to do the lot.

1658905094611.png
 
Upvote 0
I suspect that you are not in the US and the dates are in US format and your preferences are set for European Format. You may want to change your settings to US format to allow for proper alignment for this particular project.
How would I change my preferences. I have looked and can't figure out which setting
 
Upvote 0
I will be surprised if the options in the link above will work for you.
  1. Changing the Windows Region settings
    I don't think you want to be chaning a global setting for a once a month file import
  2. Setting a custom date setting to US Locale
    I don't believe this will give you a different result in terms of importing the US Date format than you are getting now.
  3. Text to Columns
    This will only work if you follow my previous instructions, it won't work the way it is explained in the link because the Time portion seems to be throwing it off.
I am in Australia and have the default date format as dd/mm/yyyy and the below works for me:
(Copy and paste it into a standard VBA module)

VBA Code:
Sub ImportCSVUSDateTime()

    Dim strFile As String

    strFile = Application.GetOpenFilename(FileFilter:="csv files (*.csv*), *.csv*", Title:="Choose a CSV file to open", MultiSelect:=False)
    
    If strFile = False Then Exit Sub
    
    Workbooks.Open Filename:=strFile, local:=False

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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