I have trouble writing a formula in Calc for something I can do quite easily in Excel.

basic problem: i have a list of names in column A. i need to find the next row with an identical name in column A, that also has a value > 0 in column B.

In excel i write something like: {=MATCH(A2;IF(B3:B$150>0;A3:A$150);0)} and it works nicely.

eg:

row | A:name | B:criteria | formula | result

1 | Jim | 2 | {=MATCH(A1;IF(B2:B$6>0;A3:A$6);0)} | 5

2 | Kyle | 1 | {=MATCH(A2;IF(B3:B$6>0;A3:A$6);0)} | 3

3 | Jim | 0 | {=MATCH(A3;IF(B4:B$6>0;A4:A$6);0)} | 3

4 | Stan | 1 | {=MATCH(A4;IF(B5:B$6>0;A5:A$6);0)} | na

5 | kyle | 2 | {=MATCH(A5;IF(B6:B$6>0;A6:A$6);0)} | na

6 | Jim | 2 | na | na

this formula does not work in Calc. I can't figure out why. Any ideas? thanks.