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
  • Learn & ask questions
Solved

Excel Sorting of Text

Posted on 2013-10-23
10
224 Views
Last Modified: 2013-10-23
I imported a 14000 rows of data into an excel spreadsheet and want to sort by column A which has numbers anywhere from 3 digits like this: 019 and 5 digits like this:  47384.   Some have this too:  0003a.

I had to import this column as text so that excel wouldn't mangle all the data and leave my leading zero's alone (why on earth does it do this).

Anyways - I can't sort it now.  Custom sorts don't work either.  I tried to sort it like this; 000,111,222,333, etc all the way up to 99999.

Help.
0
Comment
Question by:chuckster_eh
  • 6
  • 4
10 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 39595528
When you went to sort, did Excel ask if you want to sort text that looks like numbers as numbers?  Did you reply not to (ie sort text and numbers separately)?
0
 

Author Comment

by:chuckster_eh
ID: 39595532
I said "Sort anything that looks like a number - as a number"
0
 

Author Comment

by:chuckster_eh
ID: 39595533
But I have tried it both ways....
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:chuckster_eh
ID: 39595539
It seems to be sorting according to the actual number itself and not the digits.  For example its currently sorting like this: 01889,019,01900

But I want it to sort like this:

019,01889,01900

I want the number of digits to be the first order of sorting, then the sequentially.
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39595564
If I enter those 3 numbers as text strings and sort, and say sort anything that looks like a number as a number... then it sorts them as you said you desire.
0
 

Author Comment

by:chuckster_eh
ID: 39595575
try adding a few more numbers,

019
00020
00047
00053
00059
00070
077

I want it to look like this
019
077
00020
00047
00053
00059
00070
0
 
LVL 23

Accepted Solution

by:
NBVC earned 350 total points
ID: 39595586
Ok, how about you add a helper column that gets the length., then sort by that column first,.

so if data is in column E, use formula in F2:  =LEN(E2)  copied down.

Then select both columns, sort first by column F, ascending, then column E, ascending
0
 

Author Comment

by:chuckster_eh
ID: 39595605
My data is in column A.  I made a column b and put in =LEN(A2).  First row is header data.

It doesn't do anything....just says =LEN(A2) in the cell.   I must be missing something.
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39595607
That means column B is formatted as TEXT.  Format the column as General, then go to B2, re-enter the formula and copy it down again.
0
 

Author Comment

by:chuckster_eh
ID: 39595620
awesome.  that was great. thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question