View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
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