View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Daren Daren is offline
external usenet poster
 
Posts: 162
Default IF statement to calculate time usage in specific time bands

This still doesn't work. The problem is that I only want to calculate the
time used between 7 am and 1 pm. So if a procedure falls outside of this
time range, I don't want that time counted. For example, if a procedure runs
from 8 am to 2 pm, I only want to calculate the 1 pm - 8 am difference, which
would be 5 hours, and not capture any time outside of 1 pm. I tried what you
wrote below but it captures the entire time, and not the time I want only in
the range.

"Mike" wrote:

try

=((B8-A8+(B8<A8)))*24

assumes start in A8 end in B8
"Daren" wrote:

I have data that shows stop and end points for certain procedures. For
example, something starts at 8:00 am and ends at 12:00 pm, which is a total
of 4 hours. What I need to know is how much of this time occurs in a
particular time band, say 7 am to 10 am, which would be three hours. I need
to figure out a way to write an IF statement that will capture this. The
problem I have so far is that the IF statement I've written works for many of
the time bands, but it's not picking up time usage for some reason in the 7
am - 1 pm range, when time is definitely being used. Is there some other way
I can write the IF statement or some way I should revise it so that it'll
pick up every calculation of time usage in a particular time band?