Friday, February 11, 2011

Adding "odd" numbers

I'm trying to add only "odd" numbers from a range(named "data") which contains numbers, blank cells and text. No matter what I try I always seem to end up with a #value error. My latest attempt is as follows: =SUMPRODUCT(N(MOD(Data,2)=1),Data) Any suggestions?

  • Use Array Formula

    =SUM(IF(ISNUMBER(data), IF(MOD(data, 2) = 1, data, 0), 0))
    

    Press CTRL-SHIFT-ENTER after entering the formula

    (Tested in Excel 2003)

    Mike Fitzpatrick : +1. This method allows more flexible criteria than SUMIF().
    Rhys Gibson : Nice answer. It will work in 2007 as well.
    Auto : Thanks for that. It worked a treat.
    From wilson

0 comments:

Post a Comment