+ Reply to Thread
Results 1 to 5 of 5

Counting with multiple conditions

  1. #1
    Registered User
    Join Date
    09-19-2007
    Posts
    6

    Counting with multiple conditions

    I am trying to make an array that will count houses based on their size and year built. My worksheet contains the following columns: A - Sale Date; B - Sale Price; C - Size; D - Year Built. I cannot get a formula to work that will count a house if it is built before 1960 and is less than 1000 square feet in size.

    The second problem will be when I try to build a formula to count houses built between 1960 and 1969 and less than 1000 square feet.

    I am using Mac Excel 2004. Any thoughts?
    Littleoldladywho

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =SUMPRODUCT(--(C2:C100<=900)*(C2:C100>0))*(D2:D100<1960)*(D2:D100>0)

    and

    =SUMPRODUCT(--((D2:D100<=1969)*(D2:D100>=1960)*(C2:C100<=1000)*(C2:C100>0)))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    09-19-2007
    Posts
    6
    The second formula works perfectly. The first returns "0" when it should return "1." I fixed the last cell reference with no success in the results. Is this an issue with parenthesis placement?

    Thanks,
    Littleoldladywho

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =SUMPRODUCT(--(C2:C100<=900)*(C2:C100>0)*(D2:D100<1960)*(D2:D100>0))

    VBA Noob

  5. #5
    Registered User
    Join Date
    09-19-2007
    Posts
    6
    That nailed it.

    Thank you very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1