# Google Sheets: How to Sort Bars in Bart Chart

Often you may want to sort the bars in a bar chart in Google Sheets in ascending or descending order.

Fortunately this is easy to do using the SORT function in Google Sheets and the following example shows how to do so.

## Example: How to Sort Bars in Bar Chart in Google Sheets

First, let’s create the following dataset that shows the total sales made in various regions for some company:

Next, let’s create a bar chart to visualize the total sales by region.

To do so, highlight the cell range A2:B7, then click the Insert tab along the top ribbon, then click Chart.

A bar chart will appear that shows the sales for each region in the exact order that they appear in the dataset:

If you would like to sort the bars from smallest to largest based on sales values then you can type the following formula into cell D2 to create a new dataset that is sorted:

```=SORT(A2:B7, 2, TRUE)
```

Note: The argument 2 specifies that we’d like to sort by values in column 2 of the range and the argument TRUE specifies that we’d like to sort the values in ascending order.

Next, highlight the cell range D2:E7, then click the Insert tab along the top ribbon, then click Chart.

A bar chart will appear that shows the sales for each region and the bars will be sorted from smallest to largest:

If you would instead like to sort the bars from largest to smallest based on sales values then you can type the following formula into cell D2 to create a new dataset that is sorted:

```=SORT(A2:B7, 2, FALSE)
```

Note: The argument 2 specifies that we’d like to sort by values in column 2 of the range and the argument FALSE specifies that we’d like to sort the values in descending order.

Next, highlight the cell range D2:E7, then click the Insert tab along the top ribbon, then click Chart.

A bar chart will appear that shows the sales for each region and the bars will be sorted from largest to smallest:

Note: You can find the complete documentation for the SORT function in Google Sheets here.