Glad it was helpful. You might also try (seventh row1) or (nth 6 row1). I think it is the same thing, but more obvious to read!

John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Thu, Oct 1, 2020 at 10:37 AM Axel Kielhorn <org-mode@axelkielhorn.de> wrote:


> Am 01.10.2020 um 14:21 schrieb John Kitchin <jkitchin@andrew.cmu.edu>:
>
> You could do something like this:
>
>
> * Table 1
>
> #+name: table1
> | Manufacturer    | Name        | Price |
> |-----------------+-------------+-------|
> | ACME            | super cheep | 25 $  |
> | Roadrunner Inc. | Kaboom      | 27 $  |
> | ACME            | cheep       | 30 $  |
>
> #+RESULTS: resorted
> | Manufacturer    | Name        | Price |
> |-----------------+-------------+-------|
> | ACME            | super cheep | 25 $  |
> | ACME            | cheep       | 30 $  |
> | Roadrunner Inc. | Kaboom      | 27 $  |
>
> ** Code for resorting
>
> #+name: resorted
> #+BEGIN_SRC emacs-lisp :var data=table1 :colnames t
> (sort data (lambda (row1 row2) (string< (first row1) (first row2))))
> #+END_SRC
>
> John
>

Thanks John, this is really powerful.

I changed =first row1= to =elt row1 6= since my real table is more complex.

(Again I learned a little bit more about elisp.)

Greetings
Axel