Hi all

I have been doing a bit of searching on the web but cant seem to find the exact answer I am looking for, or if I have found something my knowledge is not quite up to scratch as how to change said formula to suit my needs.

At work my colleague and I have basically created an excel appointments diary to book patients into.

We have separate sheets per physician and on these sheets we have created a 'box' for each date. With each of the box's we have a count function to return the number of booked, available and cancelled spaces.

What we want to do is have a formula that returns to us the earliest possible date with space available. Effectively we have this:

Date # of patients
1.4.09 0
3.4.09 0
20.4.09 8
21.4.09 1
21.4.09 0
23.4.09 12
24.4.09 4
27.4.09 9
28.4.09 8
30.4.09 14

What formula would you suggest using? I did try using a nested IF function i.e. =IF(B1>=1,A1,value_if_false, IF(B2>=1,A2,value_if_false)). The value_if_false is what I had a problem with as if it is false I wanted the formula to look for the next date available with spaces. I always got a 'too many arguments' error returned.

Any help would be much appreciated, or just pointing me into the right direction would be great.

Cheers

Jared