Thread: Need help...
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK
 
Posts: n/a
Default Need help...

Steven,

I imagine you have people coming to a building (though it could be
buses at a bus station!). They arrive and leave at different times.
Sometimes you may have several people in the building, but you are
interested in the times when the building is empty. Here's how you can
monitor this:

Copy the data into a new sheet and combine the date and time fields
together by adding them in a new column and then fixing the values.
Mark them as "In" or "Out" in another column. The original data can
then be deleted, so that you have two columns each for "In" and "Out".
Move the "Out" data to below the "In" data and then sort the two
columns using the Date_time field. Leave C1 blank and in C2 enter this
formula:

=IF(B2="In",C1+1,C1-1)

Format as number and copy this down column C by double-clicking the
fill handle. This gives the number of occupants of the building at each
change "In" or "Out". Then in D3 enter this formula:

=IF(C2=0,A3-A2,0)

Format as [h]:mm and copy down. This will show you when the building is
unoccupied and record the duration of these events. As it happens, it
gives exactly the same results as the earlier formula, but that is just
a fluke. If you want the total unoccupied time, you can use the
formula:

=SUM(D3:D1000)

(adjusting the range as appropriate) and you could put this in D1, say,
formatted as blue and bold to stand out.

Hope this helps.

Pete