Graphing the last 10 datapoints

I have a set of data that is decreasing. I would like to set up a graph that would only look at the last 10 days so to have a closer look that part of the dataset. Is there a way to do that automagically or will I have to just keep bumping the Edit References each time I update my dataset.

iPad (5th gen) Wi-Fi

Posted on Apr 19, 2020 7:31 AM

Reply
5 replies

Apr 22, 2020 11:39 AM in response to StephenM

So, you want a chart that uses as its reference the last 10 rows in your table. Yes, you can do this - but not with the same table. The problem, as you have noted, is that the address of the array consisting of your last 10 rows changes every time you complete a new row. The chart reference will not change.


What you need to do is create a separate, dynamic array that will always point to the array you wish to chart. This can be done either in a separate table, or just a separate column, though I recommend a separate table. A 2x10 will do. A1:A10 will be your header (dates, etc.) and B1:B10 your data.


Suppose the data you want charted is in column N of Table 1. Your formula in B1 will be:


B1=INDEX('Table 1'::N,COUNT('Table 1'::N)−9,1)


Note that your second argument, the COUNT function, does not need to count column N. It can count any column, as long as a numeric value exists in that column for every record in your table. Essentially what you are doing is counting the number of records, and subtracting 9. So the result will be the 10th most recent record in your table. If no column matches that criteria, use COUNTA instead.


B2=INDEX('Table 1'::N,COUNT('Table 1'::N)−8,1)

B3=INDEX('Table 1'::N,COUNT('Table 1'::N)−7,1)

.

.

.

B10=INDEX('Table 1'::N,COUNT('Table 1'::N),1)


Do the same for column A, your headers, if you want labels on your X-Axis. Now create your chart, using column B as your reference. With each new record you add to Table 1, your mini table of the last 10 records will update accordingly.


You could also use ROWS in lieu of COUNT, but this function is volatile in Excel and I believe this is true in Numbers as well, so if you have an alternative like COUNT available, use that instead. You could also use MATCH to look up the row number of the last record, with a formula such as MATCH(MAX(A),A,1) if column A contains dates. Anything that will allow you to look up the row number of the last record, which you then offset by subtracting a value ranging from -9 to 0.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Graphing the last 10 datapoints

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.