Date formats?

gg

Well-known Member
Joined
Nov 18, 2003
Messages
560
I am having trouble getting cells to read as dates.

Currently I have in column A

1/10/2004
thru
2/6/2004

I am wanting to sort these asending however, it is only reading the
first letter of the date.

This data was built by and web query that seems to have chaged the format to something else. ( Raw Text, Not date number)

Example:
1/10/2004 as text -->37996 = OK
1/10/2004 as text--> 1/10/2004 = NG

Any ideas how to make these read as a date.
Format cells--> date is already done.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
gg,

I've had a similar experience and used the VBA DateValue function to get the dates in the right format.

For example if your problem date is in cell A1 try a macro

Code:
Sub ChangeDate
Range("B1").Value = DateValue(Range("A1").Value)
End Sub
and format cell B1 to be a date in whatever format you want.

Regards,

PP
 
Upvote 0
That works great..

One more question.
How do I get it to do about 1000 in a row is there an easy way?
 
Upvote 0
Select all the cells, then use Data | Text to Columns... fixed (though delimited would work too if you do it right) and then select the appropriate Date Option. That'll force it over to dates.
 
Upvote 0
gg,

Greg's solution is neat but if you want to extend my macro solution from earlier then try something like

Code:
Sub ChangeDates

For i=1 To 1000
Range("B" & i).Value = DateValue(Range("A" & i).Value)
Next i

End Sub

Regards,

PP
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

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