AM - PM

J

Jason B

I am using excel and am tring to find out me sleeping
habites. Is there a "fx" in Excel that will tell the
diff. between 11:50 PM to 7:00 AM in numbers. If not how
can i do this?
 
F

Frank Kabel

Hi
try (if the start time is in A1 and the end time in B1)
=B1-A1+(B1<A1)

works only if you sleep less than 24 hours. Also takes into account
that you sleep from 10am to 23pm: night shift worker :)
 
N

Norman Harker

Hi Jason!

Frank and the link provided by Niek give you the answer.

Here it is explained step by step:

In A1 put:
23:50
In B1 put:
7:00
In C1 put:
=B1-A1+(B1<A1)
Returns 7:10

Time is recorded by Excel as a decimal part of 1 day. If you have
spanned Midnight, the second time in most uses will be an earlier
number than the first one. We make use of that by adding 1 if it is an
earlier number.

If you want that as decimal hours you can use:

=(B1-A1+(B1<A1))*24
Returns 7.166667

An alternative approach is to put the date and time in your entries
and in that case the simple solution would then be =B1-A1

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 

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

Similar Threads

Min, Max 3
Template with fields and premade texts.. 0
Time Format to Text Output - A Tough One ! 4
AM-PM 6
I screwed up 0
VBA Export to PDF 0
MS Exchange PTR 0
Extracting just the time portion 6

Top