Date Time Data - convert to date only?

Sunshine8790

Board Regular
Joined
Jun 1, 2021
Messages
86
Office Version
  1. 365
Platform
  1. Windows
I have headers in row 1, so all my data starts in row 2.
In column AG, specifically beginning in AG2, I have data showing in this format: Jan 1, 1998 12:00:00 AM
In AH2 I have:
Excel Formula:
=TEXT(AG2,"dd/mmm/yyyy")
It displays: Jan 1, 1998
All good so far, except that I need to find a way to separate the month and day in the next 2 cells.
So in AI2 I want it to display "Jan", and in AJ2 I want it to display "1"

However, when I try
Excel Formula:
=IF(AH2="","",MONTH(AH2))
in AI2, it displays "1". Technically correct as January is the 1st month but I want it to say Jan.

Any help on this one would be appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The TEXT function returns a string. Since it is no longer a date, you can no longer do date functions on it, unless you convert it back to a date.
But there shouldn't be any need to. If you want to keep it a date, just format your original cell (AG2) to a date format of "dd/mm/yyyy", and it will not display the time piece.
 
Upvote 0
How about
Excel Formula:
=TEXT(AG2,"mmm")
 
Upvote 1
Solution
The TEXT function returns a string. Since it is no longer a date, you can no longer do date functions on it, unless you convert it back to a date.
But there shouldn't be any need to. If you want to keep it a date, just format your original cell (AG2) to a date format of "dd/mm/yyyy", and it will not display the time piece.
I did try this, but it displays the date like 01/01/1998. I wanted to keep the original format minus the date :) , appreciate you though! Thank you.
 
Upvote 0
I did try this, but it displays the date like 01/01/1998. I wanted to keep the original format minus the date :) , appreciate you though! Thank you.
That was a typo on my part - it should be "mmm", not "mm".

Note that the time of 12:00 AM is the same as 0 for the time component.
Dates and times are in Excel are really just numbers, specifically the number of days since 1/0/1900.
And time is just the fractional component of one day.

So all that dates are in Excel are numbers with special date/time formats.
You can see this really easily by entering any date, and then changing the format of that cell to General.
Then you see the date/time as Excel does. Formatting just changes the display in the cell, not the actual value.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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