+ Reply to Thread
Results 1 to 6 of 6

Sort by first capital

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    Sort by first capital

    How would I get Excel to alphabetize cells in a column by the first capital letter in the cell?

    For example,
    ...
    Wyoming
    ...
    at San Francisco
    ...

    I need the spreadsheet to skip the word at and alphabetize by the first capitalized location (Also, it's always "at" so if it's easier, Excel could just ignore "at" and alphabetize the list)

    Thanks.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sort by first capital

    Are those dots in some of the cells?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    08-30-2013
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Sort by first capital

    No the dots are just to illustrate that those are two separate cells.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sort by first capital

    Maybe you can do something like this.

    Data Range
    A
    B
    2
    Wyoming
    Wyoming
    3
    at San Francisco
    San Francisco
    4
    Colorado
    Colorado
    5
    at New Mexico
    New Mexico
    6
    Florida State
    Florida State
    7
    at Pitt
    Pitt

    Enter this formula in B2 and copy down:

    =MID(A2,IF(LEFT(A2,3)="at ",4,1),25)

    Inspect the results to make sure they are what you want.

    Then, convert the formulas to constants...

    Select the entrie range of formulas in column B.
    Right click>Copy
    Right click>Paste Special>Values>OK

    You can now sort on column B and you can delete the original data if so desired.

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Sort by first capital

    Assuming your data start in A2

    In B2: =MID(A2,MATCH(1,(CODE(MID(A2,ROW($1:$99),1))>=65)*(CODE(MID(A2,ROW($1:$99),1))<=90),),99)

    Array formula press Ctrl+Shift+Enter, not just Enter
    copy down as far as needed

    Then sort in column B

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sort by first capital

    Quote Originally Posted by Teethless mama View Post
    Assuming your data start in A2

    In B2: =MID(A2,MATCH(1,(CODE(MID(A2,ROW($1:$99),1))>=65)*(CODE(MID(A2,ROW($1:$99),1))<=90),),99)
    Using the ROW function like that makes the formula vulnerable to new row insertions.

    Using the INDIRECT function is a more robust choice.

    ROW(INDIRECT("1:99"))
    Last edited by Tony Valko; 08-30-2013 at 10:52 PM. Reason: Had the wrong function in there!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sort capital letters before lower case?
    By Tinwelende in forum Excel General
    Replies: 42
    Last Post: 06-17-2013, 03:58 PM
  2. If Formula, Capital K
    By pauldaddyadams in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-13-2011, 02:32 PM
  3. sort values which has numeric, spaces and capital letter characters
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-09-2009, 06:05 PM
  4. capital letter
    By holybull in forum Excel General
    Replies: 7
    Last Post: 09-27-2009, 04:30 PM
  5. Capital
    By Roger in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-12-2006, 01:50 PM

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