A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Enter this formula in cell A2 of sheet2
=SORTBY(Sheet1!B3:S3475,REGEXEXTRACT(Sheet1!A3:A3475,"\d+",1))
Hope this helps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to sort like this example:
50
50x
51
51x
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Enter this formula in cell A2 of sheet2
=SORTBY(Sheet1!B3:S3475,REGEXEXTRACT(Sheet1!A3:A3475,"\d+",1))
Hope this helps.
[edited; option was of no interest]
Hi,
In cell B2, enter this formula
=SORTBY(A2:A5,REGEXEXTRACT(A2:A5,"\d+",1))
Hope this helps.
Hi @KAREN DOMINY,
I hope you have a good day.
If your column contains values like 50, 50x, 51, 51x, a normal A–Z sort treats them as text and won’t reliably keep each number, and suffix grouped the way you want. A workaround in Excel for the web is to add a helper column that extracts the numeric part, then perform a multi-level (Custom) sort.
Method A: Helper column + Custom sort (Excel for the web)
=VALUE(LEFT(A2, FIND("x", A2&"x")-1))
=IF(RIGHT(A2,1)="x",1,0)
(No suffix = 0, has “x” = 1.)Tip: If sorting ever looks “off,” check whether some values are stored as numbers and others as text, mixed types can change sort behavior.
This produces the natural order you described (like 50, 50x, 51, 51x).
Method B: Using Helper Column in Excel application
Step 1: Create the helper column
=--TEXTJOIN("", TRUE, IFERROR(MID(A2, SEQUENCE(LEN(A2)), 1) * 1, ""))
Step 2: Perform a multi-level sort
I hope this helps! If the reply resolved your question, please consider marking it as the accepted answer so others with the same sorting scenario can find it more easily.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.