Regarding Date Format

Allwinv

New Member
Joined
May 19, 2019
Messages
32
Hi Excel Experts,

In one of the Cell, i have the data as 13/6/2018 2:38 PM. But i want to make this data as 13/06/2018. I entered formula as =DATE(YEAR(A1),MONTH(A1),DAY(A1)). But i am getting the error due to AM and PM available in cell. I removed AM and PM in the cell (using the replace Option) and applied the formula as =DATE(YEAR(A1),MONTH(A1),DAY(A1)). But still not working for the cells which are AM and PM data.

Can you please help.

Thanks.
 
Does this macro fix your problem (change the red highlighted "A" to the column letter designation for the column where your dates are located)...
Code:
[table="width: 500"]
[tr]
	[td]Sub FixDates()
  Columns("[B][COLOR="#FF0000"]A[/COLOR][/B]").TextToColumns , xlDelimited, , , False, False, False, True, False, FieldInfo:=Array(Array(1, 4), Array(2, 9), Array(3, 9)), TrailingMinusNumbers:=True
End Sub[/td]
[/tr]
[/table]
NOTE: This macro overwrites your original data with the dates represented by your "text dates".
 
Last edited:
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,

Thank you for your reply.

Can i share my excel data file to your mail. You can check and let me know what is the problem.

I am not ware of macros in excel.

Pls help.
 
Upvote 0

Forum statistics

Threads
1,224,042
Messages
6,176,042
Members
452,698
Latest member
MikaVmex

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