![]() |
Sort imported date column
I exported a CSV file from one of my on-line accounts. The file has a list
of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
Try this after selecting the range with your dates
Sub fixmynums() Application.ScreenUpdating = False 'lr = Cells.SpecialCells(xlCellTypeLastCell).Row On Error Resume Next For Each C In Selection 'Range("a1:q" & lr) If Trim(Len(C)) 0 And C.HasFormula = False Then C.NumberFormat = "General" C.Value = CDbl(C) End If Next Application.ScreenUpdating = True End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Michael" wrote in message ... I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
What does the date look like? If it's something like 20080826, you can select
that column, use Data/text to columns, in step 3 change the column Format to Date & select YMD, then click Finish "Michael" wrote: I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
What does the date look like? If it's something like 20080826, you can select
that column, use Data/text to columns, in step 3 change the column Format to Date & select YMD, then click Finish "Michael" wrote: I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
Don,
I'm sorry to say that I am not a programmer, so I didn't understand what you are saying. Consequently, I have no way to implement your suggestion, as I don't know where to begin. Thank you. Mike "Don Guillett" wrote: Try this after selecting the range with your dates Sub fixmynums() Application.ScreenUpdating = False 'lr = Cells.SpecialCells(xlCellTypeLastCell).Row On Error Resume Next For Each C In Selection 'Range("a1:q" & lr) If Trim(Len(C)) 0 And C.HasFormula = False Then C.NumberFormat = "General" C.Value = CDbl(C) End If Next Application.ScreenUpdating = True End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Michael" wrote in message ... I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
Bob,
When I select a cell in the imported column and choose Properties, it is formatted as a date. The same holds true for the the cell in which I manually inserted a date. You would think that a plain CSV wouldn't confuse Excel, especially when I can "tell" it that the column is a series of dates. Mike "Bob Umlas, Excel MVP" wrote: What does the date look like? If it's something like 20080826, you can select that column, use Data/text to columns, in step 3 change the column Format to Date & select YMD, then click Finish "Michael" wrote: I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
Just because it is formatted as a date does not mean Excel recognizes it as
a date. Try Bob's Text to Columns. Should convert to real dates. Gord Dibben MS Excel MVP On Tue, 16 Sep 2008 12:09:02 -0700, Michael wrote: Bob, When I select a cell in the imported column and choose Properties, it is formatted as a date. The same holds true for the the cell in which I manually inserted a date. You would think that a plain CSV wouldn't confuse Excel, especially when I can "tell" it that the column is a series of dates. Mike "Bob Umlas, Excel MVP" wrote: What does the date look like? If it's something like 20080826, you can select that column, use Data/text to columns, in step 3 change the column Format to Date & select YMD, then click Finish "Michael" wrote: I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
Sort imported date column
I tried that to no avail. However, "Paste Special" worked. I should have
thought about that. Thanks to all. "Gord Dibben" wrote: Just because it is formatted as a date does not mean Excel recognizes it as a date. Try Bob's Text to Columns. Should convert to real dates. Gord Dibben MS Excel MVP On Tue, 16 Sep 2008 12:09:02 -0700, Michael wrote: Bob, When I select a cell in the imported column and choose Properties, it is formatted as a date. The same holds true for the the cell in which I manually inserted a date. You would think that a plain CSV wouldn't confuse Excel, especially when I can "tell" it that the column is a series of dates. Mike "Bob Umlas, Excel MVP" wrote: What does the date look like? If it's something like 20080826, you can select that column, use Data/text to columns, in step 3 change the column Format to Date & select YMD, then click Finish "Michael" wrote: I exported a CSV file from one of my on-line accounts. The file has a list of names, account numbers, and dates. Although the cells containing dates are formatted as dates in the Format Cells-Number-Date, the sorting function does not recognize that and will not sort oldest to newest. If I manually retype a few of the dates into another column, Excel recognizes those as being dates with no trouble. Is there something about importing from a CSV that would cause this behavior? Thank you. |
All times are GMT +1. The time now is 04:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com