Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

excel part number sort

Posted on 2010-11-29
Medium Priority
406 Views
How do I get excel to sort part numbers so I can find my part number grouped together well.
I need all the part numbers with 1 to show together even if its 100, 1234,1000, or 10000?

For example:
100
200
1234
1000
2000
10000
20000
200000
100000
0
Question by:rembury
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 58

Expert Comment

ID: 34232009
I those are "part numbers" (text), you should be storing them as text, by adding ' in front of them
Then they will sort as text (1's together).
For now, you can add a new column, and type this formula (If first is A1, and new column is B)
B1:  =TEXT(A1)
Copy down
Then select all your data, and sort by the new column
When Excel prompts (Sort Warning), choose the lower one (sort numbers and text separately)
0

LVL 24

Expert Comment

ID: 34232017
You could use =LEFT(A1,1) in the next column and sort by that one.
0

LVL 58

Accepted Solution

cyberkiwi earned 2000 total points
ID: 34232080
I meant

B1:  =TEXT(A1, "@")
...

But Stephen's LEFT does the same
0

LVL 12

Expert Comment

ID: 34232115
You can also use the attached macro. Just select the range which you want to sort and then run this macro. You can also assign a shortcut key to it.

Regards
Shashank
``````Sub test()
Dim rng As Range, rng2 As Range
Set rng = Intersect(Selection, ActiveSheet.UsedRange)
For Each rng2 In rng
rng2.Value = "x" & rng2.Value
Next rng2
ActiveSheet.Sort.SortFields.Clear
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange rng
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For Each rng2 In rng
rng2.Value = Right(rng2.Value, Len(rng2.Value) - 1)
Next rng2
End Sub
``````
0

Author Closing Comment

ID: 34232319
This worked great and was easy to use.

Thank-you
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Suggested Courses
Course of the Month12 days, 3 hours left to enroll