Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default sort by numbers of digits in cells

Hi,

I need to sort a large document by a certain column. That column consists of
numbers that are six digits and five digits. I need to insert a leading zero
in all those numbers that consist of only five digits. Some of those six
digit numbers already correctly have the leading zero, so when I sort, it
doesn't isolate the five digit ones. Any ideas on how I can do this?
TIA,
--
mab
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default sort by numbers of digits in cells

It sounds as if you may have a mixture of text and numbers. You can check
with ISTEXT() and ISNUMBER(). Solve that problem first (though Excel ought
to have offered you the option to sort text strings which look like numbers
as if they were numbers).
--
David Biddulph

"mab2819" wrote in message
...
Hi,

I need to sort a large document by a certain column. That column consists
of
numbers that are six digits and five digits. I need to insert a leading
zero
in all those numbers that consist of only five digits. Some of those six
digit numbers already correctly have the leading zero, so when I sort, it
doesn't isolate the five digit ones. Any ideas on how I can do this?
TIA,
--
mab



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default sort by numbers of digits in cells

Assume your numbers are in column A starting with A2 - insert a new
column B, and put this formula in B2:

=IF(LEN(A2)=5,"0"&A2,""&A2)

then copy down as required. All your values will now be text values of
6 digits, so you can sort using column B as the sort field.

Hope this helps.

Pete

On Aug 20, 9:12*pm, mab2819 wrote:
Hi,

I need to sort a large document by a certain column. That column consists of
numbers that are six digits and five digits. I need to insert a leading zero
in all those numbers that consist of only five digits. Some of those six
digit numbers already correctly have the leading zero, so when I sort, it
doesn't isolate the five digit ones. Any ideas on how I can do this?
TIA,
--
mab


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default sort by numbers of digits in cells

mab2819 wrote:
Hi,

I need to sort a large document by a certain column. That column consists of
numbers that are six digits and five digits. I need to insert a leading zero
in all those numbers that consist of only five digits. Some of those six
digit numbers already correctly have the leading zero, so when I sort, it
doesn't isolate the five digit ones. Any ideas on how I can do this?
TIA,


First, convert the entire column to numbers. Place a 1 in an open cell and copy
it. Select your list of data and the Paste Special / Values / Multiply. Then,
use a custom number format of 000000 to display the numbers with leading zeros.
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default sort by numbers of digits in cells

If you have a "number" with a leading zero, it is either a 5 digit number
custom formatted to 000000 or it is text.

Text and numbers sort differently.

First check to see if the 6 digit leading zero numbers are formatted or if
they are text.

If text, in a helper column enter this formula.

Assumes a title in A1 and data from A2 to wherever.

=IF(LEN(A2)=6,A2,"0"&A2)

Copy down.

Sort on column B.


Gord Dibben MS Excel MVP


On Wed, 20 Aug 2008 13:12:07 -0700, mab2819
wrote:

Hi,

I need to sort a large document by a certain column. That column consists of
numbers that are six digits and five digits. I need to insert a leading zero
in all those numbers that consist of only five digits. Some of those six
digit numbers already correctly have the leading zero, so when I sort, it
doesn't isolate the five digit ones. Any ideas on how I can do this?
TIA,


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
How to sort cells with cell reference to get the same numbers? Tina Excel Discussion (Misc queries) 0 May 14th 07 07:03 AM
How do I sort the last 3 digits first and then the first 4 digit?. aphriam Excel Worksheet Functions 2 April 22nd 07 03:28 AM
Sort by last 2 digits BER Excel Discussion (Misc queries) 2 January 11th 07 11:01 AM
sort numbers high to low, copy to new cells with associated data. ucastores Excel Worksheet Functions 3 September 3rd 06 02:13 PM
Sort by last 2 digits mbparks Excel Worksheet Functions 4 February 17th 05 06:11 PM


All times are GMT +1. The time now is 03:51 AM.

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

About Us

"It's about Microsoft Excel"