Format Problem!!

bidmet

Board Regular
Joined
Jun 25, 2004
Messages
76
In a Query I have used an expression as follows (Time field being format of dd/mm/yyyy hh:mm:ss).

Month: Format([Time], "mmmm")

This gives an output of for example 'April' in the Month field.

This data is then called into Excel and shows 'April'.

I want to show 'April 04' for example.

I changed the expression to Month: Format([Time], "mmmm yy").

The query shows 'April 04', but Excel shows 01/04/2004 0:00:00.

How can I rectify this problem?

N.B. Unable to change the format of the Time field, from the orginal Database.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How are you exporting to Excel? I tried copying and pasting from the Query and "Analyze with Excel" and in both cases it exported as text.

You could change the format in xl to show MMM YY

Peter
 
Upvote 0
Thanks Peter, but changing the format in excel only changes the way it look on the sheet. The cell is still wrong as in the top box it still shows dd/mm/yyyy hh:mm:ss.

Using excel I am importing the data from access via the import data function.

In every case other than this one the formating and data is the same as in the database.
 
Upvote 0
It appears then that the problem is at the excel end then, XL is rcognising it as a date and converting it from text to number and formating as date. My copy of MsQuery seems to be broken at the moment so I cannot check it out but you may be able to apply formatting there that will stick with the spreadsheet. I seem to recal that there are options about formating so that you can set the formats in the sheet and query will use those rather than guessing.
It may well be worth raising the topic on the XL board to find out.

Peter
 
Upvote 0
As an aside: Time is a reserved word in Access and should not be used as a field name.
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

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