Excel sum if then?

Copper Contributor

I am looking to do a sum of the answers in Col M without using Col M.  Do-able?

tami_winkler_0-1631723149136.png

 

5 Replies
Something like this should work:
=SUMPRODUCT(IF(H:H+K:K<=0,H:H,-K:K))

@mtarler   When I use the columns, it works.  However, when I use only the rows I need, it brings back #VALUE!

maybe you could share the actual formula or better yet the worksheet (no confidential info). You need to make sure if you ref only a set of rows that all references include the same number of rows

@mtarler   Attached file - thanks!

Why are there '@' symbols in there?
=SUMPRODUCT(IF(@A12:A21+@B12:B21<=0,A12:A21,-@B12:B21))
Got rid of those '@' symbols and it worked fine.
the '@' symbol is used to force only 1 item to return so for example in a table you might want only use the cell in the same row as the formula so you use [@Colx] because [Colx] would refer to the entire column.
That all said, what version of Excel are you using?