+ Reply to Thread
Results 1 to 14 of 14

Possible to sort part of a cell?

  1. #1
    Registered User
    Join Date
    12-20-2005
    Posts
    2

    Possible to sort part of a cell?

    I have a column with email addresses in the format: [email protected]. Is it possible to sort these in order based on the last name?

  2. #2
    Tom Ogilvy
    Guest

    Re: Possible to sort part of a cell?

    If you make a dummy column and extract the last name

    assume the example is in A1. Then in B1 enter

    =MID(A1,FIND(".",A1)+1,FIND("@",A1)-FIND(".",A1)-1)

    And drag fill down the column. Now sort columns A and B with B as the key
    column.

    --
    Regards,
    Tom Ogilvy


    "helios02" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a column with email addresses in the format:
    > [email protected]. Is it possible to sort these in
    > order based on the last name?
    >
    >
    > --
    > helios02
    > ------------------------------------------------------------------------
    > helios02's Profile:

    http://www.excelforum.com/member.php...o&userid=29791
    > View this thread: http://www.excelforum.com/showthread...hreadid=494969
    >




  3. #3
    Don Guillett
    Guest

    Re: Possible to sort part of a cell?

    try putting this in a helper column
    =MID(E6,FIND(".",E6)+1,FIND("@",E6)-FIND(".",E6)-1)
    --
    Don Guillett
    SalesAid Software
    [email protected]
    "helios02" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a column with email addresses in the format:
    > [email protected]. Is it possible to sort these in
    > order based on the last name?
    >
    >
    > --
    > helios02
    > ------------------------------------------------------------------------
    > helios02's Profile:
    > http://www.excelforum.com/member.php...o&userid=29791
    > View this thread: http://www.excelforum.com/showthread...hreadid=494969
    >




  4. #4
    Registered User
    Join Date
    12-20-2005
    Posts
    2
    Thanks, it works.

  5. #5
    Don Guillett
    Guest

    Re: Possible to sort part of a cell?

    glad to help but Tom was faster.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "helios02" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks, it works.
    >
    >
    > --
    > helios02
    > ------------------------------------------------------------------------
    > helios02's Profile:
    > http://www.excelforum.com/member.php...o&userid=29791
    > View this thread: http://www.excelforum.com/showthread...hreadid=494969
    >




  6. #6
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    863

    Re: Possible to sort part of a cell?

    Hi there!

    Old thread but very usefull...
    My question is: is there a VBA way to sort a table after just a part of a column?
    I have a ("B") column like

    900E
    13241E
    133E
    13244E
    14E

    Normally if I try to sort the result would be something like..
    13241E
    13244E
    133E
    14E
    900E

    I would like to be able to sort my table using just the numeric value:
    14E
    900E
    133E
    ...
    ...
    without using additional/dummy column. Can it be done?
    Thank you !
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Possible to sort part of a cell?

    Quote Originally Posted by bulina2k View Post
    I would like to be able to sort my table using just the numeric value:
    14E
    900E
    133E
    ...
    ...
    without using additional/dummy column. Can it be done?
    Thank you !
    Why does 900 appear before 133?
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    863

    Re: Possible to sort part of a cell?

    I'm sorry, you're right.. just a typo :P
    so:
    14E
    133E
    900E
    13241E
    13244E

  9. #9
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    863

    Re: Possible to sort part of a cell?

    I think I've found a way but again I need your help.
    In order to sort the table using the numbers in column "B" I'll use Range.Replace to erase that "E" at the end of the number.
    Then I'll sort the table with DataOption1:=xlSortTextAsNumbers sort option and then (here I need your help) I will add that "E" tail back to each cell in column "B".
    Is there a way to use Range.Replace (or any other function) to add a char to the values in a range without using a loop ?

    Thanks again!

    Please Login or Register  to view this content.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: Possible to sort part of a cell?

    Quote Originally Posted by bulina2k View Post
    Is there a way to use Range.Replace (or any other function) to add a char to the values in a range without using a loop ?
    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    863

    Re: Possible to sort part of a cell?

    Thank you very much jindon, that works perfect for a fixed range (B2:B650).
    Is there a way to use it for let's say [B2:B & lr] ?
    lr being the last used row.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: Possible to sort part of a cell?

    If use of Variable, it should be like
    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    863

    Re: Possible to sort part of a cell?

    Arigatou gozaimasu jindon.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: Possible to sort part of a cell?

    Dō itashimashite.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1