Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
7 votes

How to GROUP and ORDER data in a Google Spreadsheets?

Another way is from within the query: =QUERY(Data!A1:B6;"select A, sum(B), count(B) group by A order by sum(B) desc")
pnuts's user avatar
  • 17.6k
7 votes

How can I make some data on a Google Sheets auto-sorting?

It can be done using Google App Script. The script will automatically sort whenever there is a change in sheet data. On your Google Sheet: Choose Tools –> Script Editor and paste the below script ...
Suresh Kumar's user avatar
5 votes
Accepted

Google Sheets, how to sort query results manually (Not in query)

you can't use Data > Sort sheet by... your sheet needs to be manually sorted by creating a filtered view by selecting your column and then: Data > Filter views... > Create new filter view >...
user0's user avatar
  • 26.6k
5 votes

How to sort Trello cards by date added

You can use Butler for Trello, which is a bot that automates Trello (I'm the author). This command: sort list "X" by time in list sorts a list by the length of time that a card has been in the list. ...
Ludable's user avatar
  • 381
4 votes

Is there a way in Google Sheets to order blank cells first?

One easy way to make the blank cells appear at the top of the sheet when sorted is to enter an apostrophe ' in the empty cells. The apostrophe ' will not be displayed in the cell, so it will continue ...
Mike Pressnell's user avatar
4 votes
Accepted

Dynamically reference data from multiple tabs and sort it

Use curly brackets within this very simple query: =QUERY({Alpha!A2:B;Beta!A2:B;Charlie!A2:B},"select * where Col1 <>'' order by Col2") The trick here is the curly brackets {....} we ...
marikamitsos's user avatar
  • 12.8k
3 votes
Accepted

How to use a query to find a row of same name but last entry, then copy a value next to it

Please use the following (Adjust ranges to your needs) =SORTN(QUERY({INDEX(ROW(D2:D)),D2:E}, "select Col2, Col3 where Col2 is not null ...
marikamitsos's user avatar
  • 12.8k
2 votes

Sorting unique rows by a related SUMIF column

I'm running into exactly the same thing, and I also did a workaround but I didn't make another sheet or use the QUERY() function. I put the contents of my UNIQUE() function into a separate column, and ...
bweisberger's user avatar
2 votes

How to sort posts on Reddit by number of comments?

Use the search at the top (magnifying glass button) to search for something (or * to show everything) and select the options button (which looks like two switches) and select "Most Comments":...
Laurel's user avatar
  • 1,468
2 votes

Sort Google Search results by date?

To add to https://webapps.stackexchange.com/a/89543 above, there is a hacky way to sort all Google search results from "Any time" by date so you get new results at top without using any time range. ...
Andy's user avatar
  • 121
2 votes

Sorting title with numbers in Google Drive

It has been indicated on the Google Product Forum that if you were to put leading 0's as placeholders it will sort properly. So in @Gavin Hudson's example if you created files with names starting: ...
manumoomoo's user avatar
2 votes
Accepted

Help with ordering a Google Sheets =QUERY

Both your syntax is wrong. Both shouldn't be working and they're not working. You just think that the first one is working. ORDER by F will not and does NOT cause the parse error. There should be no ...
TheMaster's user avatar
  • 3,342
2 votes
Accepted

How Can I Sort a Data Range in Google Sheets Based on an Data Range?

Create and fill sort order numbers (column D on the screenshot) Enter the following formula to cell F2: =SORT(ARRAYFORMULA({$A2:A , IF($A2:A="", "", VLOOKUP($A2:A,$C$2:$D$8,2,FALSE))}),2,TRUE) It ...
Andrej Adamenko's user avatar
2 votes

Google Sheets, how to sort query results manually (Not in query)

Keep your primary sheet as a main "level 1" sorting logic and querying sheet. Use ORDER BY in your first sheet. Hide your first sheet. Then pull your data to a second sheet with a simple ...
Demir Aydemir's user avatar
2 votes

Trying to run two scripts on same sheet and getting error

You're missing the text "function" in front of oneditfx1 and oneditfx1. Also, your huge if/else if statement could be simplified by using a switch statement and nesting furthers ifs within that.
Eric Palmer's user avatar
2 votes

Google Sheets - Sort results of query by column B (count)

The select clause identifies "Col1" and "count(Col1)". So try order by on "count(Col1)": "select Col1, count(Col1) where Col1 != '' group by Col1 order by count(Col1)...
Tedinoz's user avatar
  • 5,721
2 votes

Sort Gmail *search results* oldest first

That option doesn't sort. When it is available it allows you to jump to the last page of search results. I find that the option is valuable when the search is simple, you are getting all the messages ...
mhoran_psprep's user avatar
2 votes

ORDER BY generating error in Google Sheets' QUERY

In a query statement, the clauses must be given in the order specified in the query language help page. The order by clause must come after group by and before label, like this: =query( 'Raw Data'!...
doubleunary's user avatar
  • 14.7k
2 votes
Accepted

How to sort a list-like text in a cell?

Please see my important comment to your original post. However, if I go only by what is included in your post (i.e., that there is one cell with alphanumeric data wherein all numeric portions are ...
Erik Tyler's user avatar
  • 5,048
2 votes

Google Sheets keyboard shortcut: 'Sort sheet AtoZ or ZtoA' on current column?

To sort ascending by the current column, press Alt+Shift+D S A. To sort descending by the current column, press Alt+Shift+D S Z. See the keyboard shortcuts help page.
doubleunary's user avatar
  • 14.7k
2 votes

Can I sort cells in Google Sheets with a key function?

You can achieve the desired result using built-in functions like this: =sort(A1:D4,byrow(C1:D4,lambda(row,max(row))),0)
The God of Biscuits's user avatar
1 vote

Locking information in rows together

Add the users as viewers, not as editors, this way they will be able to use filter views to filter and sort the data but the filtering/sorting the do will not bother other users and will not change ...
Rubén - Volunteer Moderator -'s user avatar
1 vote

Sort Google Spreadsheets so it returns 'alternating' values in a column

Not an easy problem to solve with spreadsheet formulas, so I came up with something in Google Apps Script that seems to work.: function alternateSort(data, sortColumnPos) { const sortColumnIndex = ...
Vidar S. Ramdal's user avatar
1 vote

How Can I Sort a Data Range in Google Sheets Based on an Data Range?

=ARRAYFORMULA(INDEX(SORT({A2:A, IF(A2:A="", , VLOOKUP(A2:A, {C2:C, ROW(C2:C)}, 2, 0))}, 2, 1), , 1)) to sort an existing range based on another range and without creating a new range for that ...
user0's user avatar
  • 26.6k
1 vote

How Can I Sort a Data Range in Google Sheets Based on an Data Range?

You can set a second column (commonly called a "helper column") with values for each one, then order by Ascending value by the value column. E.g. cell B2 (BK) should be '1'. B7 (BB) print '2'. B9 (BV) ...
GuruVirus's user avatar
1 vote

Sorting a sheet without losing group order

First, insert a header row if you do not have one already. Then choose View > Freeze > 1 row and create sort keys with this formula in row 1 of a free column: =arrayformula( { "Sort ...
doubleunary's user avatar
  • 14.7k
1 vote

Auto sort script sorting different sheets by different columns

Try Alice! A1: =SORT('Master'!A1:D4,2,0) Bernice! A1: =SORT('Master'!A1:D4,3,0) and so on..
TheMaster's user avatar
  • 3,342
1 vote

Can I sort rows in Google Sheets by date?

As the OP already figured out, sorting dates correctly on Google Sheets and other spreadsheet applications like Excel, require that dates are date values, not strings. Using dates on the form '1/7' ...
Rubén - Volunteer Moderator -'s user avatar

Only top scored, non community-wiki answers of a minimum length are eligible