The program operates on data entered in cells of a table. Spreadsheets were developed as computerized analogs of paper accounting worksheets. A spreadsheet is a computer application for organization, analysis, and storage of data in tabular form.
![]() ![]() is_ascending is TRUE or FALSE, indicating whether to sort sort_column in ascending order. The sort_column can also be a range outside of range by which to sort the data. sort_column is the index (number) of the column in the range. We will have to add the following arguments into it for it to work. What is shift tab in word for macWhen sorting by text values, the alphabetical order (A-Z) means ascending order. You can sort by text and number values as well. Using two or more additional sorting arguments will enable you to sort by multiple columns.⚠️ Notes to Make Your SORT Function Work Perfectly sort_column2 , is_ascending2 are optional additional columns and sort order flags beyond the first, in order of precedence.Without using the optional values, you can sort a data set by one column. What'S The Short Cut On For Sorting In Google Sheets How To Use TheIf you use the SORT function with only giving the range, it will automatically sort the range based on the first column, in ascending order.Let’s look at some examples of how to use the SORT function in Google Sheets.We are going to work with the following example data set containing a list of products with several columns of their details (ID, name, price, number of sold items).Say we want to sort the products by their names alphabetically.It’s a simple case where we want to sort the products by the values of one column. If there are non-empty cells in this area, an error message is returned by the SORT function. This means that the same amount of rows and columns as the original data should be available next to and below the cell where we write the formula. The cell range where we want to put our new sorted data should be totally empty. The sort_column argument should include one single column that covers all the existing rows within the range. The same applies to the laptop and TV.Now let’s change the order of the arguments, and firstly sort by the fourth column in descending order, then sort by the third column in ascending order: =SORT(A3:D8, 4, FALSE, 3, TRUE)In this case, the primary sorting is based on the number of sold items, and if that is the same for two or more products, then they are sorted by their prices in ascending order.You can see that we get a totally new order with this formula. In the example, where the products have the same price, they are then sorted by their columns of “Items sold” in descending order (because is_ascending is FALSE).For example, the speaker and the microphone have the same price, so after the first sorting, the formula also sorts them by their number of sold items. Let’s look at some other ways of how to use SORT function in Google Sheets!You may make a copy of the spreadsheet using the link I have attached below and try it for yourself:So far we only used the mandatory arguments of the SORT function, and we sorted our data set by one column.We can see from the syntax of the SORT function, that it is possible to sort by multiple (two or more) columns with the additional arguments.We can write a SORT function with more arguments in the following way: =SORT(A3:D8, 3, TRUE, 4, FALSE)First, the formula sorts the range by the third column, by the prices in ascending order (because is_ascending is TRUE).The secondary sorting argument comes in where the first sorting results in a tie. is_ascending should be TRUE, because we want to have an A-Z order.The following formula will do the job: =SORT(A3:D8, 2, TRUE)As a result, we get a new table with the same products but sorted alphabetically.You can see how to write this function step-by-step below in the last section.So we have seen how the SORT function works in the simplest version, but there are more options to use it on our data set. sort_column is the column of Product name, so it is the second column in the data set. range is the whole area where the products are located, which is A3:D8 in the example. Meanwhile, the rest of the data set did not change, so we have successfully assigned new IDs to our existing products.Be aware that it is not possible to delete the column of the old IDs here. Here we want to use the values of the name column, which are in the cells C2:C7.Taking this into consideration, the formula we should write in the cell B2 is: =SORT(A2:A7, C2:C7, TRUE)After hitting the ‘Enter’, we have the newly sorted column of IDs. We have to define a column reference on which we want to base our sorting. We would like to assign the smallest ID to the first product when sorted alphabetically and so on.In formula words, we would like to sort the ID column by the name column in ascending order starting from the cell B2.The range is not the whole data of the products now, but only the column with the IDs since we only want to sort these values.In this case, we can’t write the sort_column as the number of the column, because it is not part of the range to be sorted. None of the values of the products have been mixed, only their order has been sorted.Let’s look at an example where we only want to sort a part of the whole data and we want to use a column reference which is not in the range that we want to sort.Obviously, we don’t want to mix up the product names and their prices, but say we would like to assign new IDs to the products. It means that the content of one row has never changed. We will write our SORT formula in the cell E3 (as this is the cell where we want to start our new sorted data). For the purposes of this guide, we will make sure that the area E3:H8 is empty before starting to work with the SORT function: There should be an available empty area with the same number of rows and columns as the original data. Before starting it, we have to decide where we would like to put our sorted data. If you only need the new, sorted column, it is better to use the sorting options of the menu bar.How to Use SORT Function in Google SheetsLet’s get back to the example of sorting the products by their names alphabetically and see how to write the SORT function step-by-step. We separate the values inside the function with commas ‘ ,‘. The range will be the whole unsorted data set, so the range of A3:D8. After the opening bracket, we have to add the first argument. We have all the products with their details on a new sorted list.That’s it, well done! You can now use the SORT function together with the other numerous Google Sheets formulas to create even more powerful formulas that can make your life much easier. Therefore we have to write the following formula in the cell E3 and then hit Enter:The result is a new range with the products sorted in ascending order by the second column. After we have written all the necessary variables, we have to close the brackets ‘ )‘. We are not going to use the optional sort_column2, is_ascending2 values because we only sort by one column. We want to sort them alphabetically which means ascending order, so is_ascending should be TRUE.
0 Comments
Leave a Reply. |
AuthorStephanie ArchivesCategories |