# Sort by multiple values?

**URL:** <https://forum.elixirforum.com/t/sort-by-multiple-values/29450>\
**Category:** Questions\
**Tags:** sorting\
**Created:** [February 27, 2020, 11:09am UTC](https://forum.elixirforum.com/t/sort-by-multiple-values/29450 "2020-02-27T11:09:44Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![sodapopcan](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sodapopcan/32/34668_2.png) [@sodapopcan](https://forum.elixirforum.com/u/sodapopcan)\
**Post date:** [August 2, 2022, 5:01pm UTC](https://forum.elixirforum.com/t/sort-by-multiple-values/29450/8 "2022-08-02T17:01:04Z")

</div>

I tried it out before replying—copy/pasted from my terminal:

```elixir
iex(10)> [%{color: "yellow"}, %{color: "red"}] |> Enum.sort_by(&{!&1.color})
[%{color: "yellow"}, %{color: "red"}]
iex(12)> [%{color: "yellow", name: "potato"}, %{color: "red", name: "apple"}] |> Enum.sort_by(&{!&1.color, !&1.name})
[%{color: "yellow", name: "potato"}, %{color: "red", name: "apple"}]

```

---

_[View the full topic](https://forum.elixirforum.com/t/sort-by-multiple-values/29450)._
