calculating time with IF statement

M

Mark.M.Sweeney

I have the following:

A1 is formated as time = 7:30 AM
A2 is formated as time = 6:00 PM
A3 is formated as time and contains =sum(A2 - A1) and gives 10:30

That part I've got down.

Now, I want to subtract 30 minutes so I added:

A4 is formated as time and contains =sum(A3-30/1440) and gives 10:00

Worked, thanks to those that have posted these questions. Now the
problem:

I only want to subtract the 30 minutes if cell A3 is greater than
7:00

How do I write that IF statement?

Thanks for the help,
Mark
 
D

Dave Peterson

You could have used:

=a2-a1
=a3-30/1400

=sum() doesn't really add anything to your formulas.

=a3-if(a3>time(7,0,0),time(0,30,0),0)
or
=A3-IF(A3>7/24,30/1440,0)
or
=A3-30/1440*(A3>7/24)

(a3>7/24)
will result in a True or False.
True in a multiplication will be the same as multiplying by 1.
False is the same as multiplying by 0.
 

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

Top