Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default sort a cell by last two digits

I am trying to sort my colum by the last two digits of the number in each cell.
EX:
50201.1001
50201.1002
50201.1003
50201.2001
50201.2002
50201.2003
50201.3001
50201.3002
50201.3003

I want to sort by the last two digist of 01,02,03 of my column. Does anyone
have any idea how to do this. Or if it is even possible. If you do please
can you explain to me step by step what I will have to do to accomplish this
task.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default sort a cell by last two digits

Put your data in column A and in B1 enter:

=--RIGHT(A1,2) and copy down

then sort both cols A & B by B
--
Gary''s Student - gsnu200826


"mi20chelle02" wrote:

I am trying to sort my colum by the last two digits of the number in each cell.
EX:
50201.1001
50201.1002
50201.1003
50201.2001
50201.2002
50201.2003
50201.3001
50201.3002
50201.3003

I want to sort by the last two digist of 01,02,03 of my column. Does anyone
have any idea how to do this. Or if it is even possible. If you do please
can you explain to me step by step what I will have to do to accomplish this
task.

Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default sort a cell by last two digits

hi
most custom sort are done by adding a helper column and using the helper
column as the primary sort.
in a blank column next to your data, enter this formula....
assuming data starts at A2...
=right(A2,2)
this will return the last to digits of the data in A2. Copy the formula down
as far as you need.
now just sort the data, including the helper column as primary sort. other
colunms as secondary/other.
the helper column is just a tool, not part of the data so after sort, you
can delete if no longer needed or hided if you need to sort frequently.

Regards
FSt1

"mi20chelle02" wrote:

I am trying to sort my colum by the last two digits of the number in each cell.
EX:
50201.1001
50201.1002
50201.1003
50201.2001
50201.2002
50201.2003
50201.3001
50201.3002
50201.3003

I want to sort by the last two digist of 01,02,03 of my column. Does anyone
have any idea how to do this. Or if it is even possible. If you do please
can you explain to me step by step what I will have to do to accomplish this
task.

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default sort a cell by last two digits

One way is to use a helper column.

Assume the values are in column A, and column B is blank.

If the values are Text, enter

B1: =RIGHT(A1,2)

if the values are numbers, you're safer using

B1: =RIGHT(TEXT(A1,"0.0000"),2)

Sort both columns using column B to sort by.

In article ,
mi20chelle02 wrote:

I am trying to sort my colum by the last two digits of the number in each
cell.
EX:
50201.1001
50201.1002
50201.1003
50201.2001
50201.2002
50201.2003
50201.3001
50201.3002
50201.3003

I want to sort by the last two digist of 01,02,03 of my column. Does anyone
have any idea how to do this. Or if it is even possible. If you do please
can you explain to me step by step what I will have to do to accomplish this
task.

Thanks for your help.

  #5   Report Post  
Posted to microsoft.public.excel.misc
JB JB is offline
external usenet poster
 
Posts: 115
Default sort a cell by last two digits

Hello!

With VBA

http://cjoint.com/?borVhnswJy

Sort with 2 last digits
Sub Sort()
[B:B].Insert Shift:=xlToRight
n = [A65000].End(xlUp).Row
For Each c In Range("A2:A" & n)
c.Offset(0, 1) = Right(c, 2)
Next c
Range("A2:B" & n).Sort Key1:=[B2], Order1:=xlAscending,
Header:=xlGuess
[B:B].Delete
End Sub

JB
http://boisgontierjacques.free.fr


On 14 jan, 16:21, mi20chelle02
wrote:
I am trying to sort my colum by the last two digits of the number in each cell.
EX:
50201.1001
50201.1002
50201.1003
50201.2001
50201.2002
50201.2003
50201.3001
50201.3002
50201.3003

I want to sort by the last two digist of 01,02,03 of my column. *Does anyone
have any idea how to do this. *Or if it is even possible. *If you do please
can you explain to me step by step what I will have to do to accomplish this
task. *

Thanks for your help.




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
sort by numbers of digits in cells mab2819 Excel Worksheet Functions 4 August 20th 08 10:38 PM
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
How do I sort different combination of a 4 digits number didi Excel Discussion (Misc queries) 4 March 23rd 07 08:27 PM
Sort by last 2 digits BER Excel Discussion (Misc queries) 2 January 11th 07 11:01 AM
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 05:54 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"