ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   sorting by name (https://www.excelbanter.com/excel-worksheet-functions/235234-sorting-name.html)

dannyboy8

sorting by name
 
if I have names formatted by Mr and Mrs John Doe all in the same column, is
thee a way to sort by last name in excel 2007? the only sort I can figure out
is alpha by 1st letter, so it begins sorting the list by the 1st letter of
the 1st names. Thanks!

Mike H

sorting by name
 
Hi,

You need a helper column to extract the last name with this formula

=MID(SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,256)

having extracted the last names in the new column sort your data on this
last name.

Mike

"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same column, is
thee a way to sort by last name in excel 2007? the only sort I can figure out
is alpha by 1st letter, so it begins sorting the list by the 1st letter of
the 1st names. Thanks!


dannyboy8

sorting by name
 
Thanks Mike, strangely, it works on some cells and not others, wonder why
that would be?

"Mike H" wrote:

Hi,

You need a helper column to extract the last name with this formula

=MID(SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,256)

having extracted the last names in the new column sort your data on this
last name.

Mike

"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same column, is
thee a way to sort by last name in excel 2007? the only sort I can figure out
is alpha by 1st letter, so it begins sorting the list by the 1st letter of
the 1st names. Thanks!


Mike H

sorting by name
 
Hi,

Doesn't work on some cells isn't a very helpful description of the
problem.The only reason I can think of is may you have a Tilde (~) character
in some cells in which case it won't work. You can change the tilde in the
formula to (say) the @ sign or another more commonly used is the caret ^. I
Forgot it will also fail if there are no spaces in the cell.

Mike

"dannyboy8" wrote:

Thanks Mike, strangely, it works on some cells and not others, wonder why
that would be?

"Mike H" wrote:

Hi,

You need a helper column to extract the last name with this formula

=MID(SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,256)

having extracted the last names in the new column sort your data on this
last name.

Mike

"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same column, is
thee a way to sort by last name in excel 2007? the only sort I can figure out
is alpha by 1st letter, so it begins sorting the list by the 1st letter of
the 1st names. Thanks!


RagDyeR

sorting by name
 
With names in Column A, starting in A1, enter this formula in B1:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

Copy down as needed, THEN,
while the cells in Column B are *still* selected,
Right click in the selection and choose "Copy",
Right click again and choose "Paste Special",
and click on "Values", then <OK.

What you just did was remove the formulas and left just the data behind.

Now, select both columns and sort on Column B.

You can delete Column B when finished.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"dannyboy8" wrote in message
...
Thanks Mike, strangely, it works on some cells and not others, wonder why
that would be?

"Mike H" wrote:

Hi,

You need a helper column to extract the last name with this formula

=MID(SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,256)

having extracted the last names in the new column sort your data on this
last name.

Mike

"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same

column, is
thee a way to sort by last name in excel 2007? the only sort I can

figure out
is alpha by 1st letter, so it begins sorting the list by the 1st

letter of
the 1st names. Thanks!



RagDyeR

sorting by name
 
Try this formula instead, in case you have trailing spaces:

=TRIM(RIGHT(SUBSTITUTE(TRIM(A17)," ",REPT(" ",99)),99))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Ragdyer" wrote in message
...
With names in Column A, starting in A1, enter this formula in B1:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

Copy down as needed, THEN,
while the cells in Column B are *still* selected,
Right click in the selection and choose "Copy",
Right click again and choose "Paste Special",
and click on "Values", then <OK.

What you just did was remove the formulas and left just the data behind.

Now, select both columns and sort on Column B.

You can delete Column B when finished.
--
HTH,

RD

--------------------------------------------------------------------------

-
Please keep all correspondence within the NewsGroup, so all may benefit !
--------------------------------------------------------------------------

-
"dannyboy8" wrote in message
...
Thanks Mike, strangely, it works on some cells and not others, wonder

why
that would be?

"Mike H" wrote:

Hi,

You need a helper column to extract the last name with this formula

=MID(SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,256)

having extracted the last names in the new column sort your data on

this
last name.

Mike

"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same

column, is
thee a way to sort by last name in excel 2007? the only sort I can

figure out
is alpha by 1st letter, so it begins sorting the list by the 1st

letter of
the 1st names. Thanks!




Shane Devenshire[_2_]

sorting by name
 
Hi,

This is bad database design. A field containing the prefix and the first
and last name should be broken into three or more fields. If later you need
to use the combination you can bring them back together easily with &, the
concatenation operator.

To break this field into three columns select all the names and choose Data,
Text to Columns, pick Delimited, click Next, choose Space, click Next, pick a
destination cell where you have available room for your three columns and
click Finish.

Now sort on Last Name, First Name or whatever.

Alternatively, if you know that all names have a prefix and a first and last
name then you could use

=MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,20)

to extract the last names to another column and sort on that column.


--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"dannyboy8" wrote:

if I have names formatted by Mr and Mrs John Doe all in the same column, is
thee a way to sort by last name in excel 2007? the only sort I can figure out
is alpha by 1st letter, so it begins sorting the list by the 1st letter of
the 1st names. Thanks!



All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com