Thanks for your replies. Unfortunately neither suggestion returns the result I was expecting in F3. =IF(AND(B3="Active",D3=0),D3,C3) returns a zero in my test, whereas your kind suggestions give a 3. Maybe there's a better function or data structure to use.