Need help with an IF statement

I am lost with an if statement and need some help.

What I'm trying to accomplish:

=if(J:J=1,sum(K:K),0)

I want if there is a 1 in column J, to add all the things in column K together, otherwise put a zero.

I am creating an open to buy tracking PO's cut, so I have a budget lined out and if in quarter 1, on a PO I spent 200.00, then I spent 200.00 again, I need it to add to 400 in another cell for me.

What am I missing?

Almir's picture

This should work

=IF(COUNTIF(J:J,1)>0,SUM(K:K),0)

This formula counts occurences of 1. If there is at least one occurence, it will sum K column. Otherwise, it returns 0.

Need more details

Can you send me a sample work book.
I think this is very easy with sumif()and Array

Bala