+ Reply to Thread
Results 1 to 6 of 6

Hill notation/sort (chemistry) in Excel

  1. #1
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Hill notation/sort (chemistry) in Excel

    In chemistry, Hill notation is a common and systematic way of writing and sorting molecular formulas (http://en.wikipedia.org/wiki/Hill_system). Does anyone know of a sorting algorithm or published "custom list" for Excel to sort chemicals by formula using the Hill system? I'm sure I could build my own custom list (which, if complete, would be very long) or VBA algorithm, but I'm hoping that someone else has already done it.
    Last edited by MrShorty; 06-09-2011 at 12:34 PM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Hill notation/sort (chemistry) in Excel

    Just in case it isn't clear, I'm after an algorithm for sorting a list of chemical formulas after they are written in Hill notation. My lists will have the formulas entered in Hill notation. What I'm looking for is a way to sort that list according to the conventions used in the Hill system.

  3. #3
    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: Hill notation/sort (chemistry) in Excel

    You could use a UDF to generate a sortable string, then sort on that:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    E.g., =HillPad(A1)

    Some ambitious wag could do this in shorter form with a Regular Expression.
    Last edited by shg; 06-08-2011 at 08:25 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Hill notation/sort (chemistry) in Excel

    Thanks for your help.

    I haven't yet had a chance to play with it. If I understand what you are trying to do, this function:
    1) Takes the existing formula as input
    2) Parses the formula
    3) Creates a new text string for the formula that will then follow the normal alphabetic sorting rules

    Does that sound right?

  5. #5
    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: Hill notation/sort (chemistry) in Excel

    Yup .

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Hill notation/sort (chemistry) in Excel

    Seems to work pretty well. Thanks for your help.

+ 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