Convert Date with Time to only Month / Year (non text form)

squeakums

Well-known Member
Joined
May 15, 2007
Messages
823
Office Version
  1. 365
I need to Convert Date with Time to only Month / Year (non text form) so that I can sort the dates in a pivot table later. Cell e4 has the full date with time data.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Do you need to convert it or reformat it. If you convert it then it will be text. If you reformat it then it is showing only as mm/yy and the underlying value is still the numerical.
 
Upvote 0
Hi Squeakums,

You can't have an Excel date as non-text without a day so I have two suggestions.
  1. Use text year and month which will still sort correctly (F4 example)
  2. Convert to Excel date always using 1st of the month (F5 example)

Book2
EF
43/3/2021 17:452021 03
53/3/2021 17:453/1/2021
Sheet1
Cell Formulas
RangeFormula
F4F4=TEXT(E4,"yyyy mm")
F5F5=DATE(YEAR(E5),MONTH(E5),1)
 
Upvote 0
Issue is once I pivot this it won't sort the month / year correctly using text form.
 
Upvote 0
If the issue is that you want to sort/group them by just year and month (and ignore day and time), you could insert a column and make all the days equal to the first day of the month, and remove the time piece. You can then format it to only show month/year, and if you use this new field for grouping and sorting, it should do what you want.

For a date/time in cell A1, the formula will look like:
Excel Formula:
=DATE(YEAR(A1),MONTH(A1),1)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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