+ Reply to Thread
Results 1 to 4 of 4

Compare and count 2 columns

  1. #1
    Registered User
    Join Date
    03-24-2005
    Posts
    4

    Compare and count 2 columns

    I have 2 columns... one which has a status ( eg IP, CO etc) and a date column. I would like to count a particulat status which lies between 2 dates which are present in the second column.

    Can anyone please let me know how this is done. I have tried using a COUNTIF function within an IF statement but didnt get the required result.

    Thanks

  2. #2
    Registered User
    Join Date
    07-01-2004
    Location
    Kent, UK
    Posts
    74
    Column A = status
    Column B = Date
    Column C

    =SUMPRODUCT((A5:A12="Status")*(B5:B12>=startdate)*(B5:B12<=enddate))

    Where startdate is a cell containing the date you want to count from and enddate is the last date to be included.

  3. #3
    Registered User
    Join Date
    03-24-2005
    Posts
    4
    Thanks for your reply. However when I give the enddate, I am not getting the result.

    This is what I have written
    =SUMPRODUCT((A2:A8="IP")*(B2:B8>=4/12/2005)*(B2:B8<=4/16/2005))

    Can you please tell me where I am going wrong??

  4. #4
    Registered User
    Join Date
    07-01-2004
    Location
    Kent, UK
    Posts
    74
    Excel is seeing the dates in the formula as text.

    If you want to hard cose the dates in the formula then you need to force Excel to accept them as dates. The simplest way to do this is by a double negative:

    =SUMPRODUCT((A2:A8="IP")*(B2:B8>=--"12/04/2005")*(B2:B8<=--"16/04/2005"))
    Last edited by Alex Delamain; 03-24-2005 at 09:32 AM.

+ 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