In this post, we will see how to resolve How to return the last n number of values corresponding to a specific category?
Question:
I have the following sample data.I have tried sumproduct. That of course gives the corresponding prices. Offset can be availed to get last 5 data. But no way for getting last 5 prices corresponding to a specific category that is dynamic.
Best Answer:
You can try:
Formula in
F3
:- The latest price will be at the bottom;
- If your data is always sorted to begin with, just ditch the nested
SORT()
and use=TAKE(FILTER(A:C,B:B=F1),-F2,-1)
; - If no value is present at all, nest the formula in an
=IFERROR(<Formula>,"")
to return any value you’d like to display in such event.
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review