Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default sorting numbers with an irregular number of digits

I am working on a database and am importing customer numbers that
initially started with 1 digit and now include 5 digit numbers. When
sorted, the numbers with fewer digits are mixed in with the larger
digit numbers. Is there a way to add zeroes to the smaller numbers so
they sort correctly?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default sorting numbers with an irregular number of digits

Assuming your numbers are in column A, starting with A2, enter this
formula in a helper column:

=TEXT(A2,"000000")

and copy down. I've made this 6 digits, but you can leave out one of
the zeros if you wish. You can then include this column in your sort
area, and sort using the helper column as key field. If you don't need
it afterwards, you can delete the helper column.

Hope this helps.

Pete

hearthd wrote:
I am working on a database and am importing customer numbers that
initially started with 1 digit and now include 5 digit numbers. When
sorted, the numbers with fewer digits are mixed in with the larger
digit numbers. Is there a way to add zeroes to the smaller numbers so
they sort correctly?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 252
Default sorting numbers with an irregular number of digits

If they are sorting that way then I think they are formatted as text. You
"can" use a helper column as Pete suggest, but you can also convert all your
cells to numbers. To do this simply copy a blank cell, select your range,
paste special selecting "add". This will convert all text that looks like a
number to a number. Your list should then sort how you want. It kind of
depends on your preference really... Hope this helps :)

"hearthd" wrote:

I am working on a database and am importing customer numbers that
initially started with 1 digit and now include 5 digit numbers. When
sorted, the numbers with fewer digits are mixed in with the larger
digit numbers. Is there a way to add zeroes to the smaller numbers so
they sort correctly?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default sorting numbers with an irregular number of digits

Hope someone can help me with a similar problem. I am putting together a
database relating to horse racing. Each field shows how well a trainer has
done, quoting the number of winners from the total number of runners. An
example entry would be 8-20, which means 8 winners from 20 runners.

However when I try and sort entries to compare it works fine for single
digit numbers on the left, but then stops sorting numerically by the left
hand digit.

Has anyone any ideas?


"Sloth" wrote:

If they are sorting that way then I think they are formatted as text. You
"can" use a helper column as Pete suggest, but you can also convert all your
cells to numbers. To do this simply copy a blank cell, select your range,
paste special selecting "add". This will convert all text that looks like a
number to a number. Your list should then sort how you want. It kind of
depends on your preference really... Hope this helps :)

"hearthd" wrote:

I am working on a database and am importing customer numbers that
initially started with 1 digit and now include 5 digit numbers. When
sorted, the numbers with fewer digits are mixed in with the larger
digit numbers. Is there a way to add zeroes to the smaller numbers so
they sort correctly?


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default sorting numbers with an irregular number of digits

When (if) you get the message from Excel as to how to sort,
choose the option to sort anything that looks like a number as a number.

If you don't get that option or it doesn't work then in an adjoining column
enter this formula... =LEFT(B5,FIND("-",B5,1)-1) + 0
The formula assumes your data starts in cell B5 (adjust as necessary).

Fill the formula down, copy the list of formulas and paste "values" over them.
Sort your data using the new column as the sort column.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Bernie"
wrote in message
Hope someone can help me with a similar problem. I am putting together a
database relating to horse racing. Each field shows how well a trainer has
done, quoting the number of winners from the total number of runners. An
example entry would be 8-20, which means 8 winners from 20 runners.

However when I try and sort entries to compare it works fine for single
digit numbers on the left, but then stops sorting numerically by the left
hand digit.

Has anyone any ideas?


"Sloth" wrote:

If they are sorting that way then I think they are formatted as text. You
"can" use a helper column as Pete suggest, but you can also convert all your
cells to numbers. To do this simply copy a blank cell, select your range,
paste special selecting "add". This will convert all text that looks like a
number to a number. Your list should then sort how you want. It kind of
depends on your preference really... Hope this helps :)

"hearthd" wrote:

I am working on a database and am importing customer numbers that
initially started with 1 digit and now include 5 digit numbers. When
sorted, the numbers with fewer digits are mixed in with the larger
digit numbers. Is there a way to add zeroes to the smaller numbers so
they sort correctly?




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default sorting numbers with an irregular number of digits

On Sun, 8 Oct 2006 09:35:01 -0700, Bernie
wrote:

Hope someone can help me with a similar problem. I am putting together a
database relating to horse racing. Each field shows how well a trainer has
done, quoting the number of winners from the total number of runners. An
example entry would be 8-20, which means 8 winners from 20 runners.

However when I try and sort entries to compare it works fine for single
digit numbers on the left, but then stops sorting numerically by the left
hand digit.

Has anyone any ideas?


First of all, in order to enter values in the form of n-nn, you'll need to
preformat the cells as TEXT, or precede the entry with a single quote (') or
Excel will convert some of those entries to dates.

If you want to sort numerically using native Excel, you'll need to split the
win-total column into two columns, and then either convert them to numeric
values or choose to sort numerically.

There are some free add-ins which can also do similar sorting, but we'd need
more information as to your data layout to be able to go further.
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seed numbers for random number generation, uniform distribution darebo Excel Discussion (Misc queries) 3 April 21st 23 10:02 PM
how to sort anything that looks like a number as a number cyndiwise notsowise Excel Discussion (Misc queries) 4 August 29th 06 09:19 PM
maximum number size/significant digits noel Excel Discussion (Misc queries) 4 February 20th 06 04:42 PM
Sorting Numbers w/Aplha Suffix Moonray80 Excel Discussion (Misc queries) 5 November 21st 05 08:04 AM
Sorting imported "numbers" Confused on the tundra Excel Discussion (Misc queries) 5 December 17th 04 08:33 PM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"