Formatting as dates that will group in a pivot table

jemwig

New Member
Joined
Mar 16, 2013
Messages
36
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi. I am having trouble with date formats. I have a column of dates but some are formatted as dates and others are not see below. I need to format the whole column of values to dates that can then be used in a pivot table and will group by month. I have tried several methods but none seem to work
Current Contract End Date
10/30/28
2008-11-26​
06/20/28
2001-10-25​
2001-01-26​
02/19/22
08/19/27
04/24/25
06/18/27
04/23/28
2002-06-28​
2012-07-25​
2002-02-23​
06/26/22
12/22/27
2009-04-20​
2006-02-17​
07/13/24
12/22/21
11/21/22
01/29/21
01/14/28
04/18/18
2009-07-26​
2005-01-23​
05/20/23
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Excel Formula:
=DATE(2000+TextAfter(A2,"/",2),Textbefore(A2,"/",1),textafter(textbefore(A2,"/",2),"/"))

Book2
AB
1
205/20/232023-05-20
Sheet1
Cell Formulas
RangeFormula
B2B2=DATE(2000+TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/"))


I think.
 
Upvote 0
Excel Formula:
=DATE(2000+TextAfter(A2,"/",2),Textbefore(A2,"/",1),textafter(textbefore(A2,"/",2),"/"))

Book2
AB
1
205/20/232023-05-20
Sheet1
Cell Formulas
RangeFormula
B2B2=DATE(2000+TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/"))


I think.
My default date formatting may be different from yours, but you can update that.
The above may not work in 2010, but will in 365.
 
Upvote 0
try either of these, one is for 365, other is for 2010:
Book2
ABC
1Excel:
205/20/2305/20/2023365
305/20/2305/20/20232010
Sheet1
Cell Formulas
RangeFormula
B2B2=DATE(2000+TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/"))
B3B3=DATE(MID(A3,FIND("/",A3,FIND("/",A3)+1)+1,2)+2000,LEFT(A3,2),MID(A3,FIND("/",A3)+1,2))
 
Upvote 0
try either of these, one is for 365, other is for 2010:
Book2
ABC
1Excel:
205/20/2305/20/2023365
305/20/2305/20/20232010
Sheet1
Cell Formulas
RangeFormula
B2B2=DATE(2000+TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/"))
B3B3=DATE(MID(A3,FIND("/",A3,FIND("/",A3)+1)+1,2)+2000,LEFT(A3,2),MID(A3,FIND("/",A3)+1,2))
Hi Thank you so much! The 365 one worked to transform the data to date format. But now I need to be able to group the data so I can get a a total number for each month. I.e. if there are 4 entries in the column with dates that lie in Jan 2024,for instance, then I would like to pull a table with a row for each month and the number of entries in each month so that I can graph it.
Like this
Jan 2024 - 12
Feb 2024 - 8
Mar 2024 - 18
 
Upvote 0
Hi Thank you so much! The 365 one worked to transform the data to date format. But now I need to be able to group the data so I can get a a total number for each month. I.e. if there are 4 entries in the column with dates that lie in Jan 2024,for instance, then I would like to pull a table with a row for each month and the number of entries in each month so that I can graph it.
Like this
Jan 2024 - 12
Feb 2024 - 8
Mar 2024 - 18
your pivot chart wizard should do that with built in functionality. Just drag the date into the wizard and you'll see other options around dates show up.
 
Upvote 0
your pivot chart wizard should do that with built in functionality. Just drag the date into the wizard and you'll see other options around dates show up.
It shows the grouping options but they are split by year
 
Upvote 0
It shows the grouping options but they are split by year

i'm not sure why you can't get it to just do months, like this:

mr excel questions 34.xlsm
DEFGHIJKLMN
1TheDateItems SoldAmount
22021-01-298700
32028-01-146900FORMULA CROSSTABPIVOT TABLE
42022-02-197800
52018-04-189800MonthCount SalesDollar SalesMonthCount SalesDollar Sales
62025-04-246600Jan141600Jan14$1,600
72028-04-236500Feb7800Feb7$800
82023-05-207700Apr211900Apr21$1,900
92022-06-266500May7700May7$700
102027-06-189900Jun252200Jun25$2,200
112028-06-2010800Jul9900Jul9$900
122024-07-139900Aug787500Aug78$7,500
132002-08-259500Oct10600Oct10$600
142002-08-2610500Nov6700Nov6$700
152003-08-235800Dec161200Dec16$1,200
162003-08-286900Grand Total193$18,100
172006-08-236700
182007-08-177600
192009-08-2610600
202010-08-207500
212010-08-266700
222013-08-256800
232027-08-196900
242028-10-3010600
252022-11-216700
262021-12-227600
272027-12-229600
jemwig
Cell Formulas
RangeFormula
H6:H15H6=UNIQUE(SORT(DATE(0,MONTH(D2:D27),1)))
I6:I15I6=SUM((--(MONTH(H6)=MONTH($D$2:$D$27)))*($E$2:$E$27))
J6:J15J6=SUM((--(MONTH(H6)=MONTH(D$2:D$27)))*($F$2:$F$27))
D2:D27D2=IF(MID(B2,3,1)="/",DATE(2000+TEXTAFTER(B2,"/",2),TEXTBEFORE(B2,"/",1),TEXTAFTER(TEXTBEFORE(B2,"/",2),"/")), DATE(LEFT(B2,4),LEFT(TEXTBEFORE(B2,"-",2),2),LEFT(TEXTAFTER(B2,"-",2),2)))
Dynamic array formulas.




1683150132485.png
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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