No "/" in Format result

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,072
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
? Format("06 Jan 1990", "mm/dd/yyyy")
01 06 1990

Why does it not result in 01/06/1990 like its being told to ??

Using Excel 2007.

Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try =TEXT(datevalue("06 Jan 1990"), "mm/dd/yyyy")
 
Upvote 0
Change TEXT back to FORMAT if you are doing it in VBA.

Code:
Sub GGG()
[A1] = Format(DateValue("06 Jan 1990"), "mm/dd/yyyy")
End Sub
 
Last edited:
Upvote 0
I'm assigning it to a string variable, not [A1], if that has an effect. I still get no "/" in the result and have to use Replace.
Just checked it does work OK in Excel 2003... so this must be something MS have mucked up ?
 
Upvote 0
I'm assigning it to a string variable, not [A1], if that has an effect. I still get no "/" in the result and have to use Replace.
Just checked it does work OK in Excel 2003... so this must be something MS have mucked up ?

Same as Rick with 2010, will test with 2007 this evening if no-one else does before then.

Code:
Sub GGG()
Dim a As String
a = Format(DateValue("06 Jan 1990"), "mm/dd/yyyy")
Debug.Print a
End Sub
 
Upvote 0
Same as Rick with 2010, will test with 2007 this evening if no-one else does before then.
Works fine in my copy of Excel 2007 as well.

Question for the OP... where did that date come from? If you copied it from a webpage, check to see if those spaces are ASCII 32 normal spaces or ASCII 160 non-breaking spaces.
 
Upvote 0
I'd be interested in anyone's 2007 results.. it fails for me in both Access and Excel. Maybe my Office 2007 is having problems....
It seems to make no difference if "DateValue" is included, or not.
I haven't got Excel 2010.
 
Upvote 0
I'd be interested in anyone's 2007 results.. it fails for me in both Access and Excel. Maybe my Office 2007 is having problems....
It seems to make no difference if "DateValue" is included, or not.
I haven't got Excel 2010.

Did you see Message #8 yet?
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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