> ## Documentation Index
> Fetch the complete documentation index at: https://docs.less.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# IF all ELSE fails

IF statements - or conditional statements - are a very powerful ways to create new columns. They allow you to set up a bunch of rules that you can use to create new columns. Like the example below.

<Frame caption="A new column based on the weather">
  <img className="rounded-md" src="https://mintcdn.com/less-51/c7zKg7c6pRrkgPQD/images/tools/if-column/Illustration.png?fit=max&auto=format&n=c7zKg7c6pRrkgPQD&q=85&s=f257da362d97e894a6a3158b20ecdc77" width="1595" height="1035" data-path="images/tools/if-column/Illustration.png" />
</Frame>

In Less, we create these using the [IF Column](/tools/new-columns/if-column) tool - which is exactly what this lesson is about.

<Frame>
  <iframe className="w-full aspect-video" src="https://player.mux.com/5IUQ8i3r3WJ94zUEFT00r02CmrJEzQnM74mRCPLHIIexI?metadata-video-title=Tools+-+IF+all+ELSE+fails&video-title=Tools+-+IF+all+ELSE+fails&autoplay=1&muted=1&accent-color=%232b8761" allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;" allowfullscreen="true" />
</Frame>

## Exercise

We're working with the *ORDERS* dataset and you want to get the result shown below. We ended up with 282 rows and used eight tools to get the result.

<Frame>
  <img src="https://mintcdn.com/less-51/7vxLoN8O_CeWSGG4/images/academy/beginner/3result.png?fit=max&auto=format&n=7vxLoN8O_CeWSGG4&q=85&s=00d5f51d6e7618550cdc282dd3fcadc4" width="3000" height="922" data-path="images/academy/beginner/3result.png" />
</Frame>

We're trying to understand which of our clerks have orders that demand immediate attention. We want to give them this dataset so they'll know what to focus on.

Some notes:

1. On your way to the results, you should create two new columns using the [IF Column](/tools/new-columns/if-column) tool.
2. The first column should take the order status - which is abbreviated to a single letter - and convert it to a full word. O for Ordered, F for Fulfilled and P for Processed.
3. The second column should determine order urgency - either High, Medium or Low. Orders with a total price above 400.000 should be High, orders with a total price higher than 200.000 should be Medium and all others should be Low.
4. We are only interested in orders with a high value (the column we just created), with urgent priority (*O\_ORDERPRIORITY* column) that are ordered (the other column we just created).
5. When it comes to the *OrdersToPayAttentionTo* column, the concatenate aggregation method for Text columns in the [Group By](/tools/reshape/group-by) tool is your friend.
6. We want the data to be sorted by the number of orders to pay attention to, descending.

### Solution

<Frame>
  <iframe className="w-full aspect-video" src="https://player.mux.com/gvq8D02qbkNCHYDjYtBMB01bfB7fga88zhApjrIueuP7g?metadata-video-title=Solution+-+IF+all+ELSE+fails&video-title=Solution+-+IF+all+ELSE+fails&accent-color=%232b8761&&poster=https://less-docs.s3.eu-central-1.amazonaws.com/SolutionIFallELSEfails.png" allow="accelerometer; gyroscope; encrypted-media; picture-in-picture;" allowfullscreen="true" />
</Frame>
