Hi everyone,

I come to you once more hoping I can get some help to what is probably a very simple issue I'm having.

I'm trying to use an array formula such as this:
=INDEX(A17:A1000;SMALL(IF(D2+0=B17:B1000;ROW(B17:B1000)-ROW(B17)+1);ROW(1:1)))

Whenever the values in Column B equal cell D2, return the corresponding values in A. Then I have some buttons to change the condition I have in D2. For instance, in column B I have dates in years (2013, 2014) and I want to use the buttons to chose from 2013, 2014 or total, etc.

But using the formula above only works well for 2013, when I switch to 2014 it starts showing the results for 2014 in the first row and not in the corresponding rows where values for 2014 can be found. I need the rows to match -> if condition is 2013, show results for 2013 and leave 2014 null. If I press the button for 2014 it needs to show all the nulls for 2013, and only start showing the values for 2014 in their respective rows.

I hope I was clear.
Thank you in advance!