Alpha Numeric Sorter

October 8, 2008 by: David Lai

Here is an Xcelsius Example that ranks your table based on whether you want to rank it numerically or alphabetically.

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”http://www.davidlai101.com/blog/media/blogs/bobj/Excel%20Ranker/Alphanumeric%20Sorter.swf” width=”500″ height=”200″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]
Many of you may have had the trouble of trying to sort a table of data. If you only need to sort alphabetically, then the listview object works fine. However, it does not work with numerics where 12 will come ahead of 6.

Ranking your rows

The first picture shows how to rank numbers. As you can see the alpha will come in as ascending order. This can easily be done through your Live Office or Web Service Query. If the data is static you can just go to Data -> Sort in Excel and choose Data Column A. The reason for this is that the Countif function has a bug in Excel where if you execute COUNTIF($A$2:$A$6,”>” & A2), it will interpret it as COUNTIF($A$2:$A$6,”=” & A2)

The simple Rank formula for the numeric column that I used takes the rank of each row and spits back the number. It also takes into account if there are duplicate numeric columns. If there is then it uses the COUNTIF($B$2:B2,B2)-1) part to increment the rank accordingly.

index match

Once we have our ranking setup, we have our index match formula that will match the appropriate column to the index.

I’ve attached the source files below that you can reuse for your own pleasure. There are some additional comments in the Excel file that explains more about what is going on for those of you who are curious.

Download Source

Comments

2 Responses to “Alpha Numeric Sorter”
  1. Chuck says:

    But Index() and Match() are not supported Excel Function? Right?

  2. David Lai says:

    Hi Chuck,
    Index() and Match() are definitely supported by Xcelsius.

    I use it all the time and performance wise is better than Vlookup