View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Sorting by last digits in cell

In B1, enter:

=right(a1,4)
(to return the last 4 characters as text)
or
=--(right(a1,4)
(to return the last 4 characters (which must be numeric) as a real number
or
=mod(a1,10000)
(if the values are really numbers)

Gary''s Student wrote:

Say the data is in column A. In B1 enter:

and copy down. Then sort cols A & B by B

For example:

856737 6737
236104 6104
825902 5902
221990 1990
991982 1982
267139 7139
307127 7127
549995 9995
762302 2302
194121 4121
172754 2754
200741 0741
365828 5828
538024 8024
483366 3366
178887 8887
716653 6653
646675 6675
283394 3394
371017 1017
791337 1337
863748 3748
707332 7332
976701 6701
515423 5423
390859 0859
640701 0701
601498 1498
495380 5380
654840 4840

will become:

640701 0701
200741 0741
390859 0859
371017 1017
791337 1337
601498 1498
991982 1982
221990 1990
762302 2302
172754 2754
483366 3366
283394 3394
863748 3748
194121 4121
654840 4840
495380 5380
515423 5423
365828 5828
825902 5902
236104 6104
716653 6653
646675 6675
976701 6701
856737 6737
307127 7127
267139 7139
707332 7332
538024 8024
178887 8887
549995 9995

--
Gary''s Student - gsnu200907

"Julie" wrote:

Hello,
I am trying to sort a column with hundreds of account numbers and would like
to sort by the last 4 digits instead of the first digits. Is there a way to
do this?
Any help would be appreciated!
Thank you.


--

Dave Peterson