Re: Average only the last X numbers in a column (basing on criteria)
Thank you to all of you, i've found this excellent solution for my case:
=SUM(IF(ISNUMBER(MATCH(ROW($D$4:$D$3678);LARGE(IF($D$4:$D$3678=C1080;ROW($D$4:$D$3678));ROW(INDIRECT("1:"&AN1080)));0));$O$4:$O$3678))
this was also to be used on another cell (AN1080 in my case) to reduce the number of entries to the minimum available (in case the occurrencies were less than 5):
=MIN(5; COUNTIF($D$4:$D$3678; C1080))
This functions are just amazing ...
NOTE: The above function sum up the last 5 cell values (even if there are 50 occurrencies for that particular string), referring to a certain text string (present in cell C1080).