Sorting on calculated fields

Is it possible to sort a table on a calculated field?  If so how is this
done.

Also, what is the proper coding of AddIndex?  I seem to be getting
errors when I try to create n Index at run time.

Thanks