Here is the code =IF(SUM(I3:I8)<SUM(H2:H8),H2,-H2)+K3 Kidding. There is a flaw in the conditionals. Damn ... Without the error =IF(SUM(I3:I8)<SUM(H3:H8),H2,-H2)+K3 Just buy and hold.