+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    09-23-2003
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    27

    Histogram of times

    I have sleep data that shows the start and finish times of when a person is asleep over a number of different days.

    Example
    10:00 to 10:03
    10:01 to 10:02
    13:00 to 13:02
    etc
    etc

    I'd like to produce a histogram (in 1 minute intervals) showing what times during the day that the person sleeps the most.

    For the above example the bins should look like the following:

    00:00 = 0
    etc
    etc
    10:00 = 1
    10:01 = 2
    10:02 = 2
    10:03 = 1
    10:04 = 0
    etc
    etc
    13:00 = 1
    13:01 = 1
    13:02 = 1
    13:03 = 0
    etc
    etc

    Does anyone know of a way of producing a histogram like this when dealing with start/finish time sets?

    Brad
    Last edited by bradles; 03-10-2010 at 07:28 AM.

  2. #2
    Forum Guru zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    5,729

    Re: Histogram of times

    What version of excel do you use?
    "Relax. What is mind? No matter. What is matter? Never mind!"

  3. #3
    Registered User
    Join Date
    09-23-2003
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Histogram of times

    sorry...forgot to mention that I am using Excel 2003.

  4. #4
    Forum Guru zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    5,729

    Re: Histogram of times

    Is this it?
    Attached Files Attached Files
    "Relax. What is mind? No matter. What is matter? Never mind!"

  5. #5
    Registered User
    Join Date
    09-23-2003
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Histogram of times

    That looks about right.

    What do the -- signs do in the SUMPRODUCT formula?
    =SUMPRODUCT(--($A$2:$A$1000<E7),--($B$2:$B$1000>=E7))

  6. #6
    Forum Guru zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    5,729

    Re: Histogram of times

    To SUMPRODUCT nothing... to other parts:

    --($A$2:$A$1000<E7)

    coverts TRUE/FALSE into 1/0

    example: you have 1,2,3,4,5

    --(A1:A5>3)
    --(FALSE, FALSE, FALSE, TRUE, TRUE)
    0,0,0,1,1
    "Relax. What is mind? No matter. What is matter? Never mind!"

  7. #7
    Registered User
    Join Date
    09-23-2003
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Histogram of times

    Thank you

    Brad

  8. #8
    Registered User
    Join Date
    09-23-2003
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Histogram of times

    Sorry to open this thread up again, but do you know how I get this to work when the start and finish times span midnight? eg, 22:00 to 01:30

    Brad.

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.2.0