Pete Wright
Member
Hi!
Is there a simple trick to sort cells that contain different data types?
the data types are mostly numbers with or without a forward slash.
For example:
"123", "456", "456/789", "100/200", "987/321",...
On my work laptop there is Office 365 and its Excel has only two sorting algorithms: A-Z and Z-A (even in custom sorting).
Now I have read about some workarounds using helper cells, but maybe some of you know anything else.
BTW., the cells are sorted using a button which fires up a VBA sub:
>>> use code - tags <<<
Is there a simple trick to sort cells that contain different data types?
the data types are mostly numbers with or without a forward slash.
For example:
"123", "456", "456/789", "100/200", "987/321",...
On my work laptop there is Office 365 and its Excel has only two sorting algorithms: A-Z and Z-A (even in custom sorting).
Now I have read about some workarounds using helper cells, but maybe some of you know anything else.
BTW., the cells are sorted using a button which fires up a VBA sub:
>>> use code - tags <<<
Code:
Dim ws As Worksheet: Set ws = This Workbook.Worksheets("data")
with ws.Sort
.SortFields.Add Key:=ws.Range("A1"), Order:=xlAscending, DataOption:=xlSortNormal
.SetRange ws.Range("A1:A1000")
.Header = xlYes
.Apply
End With
Last edited by a moderator: