Forum Discussion
Hi! im really confused on how to sort these US patent numbers
NoelGilling I would like to offer you a solution that combines the SORT and TRANSPOSE functions. The SORT function, however, may not yet be available in your Excel version yet.
From the MS support pages on SORT:
This function is currently available to Microsoft 365 subscribers in Current Channel. It will be available to Microsoft 365 subscribers in Semi-Annual Enterprise Channel starting in July 2020.
Now, if your Excel does support the SORT function, you could enter on row 1 in the next empty column (in your case Q1):
=TRANSPOSE(SORT(TRANSPOSE(B1:P1)))
and copy it all the way down. Then you copy column Q:AE and paste it on top of itself as values. Now you can delete the original columns B:P. It will produce rows with sorted class codes with zeros at the end for empty cells within the B:P range of columns. So, patent numbers that do not have classes all the way to column P will have a bunch of zeros in the end. You can ignore then, get rid of them later or just format them to become invisible.
I also want to mention that you may need to clean-up the data first. For instance, on row 5 from column D onwards, the classes seem to have leading spaces before each code.
A class code like " 475/121" will be sorted before "180/370". If that is not your intention, use the TRIM function to get rid of these leading spaces, before you apply the SORT/TRANSPOSE formula above. If none of the class columns would have had empty cells, you could have incorporated TRIM into the formula like this:
=TRANSPOSE(SORT(TRIM(TRANSPOSE(B1:P1))))
But in your case it's going to put the empty cells first in the sort order.