Consulting

Results 1 to 3 of 3

Thread: CountIf

  1. #1
    VBAX Contributor
    Joined
    Feb 2005
    Posts
    151
    Location

    CountIf

    Hi you guys,

    I having difficulties with a countif formula, you can see my doubt in the attach file.

    Please take a look

    thanks

    best regards

    Ismael

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hello Ismael,


    Let's look at the following ...

    To count all occurancces:

    =COUNT($C$4:$D$96)

    To count all occurances under your Max limit:

    =COUNTIF($C$4:$D$96,"<"&C2+10/1440)

    To count all occurances under your Min limit:

    =COUNTIF($C$4:$D$96,"<"&C1+10/1440)

    To count all occurances that intersect your Min/Max values:

    =COUNTIF($C$4:$D$96,"<"&C2+10/1440)-COUNTIF($C$4:$D$96,"<"&C1+10/1440)
    or
    =SUMPRODUCT(--($C$4:$D$96<C2+10/1440),--($C$4:$D$96>C1+10/1440))

    I would do something like naming the range (and unmerging the cells also!) with a name like 'rng'. This would take your caculation to ...

    =SUMPRODUCT(--(rng<C2+10/1440),--(rng>C1+10/1440))
    Note: we must do the "10/1440" as Excel calculates time in fractions of a day, so there are 1,440 minutes in a day.

  3. #3
    VBAX Contributor
    Joined
    Feb 2005
    Posts
    151
    Location
    Hi firefytr,

    thanks for your help,
    I just now see your reply, becuase I stay out of office until now, but your ideia works very well.

    So many thanks for you help,

    Best regards,

    Ismael


Posting Permissions

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