Calculating Counts based on Date and Time Frame

B

Brendon

I have the following formula:

=IF(ISBLANK(A7),"",SUMPRODUCT(--(PTARRTIME<>""),--(PTARRTIME>=TIME(LEFT
(C$6,2),MID(C$6,4,2),0)),--(PTARRTIME<TIME(MID(C$6,7,2),RIGHT(C$6,2),
59)),--(PTORDDATE=$A7)))

Basically what this does is look into C6, (05:00-05:29) and calculate
the number of people seen between these times, and on the date (A7).

For some reason, it's not calculating correctly. When I do manual
counts, it gives me a different number. Am I missing something here?

Brendon
 
B

Bernd P

Hello Brendon,

The formula looks fine. Maybe you need some data validation checks on
your input data, such as conditional formats which highlight erroneous
inputs.
Example: conditional format with formula =AND(ISNUM(LEFT(C$6,2),...)

Regards,
Bernd
 
J

jaf

Hi Brendon,
One thing to keep in mind.
When dealing with time a millisecond off can cause an error.
So ,--(PTARRTIME<TIME(MID(C$6,7,2),RIGHT(C$6,2), may give a different result if you change "<" to "=<"
If PTORDDATE has a time as well as a date component you could get a similar error.
You seem to have everything else covered.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top