+ Reply to Thread
Results 1 to 4 of 4

Thread: Countif odd

  1. #1
    Registered User
    Join Date
    07-22-2009
    Location
    NYC, NY
    MS-Off Ver
    Excel 2003
    Posts
    22

    Countif odd

    I have a list of integers in a column, and I would like to count how many odd numbers there are. I tried using COUNTIF(D1:D33,MOD(,2)=1) and similar variations, but none seem to work. The numbers are ascending as the rows increase, but there can be blank cells in the column. Help? If you can do it without using countif, that's fine too.
    Last edited by nesthead98; 07-22-2009 at 12:04 PM. Reason: solved

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Countif odd

    I've moved this to the Excel Worksheet Function Forum.

    Re: your question... you say Column but then your COUNTIF sample is looking only at one Row (4)... presuming you mean Row

    =SUMPRODUCT(--(MOD(4:4,2)=1))

    Note although you can use entire row references in Sumproduct formulae pre 2007 the same is not true of entire column references (A:A) ... best when using Sumproducts and/or Arrays of any sort to keep range sizes to a minimum.

  3. #3
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Countif odd

    In line with your revision to your original post:

    =SUMPRODUCT(--(MOD(D1:D33,2)=1))

    Here a COUNTIF is not really viable given the requirement to "alter" the source values to a simple - is odd / is even equivalent... wherever manipulation of source data is required COUNTIF/SUMIF are invariably ruled out as viable alternatives.

  4. #4
    Registered User
    Join Date
    07-22-2009
    Location
    NYC, NY
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Countif odd

    Awesome thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0