Logic formula using Time

G

Guest

I am trying to write a formula that compares a variable time to a fixed time.
If the variable is greater than the fixed, I assign it the value "1" and if
it is less than, I assign in the value "0".

The formula I'm trying to use is: =IF(A1>A2,1,0) where A1 is the variable
time.

The problem I have is that the fixed time is 12:00 AM, so Excel is reading
all variable times as GREATER than and assigning a "1".

How can I write the formula so that 11:50 PM (the previous calendar day)
will read as LESS THAN the fixed 12:00 AM (the following calendar day)?
 
D

Dave O

Use Excel "serial dates" and format them to show time.

Excel uses a date scheme called serial dates, in which a day is an
integer number and a time is a fractional part of a day. Right now the
time is 12/22/2005 15:58 in my time zone; the serial date equivalent of
that is 38708.66530. Test this by entering =NOW() into any cell of
your spreadsheet, then format that cell to view as a number with a few
decimal places.

If you set up your dates using serial dates, your formula will work
properly.
 
R

RagDyer

Use dates and custom format the cells to show only the time.
Enter:
..12/22/05 12:00 a

And format:
hh:mm
--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================
 
G

Guest

Thanks. That worked!
--
Thanks!

RKEMPER


RagDyer said:
Use dates and custom format the cells to show only the time.
Enter:
..12/22/05 12:00 a

And format:
hh:mm
--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================
 
R

RagDyer

Appreciate the feed-back.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

rkemper said:
Thanks. That worked!
 

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

Time calculation 1
Comparing Time in a Formula 1
Nesting IF or IF 2
Excel Need Countifs Formula Help 0
Subtraction formula with Text error 7
How to use names for values in logical formulas. 1
If Formula 15
Logical Functions 5

Top