Pergunta

Is there any way to look up and display the latest value in a group that does not have a set range?

Here's a breakdown of a question. I am working with some data that I like to break into data groups that can be collapsed. On a weekly basis I un-collapse the group and insert a line at the bottom with the new information. I would like that latest bit of information to be automatically displayed on the top cells that is displayed when collapsed.

I have used look-up tables and I have a function that I used for testing purposes: =LOOKUP(2,1/(C5:C11<>""),C5:C11) that obtains the last cell within that designated ranged: C5-C11.

Now can I do something similar within grouped data values that have no defined range?

Foi útil?

Solução

One way to do this is with an index function, assuming that there are no other rows of data on this worksheet other than the group that you're trying to find. Here's an example of a formula that could work for you. It assumes that your data starts in K2 and you want to have your result in K1.

=INDEX(OFFSET(K2,,,ROWS(K:K)-ROW(K2),1),MATCH(9.99999999999999E+307,
OFFSET(K2,,,ROWS(K:K)-ROW(K2),1)),1)

The offset creates an array for all cells below k1 without counting k1. The match function searches for the largest number possible, this formula assumes that you're looking for numbers. If you're looking for text, or a combination, you'll have to use a different formula by replacing the match portion with:

MATCH(REPT("z",255) 'for text
MAX(MATCH(9.99999999999999E+307,range),MATCH(REPT("z",255) 'for numbers and text

Source: http://www.techonthenet.com/excel/questions/last_value.php

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top