Excel Forum,

I have THREE columns. One is called ‘Total Line Amount Paid’ (AB), the other called ‘PO Ext Price’ (X), and the third is called 'Est Ext Price' (R). I want to subtotal all of column AB and include an IF function with it. For instance, if cell AB2=0, then add cell X2, if cells AB2 and X2 = 0, then add cell R2, otherwise add AB. I'm using subtotal because I'm using a filter and only want to sum the visible cells. The fomula will be on a tab called 'Template' and the data being calculated is on another tab called 'Detail Orders'.

Below is a formula another EF user provided, but it does not incorporate column R. Please assist. I'd greatly appreciate it!
=SUBTOTAL(9,'Detail Orders'!AB2:AB60000)+SUMPRODUCT(SUBTOTAL(9,OFFSET('Detail Orders'!X2,ROW('Detail Orders'!X2:X60000)-ROW('Detail Orders'!X2),0)),('Detail Orders'!AB2:AB60000=0)+0)

Thanks,

mbnewton1