I would try this, if I understand you correctly. I assume the example formula you gave is in D91, and this would replace it:

Formula: copy to clipboard
=IF(AND(B91=1,C91=1),1,D90+1)