Impossible to Sort
Solved
Hello.
One of the toughest problems I've encountered in Excel:
I want to sort the dates in column B chronologically.
Having dates from before 1900 in column A, I applied the following formula that was given to me, to the entire column.
=IF(ISNUMBER(A1520),DATE(YEAR(A1520)+1000,MONTH(A1520),DAY(A1520)),(LEFT(A1520,2) & MID(A1520,3,LEN(A1520)-7) & VALUE(RIGHT(A1520,4))+1000)*1)
This allows me to obtain a "sortable" date in column B
However, when I try to sort, Excel gives me the message:
I lost a lot of hours yesterday trying to find an answer, read tons of posts, with no result.
My cells are not merged
Their size is identical since I set the row height for the entire table upon creation.
Configuration: Windows / Firefox 40.0
--
Windows 8.1 Office 2013
One of the toughest problems I've encountered in Excel:
I want to sort the dates in column B chronologically.
Having dates from before 1900 in column A, I applied the following formula that was given to me, to the entire column.
=IF(ISNUMBER(A1520),DATE(YEAR(A1520)+1000,MONTH(A1520),DAY(A1520)),(LEFT(A1520,2) & MID(A1520,3,LEN(A1520)-7) & VALUE(RIGHT(A1520,4))+1000)*1)
This allows me to obtain a "sortable" date in column B
However, when I try to sort, Excel gives me the message:
I lost a lot of hours yesterday trying to find an answer, read tons of posts, with no result.
My cells are not merged
Their size is identical since I set the row height for the entire table upon creation.
Configuration: Windows / Firefox 40.0
--
Windows 8.1 Office 2013
6 answers
-
Hello
I ran your SORT macro, it lacks the line that applies the sort ".Apply".
Since you haven't provided us with any document to rely on for testing, I created a sheet with the 2 columns in A and B just like yours, ran the sorting macro and everything went smoothly.Private Sub CommandButton5_Click() ' Sort Macro ' Sort by date ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B2"), _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Sheet1").Sort .SetRange Range("A3:G3000") .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
If the error persists on your end and you do not make the effort to provide us with what everyone is asking for (a copy of your sheet without any confidential data) in order to help you, despite all the goodwill of this forum, we will not be able to do much for you.
Best regards
PS: Have you copied your sheet (only the data) to another sheet and sorted it?