Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Excel sort ( exclude letters include hyphens)?


I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23

What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Excel sort ( exclude letters include hyphens)?

When you say "then by value" do you mean the numerical value of
numbers to the right of the hyphen, or the value of those numbers to
the left?

In your example data, what would you expect the resulting order to be
after sorting according to your rules?

Pete

On Jul 1, 4:14*pm, always confused <always
wrote:
I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23

What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Excel sort ( exclude letters include hyphens)?

it should look like the list that I gave. so that anything after the hyphen
is ignored. and even though the numerical value of 002 is less than 05, 05
should come before 002


05-024
AB05-543
05-678
002-23

I hope I explained myself a little better.

"Pete_UK" wrote:

When you say "then by value" do you mean the numerical value of
numbers to the right of the hyphen, or the value of those numbers to
the left?

In your example data, what would you expect the resulting order to be
after sorting according to your rules?

Pete

On Jul 1, 4:14 pm, always confused <always
wrote:
I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23

What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Excel sort ( exclude letters include hyphens)?

So, 05 is sorted before 002 because it has only 2 digits?

When you have (effectively, after ignoring the characters) 05-024,
05-543 and 05-678, these are sorted as text values (and just happen to
be in numerical order as well)? I don't think you can just ignore the
digits after the hyphen, otherwise you may end up with 05-543, 05-678
and 05-024.

Pete

On Jul 1, 5:09*pm, always confused
wrote:
it should look like the list that I gave. so that anything after the hyphen
is ignored. and even though the numerical value of 002 is less than 05, 05
should come before 002

05-024
AB05-543
05-678
002-23

I hope I explained myself a little better.



"Pete_UK" wrote:
When you say "then by value" do you mean the numerical value of
numbers to the right of the hyphen, or the value of those numbers to
the left?


In your example data, what would you expect the resulting order to be
after sorting according to your rules?


Pete


On Jul 1, 4:14 pm, always confused <always
wrote:
I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23


What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Excel sort ( exclude letters include hyphens)?

yes, because it only has 2 digits. do you know how I can do this?

"Pete_UK" wrote:

So, 05 is sorted before 002 because it has only 2 digits?

When you have (effectively, after ignoring the characters) 05-024,
05-543 and 05-678, these are sorted as text values (and just happen to
be in numerical order as well)? I don't think you can just ignore the
digits after the hyphen, otherwise you may end up with 05-543, 05-678
and 05-024.

Pete

On Jul 1, 5:09 pm, always confused
wrote:
it should look like the list that I gave. so that anything after the hyphen
is ignored. and even though the numerical value of 002 is less than 05, 05
should come before 002

05-024
AB05-543
05-678
002-23

I hope I explained myself a little better.



"Pete_UK" wrote:
When you say "then by value" do you mean the numerical value of
numbers to the right of the hyphen, or the value of those numbers to
the left?


In your example data, what would you expect the resulting order to be
after sorting according to your rules?


Pete


On Jul 1, 4:14 pm, always confused <always
wrote:
I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23


What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Excel sort ( exclude letters include hyphens)?

I only have your posted example data to go on, so assuming this is in
A1:A4 in any order, then put this formula in B1:

=SUBSTITUTE(SUBSTITUTE(A1,"A",""),"B","")

and this one in C1:

=FIND("-",B1)-1

and copy these down to row 4. Then highlight all the data in A1:C4 and
Data | Sort using column C as the first sort key and column B as the
second sort key (no headers). This will put your data in the order you
require them, and then you can delete the helper columns B and C.

This assumes that you can only have the letters A and B in your codes,
although the formula in column B could be extended to cater for up to
7 different letters.

Hope this helps.

Pete

On Jul 1, 10:48*pm, always confused
wrote:
yes, because it only has 2 digits. *do you know how I can do this?



"Pete_UK" wrote:
So, 05 is sorted before 002 because it has only 2 digits?


When you have (effectively, after ignoring the characters) 05-024,
05-543 and 05-678, these are sorted as text values (and just happen to
be in numerical order as well)? I don't think you can just ignore the
digits after the hyphen, otherwise you may end up with 05-543, 05-678
and 05-024.


Pete


On Jul 1, 5:09 pm, always confused
wrote:
it should look like the list that I gave. so that anything after the hyphen
is ignored. and even though the numerical value of 002 is less than 05, 05
should come before 002


05-024
AB05-543
05-678
002-23


I hope I explained myself a little better.


"Pete_UK" wrote:
When you say "then by value" do you mean the numerical value of
numbers to the right of the hyphen, or the value of those numbers to
the left?


In your example data, what would you expect the resulting order to be
after sorting according to your rules?


Pete


On Jul 1, 4:14 pm, always confused <always
wrote:
I'm trying to use the sort comand on excel so that my list looks like this
05-024
AB05-543
05-678
002-23


What was asked of me is to sort the list so that letters are not taken into
consideration and so that it is sorted by the number of digits to the left of
the hyphen then by value.
Does anyone know how to do this?- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


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
Include/Exclude Holiday from Automatic Sheet Creation David Excel Discussion (Misc queries) 0 August 27th 06 04:51 PM
Include ability to sort Excel cells by colour Ian Johnston Excel Worksheet Functions 1 June 29th 06 12:36 PM
Use networkdays INCLUDE weekends, Exclude holidays ronnomad Excel Worksheet Functions 4 December 16th 05 04:55 PM
Can auto number (or OFFSET) include letters? Colleen B Excel Worksheet Functions 3 February 21st 05 09:17 PM
Does XL2K have "hard hyphens" (non-break hyphens)? StargateFan Excel Discussion (Misc queries) 0 January 29th 05 01:36 PM


All times are GMT +1. The time now is 05:43 PM.

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"