How to sort a column by size

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,

Hi, I get an excel file every week with varying amount of records and i have to rearrange it so all the records are sorted into tshirt size then color:

eg.

Rec Name Size Color
1 John S Blue
2 Jill L Red
3 Jack M Green
4 Jono XL Blue
5 Jan X Red
6 Juan S Green

I need the data to be sorted so the sizes go from s,m,l,xl,xxl then the colours..

How would I write a macro in excel for this?

thankyou!




1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Directly is not possible becaue letters will not be sorted in the manner you want. you wound need to translate the "s", "xl" etc into numbers that goes in the order that are sortable and same for color