Date column not working

scolty1985

Board Regular
Joined
Sep 16, 2009
Messages
88
Hi,

Im trying to plot some data but its been downloaded in the wrong chronological order. So i attempted to filter it and it screwed everything up. After looking into the values, so are dates and others are text. I tried using the format cell function but that didnt work. I also tried using the text function



which also didnt work.

date column not working.xlsx
ABCDEFGH
1DateDayPriceOpenHighLowVol.Change %
204/08/202108/04/2021975.58965.99975.58962.1654.72M1.16%
304/07/202107/04/2021964.41963.04968.66957.95538.83M0.20%
404/06/202106/04/2021962.44958.74963.57950.62625.31M0.69%
504/05/202105/04/2021955.81963.98968.12953.42433.05M-0.23%
604/01/202101/04/2021957.99953.17963.06948.93359.68M0.45%
703/31/202103/31/2021953.66979.3979.31943.3591.55M-2.76%
803/30/202103/30/2021980.75985.76988.68972.99485.20M-0.70%
903/29/202103/29/2021987.66976.09999.17976.03486.11M1.45%
1003/26/202103/26/2021973.52973.14976.7965.26382.36M0.34%
1103/25/202103/25/2021970.2967.06976.4953.76582.99M0.32%
1203/24/202103/24/2021967.07977.25980.52963.2374.71M-1.56%
1303/23/202103/23/2021982.35998.791,002.60980.37480.02M-1.90%
1403/22/202103/22/20211,001.411,005.331,007.70996.56410.76M-0.45%
1503/19/202103/19/20211,005.96994.581,008.22992.35546.46M0.99%
1603/18/202103/18/2021996.09983.87998.25983.75399.37M1.56%
1703/17/202103/17/2021980.79979.11986.5976.92418.84M0.18%
1803/16/202103/16/2021979.08981.26986.53974.83419.43M-0.12%
1903/15/202103/15/2021980.28994.49998.46980.13430.23M-1.25%
2003/12/202112/03/2021992.71969.73993.14967.73379.61M3.09%
2103/10/202110/03/2021962.99948.31966.25944.15319.30M1.90%
2203/09/202109/03/2021945.02944.96956.11936.38624.48M0.56%
2303/08/202108/03/2021939.78942.6955.71938.09750.66M0.31%
2403/05/202105/03/2021936.86942.09948.98933.89512.84M-1.12%
2503/04/202104/03/2021947.46963.36963.85947.46424.67M-1.58%
2603/03/202103/03/2021962.65976.11978.26960.16311.78M-1.09%
2703/02/202102/03/2021973.26959.15975.43956.7476.57M2.22%
2803/01/202101/03/2021952.11957.08958.84939.9581.20M0.11%
2902/26/202102/26/2021951.1951.18957.2933.57486.14M-1.10%
3002/25/202102/25/2021961.66958.12964.7953.95565.20M0.89%
3102/24/202102/24/2021953.19980.18983.48947.67577.56M-2.22%
3202/23/202102/23/2021974.84970.88981.35968.58389.66M0.63%
IDX Basic Industry Historical D
Cell Formulas
RangeFormula
B2:B32B2=TEXT(A2,"mm/dd/yyyy")



Any help would be appreciated.

Rgds

Fraz
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Once you do the import use the TEXT TO COLUMNS procedure on your suspect date column. It should only reformat text that look like dates into numbers.
And as long as the date that the text is in is in a generally accepted date format it will convert it for you.
Its on the DATA RIBBON .... DATA>>DATATOOLS >> TEXT TO COLUMNS

if you have excel 365 or better you can use the text before and text after functions to parse out the year month and day into the DATE function if that doesn't work. Or maybe even in POWER QUERY, but I am not an expert on that.


Here is a suggestion using the DATE, TEXTBEFORE, and TEXTAFTER Functions:
Again, for 365 and later, I think. If you don't have the last two functions you'll have to use left, right, and mid to parse it out, like this:
Excel Formula:
=IF(ISNUMBER(A2),A2,DATE(RIGHT(A2,4),LEFT(A2,2),MID(A2,4,2)))

I kept the column format as GENERAL, change to the date format as you desire.

Mr excel questions 58.xlsm
ABCDEFGHIJK
1DateDayPriceOpenHighLowVol.Change %Col A ConvCol B Conv
24441208/04/2021975.58965.99975.58962.1654.72M0.01164441244412
34438107/04/2021964.41963.04968.66957.95538.83M0.0024438144381
44435106/04/2021962.44958.74963.57950.62625.31M0.00694435144351
54432005/04/2021955.81963.98968.12953.42433.05M-0.00234432044320
64420001/04/2021957.99953.17963.06948.93359.68M0.00454420044200
703/31/202103/31/2021953.66979.3979.31943.3591.55M-0.02764428644286
803/30/202103/30/2021980.75985.76988.68972.99485.20M-0.0074428544285
903/29/202103/29/2021987.66976.09999.17976.03486.11M0.01454428444284
1003/26/202103/26/2021973.52973.14976.7965.26382.36M0.00344428144281
1103/25/202103/25/2021970.2967.06976.4953.76582.99M0.00324428044280
1203/24/202103/24/2021967.07977.25980.52963.2374.71M-0.01564427944279
1303/23/202103/23/2021982.35998.791002.6980.37480.02M-0.0194427844278
1403/22/202103/22/20211001.411005.331007.7996.56410.76M-0.00454427744277
1503/19/202103/19/20211005.96994.581008.22992.35546.46M0.00994427444274
1603/18/202103/18/2021996.09983.87998.25983.75399.37M0.01564427344273
1703/17/202103/17/2021980.79979.11986.5976.92418.84M0.00184427244272
1803/16/202103/16/2021979.08981.26986.53974.83419.43M-0.00124427144271
1903/15/202103/15/2021980.28994.49998.46980.13430.23M-0.01254427044270
204453312/03/2021992.71969.73993.14967.73379.61M0.03094453344533
214447210/03/2021962.99948.31966.25944.15319.30M0.0194447244472
224444209/03/2021945.02944.96956.11936.38624.48M0.00564444244442
234441108/03/2021939.78942.6955.71938.09750.66M0.00314441144411
244431905/03/2021936.86942.09948.98933.89512.84M-0.01124431944319
254428904/03/2021947.46963.36963.85947.46424.67M-0.01584428944289
264425803/03/2021962.65976.11978.26960.16311.78M-0.01094425844258
274423002/03/2021973.26959.15975.43956.7476.57M0.02224423044230
284419901/03/2021952.11957.08958.84939.9581.20M0.00114419944199
2902/26/202102/26/2021951.1951.18957.2933.57486.14M-0.0114425344253
3002/25/202102/25/2021961.66958.12964.7953.95565.20M0.00894425244252
3102/24/202102/24/2021953.19980.18983.48947.67577.56M-0.02224425144251
3202/23/202102/23/2021974.84970.88981.35968.58389.66M0.00634425044250
Scolty1985
Cell Formulas
RangeFormula
J2:K32J2=IF(ISNUMBER(A2),A2,DATE(TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/",1)))
B2:B32B2=TEXT(A2,"mm/dd/yyyy")
 
Upvote 1
Once you do the import use the TEXT TO COLUMNS procedure on your suspect date column. It should only reformat text that look like dates into numbers.
And as long as the date that the text is in is in a generally accepted date format it will convert it for you.
Its on the DATA RIBBON .... DATA>>DATATOOLS >> TEXT TO COLUMNS

if you have excel 365 or better you can use the text before and text after functions to parse out the year month and day into the DATE function if that doesn't work. Or maybe even in POWER QUERY, but I am not an expert on that.


Here is a suggestion using the DATE, TEXTBEFORE, and TEXTAFTER Functions:
Again, for 365 and later, I think. If you don't have the last two functions you'll have to use left, right, and mid to parse it out, like this:
Excel Formula:
=IF(ISNUMBER(A2),A2,DATE(RIGHT(A2,4),LEFT(A2,2),MID(A2,4,2)))

I kept the column format as GENERAL, change to the date format as you desire.

Mr excel questions 58.xlsm
ABCDEFGHIJK
1DateDayPriceOpenHighLowVol.Change %Col A ConvCol B Conv
24441208/04/2021975.58965.99975.58962.1654.72M0.01164441244412
34438107/04/2021964.41963.04968.66957.95538.83M0.0024438144381
44435106/04/2021962.44958.74963.57950.62625.31M0.00694435144351
54432005/04/2021955.81963.98968.12953.42433.05M-0.00234432044320
64420001/04/2021957.99953.17963.06948.93359.68M0.00454420044200
703/31/202103/31/2021953.66979.3979.31943.3591.55M-0.02764428644286
803/30/202103/30/2021980.75985.76988.68972.99485.20M-0.0074428544285
903/29/202103/29/2021987.66976.09999.17976.03486.11M0.01454428444284
1003/26/202103/26/2021973.52973.14976.7965.26382.36M0.00344428144281
1103/25/202103/25/2021970.2967.06976.4953.76582.99M0.00324428044280
1203/24/202103/24/2021967.07977.25980.52963.2374.71M-0.01564427944279
1303/23/202103/23/2021982.35998.791002.6980.37480.02M-0.0194427844278
1403/22/202103/22/20211001.411005.331007.7996.56410.76M-0.00454427744277
1503/19/202103/19/20211005.96994.581008.22992.35546.46M0.00994427444274
1603/18/202103/18/2021996.09983.87998.25983.75399.37M0.01564427344273
1703/17/202103/17/2021980.79979.11986.5976.92418.84M0.00184427244272
1803/16/202103/16/2021979.08981.26986.53974.83419.43M-0.00124427144271
1903/15/202103/15/2021980.28994.49998.46980.13430.23M-0.01254427044270
204453312/03/2021992.71969.73993.14967.73379.61M0.03094453344533
214447210/03/2021962.99948.31966.25944.15319.30M0.0194447244472
224444209/03/2021945.02944.96956.11936.38624.48M0.00564444244442
234441108/03/2021939.78942.6955.71938.09750.66M0.00314441144411
244431905/03/2021936.86942.09948.98933.89512.84M-0.01124431944319
254428904/03/2021947.46963.36963.85947.46424.67M-0.01584428944289
264425803/03/2021962.65976.11978.26960.16311.78M-0.01094425844258
274423002/03/2021973.26959.15975.43956.7476.57M0.02224423044230
284419901/03/2021952.11957.08958.84939.9581.20M0.00114419944199
2902/26/202102/26/2021951.1951.18957.2933.57486.14M-0.0114425344253
3002/25/202102/25/2021961.66958.12964.7953.95565.20M0.00894425244252
3102/24/202102/24/2021953.19980.18983.48947.67577.56M-0.02224425144251
3202/23/202102/23/2021974.84970.88981.35968.58389.66M0.00634425044250
Scolty1985
Cell Formulas
RangeFormula
J2:K32J2=IF(ISNUMBER(A2),A2,DATE(TEXTAFTER(A2,"/",2),TEXTBEFORE(A2,"/",1),TEXTAFTER(TEXTBEFORE(A2,"/",2),"/",1)))
B2:B32B2=TEXT(A2,"mm/dd/yyyy")
The text to columns function worked a treat, thank you very much :)
 
Upvote 0
You're welcome.
I'm pleased you found a solution!

Best Wishes!
 
Upvote 1

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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