can anyone tell me if this is possible

Basically there are two cells I wish to reference

Cell P3 (contains values between 0 and 8, and usually counts up in increments of 1...howver it sometimes drops back to zero to start counting up again)

Cell K4 (contains values between -500 and 100)

Now I'm looking for a formula in cell a2 which basically says....

Once P3= 3, then show the value of K4, and then keep showing the value of K4 (regardless of whether or not P3 changes after this) until k4 is equal to or greater than 0, or until p3=3 again

For example

P3=1

K4=-150

therefore A2 = 0

P3=2

k4=-170

therefore A2 = 0

P3=

**3**(now start monitoring k4)

k4=-310

therefore a2= -310

p3=4

k4=-330

therefore a2= -330

p3=5

k4=-390

therefore a2= -390

p3=0

k4=-100

therefore a2=-100

p3=1

k4=40 (now greater than 0)

therefore a2=0 (reset)

p3=2

k4=-190

therefore a2=0

p3=

**3**(now start monitoring k4 again)

k4=-230

therefore a2=-230

p3=4

k4=50 (greater than 0)

therefore a2=0

Hopefully this is possible via a formula as macros are no good to me.....long story!!....thanks guys