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 how can i sort on a perticular column for odd and even numbers


Column1
0021D8B9B5FE
0021D8B9B494
001FCAE8A6B1
0021D8B9B6BF
001FCAE88DEE
0021D8B9AD96
001FCAE8A9C8
0021D8B9B5F7
0021D8B9B90E
0021D8B9B758


I want to sort on the last digit on each value:

for example:
0021D8B9B5FE
If last digit start with 1,3,5,7,9,a,c,e (consider this odd numbers)
if last digit start with 2,4,6,8,0, b,d (sondifer this even)


So how can I sort each raw based on the last character being odd or
even in excel.

=thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default how can i sort on a perticular column for odd and even numbers

You could use a helper column
=CODE(RIGHT(A1))
--
David Biddulph

wrote in message
...

Column1
0021D8B9B5FE
0021D8B9B494
001FCAE8A6B1
0021D8B9B6BF
001FCAE88DEE
0021D8B9AD96
001FCAE8A9C8
0021D8B9B5F7
0021D8B9B90E
0021D8B9B758


I want to sort on the last digit on each value:

for example:
0021D8B9B5FE
If last digit start with 1,3,5,7,9,a,c,e (consider this odd numbers)
if last digit start with 2,4,6,8,0, b,d (sondifer this even)


So how can I sort each raw based on the last character being odd or
even in excel.

=thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default how can i sort on a perticular column for odd and even numbers

Am I correct in assuming that you want all the odd last digits plus A,C,E etc
to be at the top of the sort and all the even last digits numbers plus B,D,F
to be at the bottom?

If my assumption is right then you need to use another column and get the
code for the last digit and if it is an even code then add 50 and if odd
leave code as it.

Then sort on the new column and the odd ones will be at the top and the even
at the bottom. The below example assumes that the number is in cell A2. Copy
the formula into B2 and copy it down to the bottom and sort on column B.

Note that the ASCII codes for odd numbers are all odd numbers also and code
for A is also odd. Therefore the Mod test is testing for even ASCII numbers
and if even then add 50. (Adding 50 takes them all above the ASCII codes for
uppercase alphas). Also the ASCII codes for numerics are lower than for alpha
characters so the numerics will be before the alphas.

The UPPER function is used in case there are any lower case alphas. Can be
left there whether or not you have lower case alphas.

The following is one line although it breaks on this post.

=IF(MOD(CODE(UPPER(RIGHT(A2,1))),2)=0,CODE(UPPER(R IGHT(A2,1)))+50,CODE(UPPER(RIGHT(A2,1))))

--
Regards,

OssieMac


" wrote:


Column1
0021D8B9B5FE
0021D8B9B494
001FCAE8A6B1
0021D8B9B6BF
001FCAE88DEE
0021D8B9AD96
001FCAE8A9C8
0021D8B9B5F7
0021D8B9B90E
0021D8B9B758


I want to sort on the last digit on each value:

for example:
0021D8B9B5FE
If last digit start with 1,3,5,7,9,a,c,e (consider this odd numbers)
if last digit start with 2,4,6,8,0, b,d (sondifer this even)


So how can I sort each raw based on the last character being odd or
even in excel.

=thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default how can i sort on a perticular column for odd and even numbers

Assume your data in A2:A11
Create a helper column
In B2: =CODE(RIGHT(A2))
copy down to B11

Prior to XL-2007 use this formula:
In C2:
=IF(ISERR(MATCH(SMALL(IF(MOD($B$2:$B$11,2)=1,$B$2: $B$11),ROWS($1:1)),$B$2:$B$11,0)),"",INDEX($A$2:$A $11,MATCH(SMALL(IF(MOD($B$2:$B$11,2)=1,$B$2:$B$11) ,ROWS($1:1)),$B$2:$B$11,0)))

ctrl+shift+enter, not just enter
Copy down to C11


XL-2007 use this formula:
In C2:
=IFERROR(INDEX($A$2:$A$11,MATCH(SMALL(IF(MOD($B$2: $B$11,2)=1,$B$2:$B$11),ROWS($1:1)),$B$2:$B$11,0)), "")

ctrl+shift+enter, not just enter
Copy down to C11




" wrote:


Column1
0021D8B9B5FE
0021D8B9B494
001FCAE8A6B1
0021D8B9B6BF
001FCAE88DEE
0021D8B9AD96
001FCAE8A9C8
0021D8B9B5F7
0021D8B9B90E
0021D8B9B758


I want to sort on the last digit on each value:

for example:
0021D8B9B5FE
If last digit start with 1,3,5,7,9,a,c,e (consider this odd numbers)
if last digit start with 2,4,6,8,0, b,d (sondifer this even)


So how can I sort each raw based on the last character being odd or
even in excel.

=thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default how can i sort on a perticular column for odd and even numbers

Hi,

Enter the following formula and sort on its column:

=CODE(RIGHT(A2))+ISEVEN(CODE(RIGHT(A2)))*100

If this helps, please click the Yes button

Cheers,
Shane Devenshire

" wrote:


Column1
0021D8B9B5FE
0021D8B9B494
001FCAE8A6B1
0021D8B9B6BF
001FCAE88DEE
0021D8B9AD96
001FCAE8A9C8
0021D8B9B5F7
0021D8B9B90E
0021D8B9B758


I want to sort on the last digit on each value:

for example:
0021D8B9B5FE
If last digit start with 1,3,5,7,9,a,c,e (consider this odd numbers)
if last digit start with 2,4,6,8,0, b,d (sondifer this even)


So how can I sort each raw based on the last character being odd or
even in excel.

=thanks in advance

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 a column of Randomly selected numbers? Khoshravan Excel Worksheet Functions 8 July 14th 07 08:16 PM
how do I sort a column mixed with odd and even numbers .. ? Istvan Excel Discussion (Misc queries) 1 March 10th 07 04:02 AM
HOW DO I SORT A COLUMN OF NUMBERS AND HAVE THE DUPLICATES REMOVED Jeff Excel Discussion (Misc queries) 2 August 29th 06 08:38 PM
sort and return column numbers [email protected] Excel Worksheet Functions 5 May 16th 06 11:39 AM
sort a column of numbers with 100510 and 10160 so they are in th. Uncle Al Excel Discussion (Misc queries) 6 February 2nd 05 12:41 PM


All times are GMT +1. The time now is 10:25 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"