# Thread: [RESOLVED] Sort comma separated numbers and normal numbers together

1. ## [RESOLVED] Sort comma separated numbers and normal numbers together

Hello experts!

I have some data that a column contains number alone and comma separated together, I need to sort considering both criteria, example as shown below

Col A
3
5
7,8,9
11
6

expecting result as below:

Col A
3
5
6
7,8,9
11

What we get now is:

Col A
3
5
6
11
7,8,9

Any idea / code / method would be appreciated!!

2. ## Re: Sort comma separated numbers and normal numbers together

what if you have one cell with 7,8,9 and another with 79.

Which comes first?

3. ## Re: Sort comma separated numbers and normal numbers together

and a cell with 7

4. ## Re: Sort comma separated numbers and normal numbers together

how are you sorting now?

5. ## Re: Sort comma separated numbers and normal numbers together

Hi Vbfbryce, thanks for your reply, 79 comes first, but i need 7,8,9 to be first.

6. ## Re: Sort comma separated numbers and normal numbers together

Originally Posted by westconn1
how are you sorting now?
normal sorting through VBA
Code:
```    With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:A7")
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With```

7. ## Re: Sort comma separated numbers and normal numbers together

We really need to better understand your rule set before we can help.

For example, do you want to use only the first digit when you have something like 7,8.9?

To JDC's question, does 7,8,9 come after 7?

If you have a 7,8 does it come before a 7,8.9? etc.

8. ## Re: Sort comma separated numbers and normal numbers together

Originally Posted by vbfbryce
We really need to better understand your rule set before we can help.

For example, do you want to use only the first digit when you have something like 7,8.9?

To JDC's question, does 7,8,9 come after 7?

If you have a 7,8 does it come before a 7,8.9? etc.
yes, you are right, need to use only 1st digit for sorting. The cells may contain individual numbers and comma separated numbers too.

Thanks!

9. ## Re: Sort comma separated numbers and normal numbers together

Originally Posted by vbfbryce
We really need to better understand your rule set before we can help.

For example, do you want to use only the first digit when you have something like 7,8.9?

To JDC's question, does 7,8,9 come after 7?

If you have a 7,8 does it come before a 7,8.9? etc.
yes, you are right, need to use only 1st digit for sorting. The cells may contain individual numbers and comma separated numbers too.

I have solved this by looping thru rows to extract 1st chr then sort using that column.
Thanks to all for ur support.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured