Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheet Last X Rows

I'm using charts in Google Spreadsheet to plot the last 90 days of data. However, when adding new data it's outside the charts currently selected range of A1:A90. Is there a function I can use to select the last 90 rows of data in a column of a Google Spreadsheet?

like image 985
dgitman Avatar asked Aug 01 '13 13:08

dgitman


People also ask

How do I put X marks in Google Sheets?

Put the cursor into a cell that should contain a Google Sheets checkmark and press Alt+I,X (first press Alt+I, then release only the I key, and press X while holding Alt).

How do I find the last data in Google Sheets?

There's no LAST() function. However, there is a solution; the INDEX function. In Google Sheets, the formula INDEX() allows you to return the value of a cell by specifying which row and column to look at in the specified array. =INDEX(A:A,1,1) for example will always return the first cell in column A.


1 Answers

You can create a new sheet and use the QUERY function to get the last 90 rows:

  • If column A is unique and sortable, you simply sort your data in reverse order and take the top 90 rows, and then reverse sort it again: =SORT(QUERY(Sheet1!A:Z,"order by A desc limit 90"),1,1)
  • If that is not the case, then you need to calculate the offset by finding the last row and subtracting 90 from it, and then query the data to return 90 rows starting from that offset: =QUERY(Sheet1!A:Z,"limit 90 offset "&(COUNT(Sheet1!A:A)-90))

You can then use this sheet to generate your chart.

like image 142
ArtBIT Avatar answered Oct 16 '22 16:10

ArtBIT