Share via

Imported dates through sql not recognized as dates

Anonymous
2015-11-21T00:22:53+00:00

Hi,

I'm importing data to Excel through a sql query.

Dates are not being recognized as such (when I filter the column I don't get the year/month grouping) at the moment of import but if I select a cell and click "Enter" then the date format is recognized. This is happening regardless of the date format in the query (e.g. 2015-09-20 or 09/20/2015)

Does anyone have a solution?

Thanks!

Eduardo

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Jim G 134K Reputation points MVP Volunteer Moderator
2015-11-23T17:34:07+00:00

Excel will automatically format dates depending upon the data type it is given in the result set of the SQL query. it appears that in this case the date is being delivered to Excel as text. 

The easy thing to do is to make calculated columnsdo the work of converting the text into Excel Dates. If your date comes through formatted as text 09/20/2015 you can use the DATEVALUE worksheet function in a calculated field to turn the text into a date number that can be formatted as a date.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more