Forum Discussion
Emma_Sabin
Sep 18, 2021Copper Contributor
How to sort data by date format
Hi - I'm using PC/Windows 10, and Excel version 2018 My excel data looks like this. I have 1500 rows. Date of hire Gender Race/Ethnicity Level Promotion Date new level term date type of...
HansVogelaar
Sep 18, 2021MVP
Press Alt+F11 to activate the Visual Basic Editor.
Select Insert > Module.
Copy the following custom function into the code window:
Function NumberFormat(rng As Range)
NumberFormat = rng.NumberFormat
End Function
Close the Visual Basic Editor.
In the first column next to the data, enter the following formula in row 2:
=NumberFormat(A2)
Fill down to the last row with data, for example by double-clicking the fill handle in the lower right of the cell with the formula.
Now sort the entire range (not just the new column!) on the new column.
Cells with the same number format will be grouped together.