Skip to main content

How to sort list of numbers separated by commas in Excel?

Author: Sun Last Modified: 2020-07-08

Sorting a list of values in ascending or descending order is quite common in our daily Excel jobs, but have you ever tried to sort numbers separated by commas in an Excel cell as below screenshot shown? In this article, I introduce the tricks to quickly handle it.
doc sort comma separated number 1

Sort comma separated values with Text to Columns function

Sort comma separated values with Kutools for Excelgood idea3


Sort comma separated values with Text to Columns function

To sort comma separated values in a cell, you need to separate the numbers into separated cells first by Text to column, transpose them to a list, and then sort.

1. Select the cells you want to split to separated cells by comma, and click Data > Text to Columns. And in the step 1 of Convert Text to Columns Wizard, check Delimited option. See screenshot:
doc sort comma separated number 2

2. Click Next to go to the step 2 of the Wizard, and check Comma checkbox, and click Next to go to step 3 of the Wizard, select one cell to out put the split values. See screenshot:
doc sort comma separated number 3

3. Click Finish, and the comma separated values have been split into cells. See screenshot:
doc sort comma separated number 4

4. Select the split cells, and press Ctrl + C to copy them, and then select a blank cell, right click to show the context menu, click Paste Special > Transpose. See screenshot:
doc sort comma separated number 5

Then the values have been transposed as below screenshot shown:
doc sort comma separated number 6

5. Select one column of the transposed values, click Data tab, and select a sorting order as you need in the Sort & Filter group. In the popping Sort Warning dialog, please check the Continue with the current selection option, and click the OK button.
doc sort comma separated number 7 doc sort comma separated number 8

And now the selected column is sorted in the specfied order. See screenshot:
doc sort comma separated number 9.png

6. Then repeat step 5 to sort the transposed values one by one. See screenshot:
doc sort comma separated number 1


  Sort comma separated values with Kutools for Exce

If you have Kutools for Excel, you just need to split the comma separated values from one cell to rows by the Split Cells utility, and then sort.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1. Select the range you want to split by comma separated, and click Kutools > Merge & Split > Split Cells, and in the Split Cells dialog, check Split to Rows option in Type section, and go to check Other in Split by section, and enter , into the beside textbox. See screenshot:
doc sort comma separated number 10 doc kutools split cells 2

2. Click Ok, a dialog pops out to remind you to select a cell to place the split values, click OK, and the range values have been split into rows by commas. See screenshot:
doc sort comma separated number 11
doc sort comma separated number 12

3. Select one of split columns, click Data > Sort Smallest to Largest or Sort Largest to Smallest as you need, and finally check the Continue with the current selection option and click OK button in the popping Sort Warning dialog. See screenshot:
doc sort comma separated number 7 doc sort comma separated number 8

4. Repeat above Step 3 to sort all split columns one by one.
doc sort comma separated number 1

Tip. If you want to have a free trial of the Split Cells function, please go to free download Kutools for Excel first, and then go to apply the operation according above steps.



Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Nie o takie rozwiązanie mi chodziło.
mam w jednej komórce dane : 2,4,3,1 a chcę mieć je posortowane też w jednej komórce 1,2,3,4. Jak to zrobić?
This comment was minimized by the moderator on the site
Hi, ja, if you want to sort numbers within a cell, this tutorial will help you:
How to sort numbers within a cell in Excel?
This comment was minimized by the moderator on the site
COMMENT TRIER DES NOMBRE COMME E.1.1 ..........E1.10
This comment was minimized by the moderator on the site
Hi, YASSINE, before helping you to solve your problem, I have three questions:
1) The data you list E.1.1 ...E1.10 has no rule. Are you mean E.1.1...E.1.10?
2) The data is in a column or in a row or in a single cell?
3) What order you want to sort?
This comment was minimized by the moderator on the site
Sub Arrange_Alphabetically()
Dim col As Variant
Dim list As Variant
Dim i As Long
Dim part As Variant
Dim Separator As String
Dim OutputRng As Range
Dim InputRng As Range
Dim Rowsx As Integer

Set list = CreateObject("System.Collections.ArrayList")
xTitleId = "Arrange Words Alphabetically"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range", xTitleId, InputRng.Address, Type:=8)
Separator = Application.InputBox("Separator", xTitleId, ",", Type:=2)
Set OutputRng = Application.InputBox("Choose One Output Cell", xTitleId, InputRng.Address, Type:=8)

col = InputRng.Value
Rowsx = InputRng.Rows.Count

For i = 1 To UBound(col)
list.Clear
For Each part In Split(col(i, 1), Separator)
list.Add part
Next
list.Sort
col(i, 1) = Join(list.ToArray(), ",")
Next
Range(OutputRng.Cells(1, 1), OutputRng.Cells(Rowsx, 1)) = col
End Sub
This comment was minimized by the moderator on the site
Genial gracia por todo
This comment was minimized by the moderator on the site
thanks this was very helpful
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations