+ Reply to Thread
Results 1 to 5 of 5

How to count the date range with condition

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    doha,qatar
    MS-Off Ver
    Excel 2010
    Posts
    3

    How to count the date range with condition

    Hi everyone can you please help me i want to count the date range with a conditional i'll explain below

    on column A1:A50 is a date from August 1, 2012 - August 31 then, on B1:B50 there is a CODE 1,2,3,31,32
    now i want to count for example how may CODE 1 is there in August 1, 2012 - August 31, 2012.
    i know how to count date range by using sumproduct please help me..


    alvin

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to count the date range with condition

    hi alvin, since you mentioned that all dates are from Aug, why do you need to find Code 1 within Aug? COUNTIF will do.
    =COUNTIF(B1:B50,1)

    but if you really need it, try:
    =SUMPRODUCT((A1:A50>=DATE(2012,8,1))*(A1:A50<=DATE(2012,8,31))*(B1:B50=1))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    doha,qatar
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How to count the date range with condition

    many thanks sir it solve my problem.

    there is one more how about if text? for example on
    a1: subbase b1: 100
    a2: natural ground b2: 90
    a3: formation level b3: 95
    a4: subbase b4: 101
    a5: selected fill b5: 90

    i want to count with a condition goes like this IF a1:a5=subbase then it will count on b1:b5 the value greater than or equal to 100

    thanks in advance

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to count the date range with condition

    maybe something like:
    =SUMPRODUCT((A1:A5="Sunbase")*(B1:B5>=100)*(B1:B5))

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to count the date range with condition

    Why not COUNTIFS() instead of SUMPRODUCT()?

    =COUNTIFS(A1:A5,"Sunbase",B1:B5,">=100")

    same for the original question

    =COUNTIFS(A1:A50,">="&DATE(2012,8,1),A1:A50,"<="&DATE(2012,8,31),B1:B50,1)
    Last edited by Cutter; 08-03-2012 at 07:32 AM. Reason: Added formula

+ 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