The output from a web query puts dates in YYYYMMDD format, which Excel does not recognize as a date. When importing a text file into Excel, you should use the Text Import Wizard.
To do this, in Excel:
- Go to the Open menu and select "Text Files" from the Files Type drop-down and locate your file.
- Once you select your file and click Open, the Text Import Wizard will appear.
- In Step 3 of the Import Wizard, you have the option to choose the format for each column.
- Click the column heading containing dates (thereby highlighting the entire column) and then choose "Date" in the "Column Data Format" box. In the drop-down list of date formats just to the right of "Date", select "YMD" and then click "Finish".
Alternatively, to convert a numeric value in YYYYMMDD format to an Excel date, use the following Worksheet function:
This will change the number 19940103 in cell A2 to 1/2/1994.