[FONT="]In column A I have different names, each of these names has a corresponding value in column B see example below:[/FONT]

[FONT="]The following formula can look up any name entered in C1 (i.e X) and returns the sum of the last 3 X-Values.

[FONT="]=SUMPRODUCT(B1:B9*(ROW(A1:A9)=LARGE(ROW(A1:A9)*(A1:A9="X"),{1,2,3})))[/FONT][/FONT]

[FONT="]

In the below example for the last 3 X-values the total sum is 3.[/FONT]

[FONT="]

PROBLEM: How can I reverse the order so that in stead of summing up the

**last**three X-Values ( cells A9, A8 and A6) i get the sum of the first three X-values (i.e. values for cells A1, A4 and A6)???

Thank you for all comments and suggestions!

[/FONT]

A | B | C | D | |

1 | X | 2 | X | 3 |

2 | Y | 1 | ||

3 | Z | 1 | ||

4 | X | 2 | ||

5 | Z | 3 | ||

6 | X | 1 | ||

7 | Y | 2 | ||

8 | X | 1 | ||

9 | X | 1 |

<tbody>

</tbody>