View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Time Calculation returning 19:00

"default time to PM after 12:00 pm"
. com wrote:
I'm trying to calculate the hh:mm difference between two cells
and asking to do nothing if W1 is blank. Why am I getting 19:00
as a value from a calculation of:
=IF(W1<X1,X1-W1,IF(W1="","",IF(W1X1,"","")))


I haven't a clue, since your posting does not tell us what is in W1 and X1.
Why shouldn't the formula return 19:00?

But here are some tweaks that you should consider for your formula. It
might solve the problem coincidentally.

First, if W1 is empty (not ""), your formula will return X1 because W1<X1 is
true. I suspect that is not what you want.

Second, the last term (if W1X1,...) is superfluous, albeit not harmful.

Third, you assume that X1 cannot be empty or null text (""). Is that a
valid assumption?

At a minimum, try:

=if(and(W1<"",W1<X1),X1-W1,"")

Alternatively:

=if(and(W1<"",X1<"",W1<X1),X1-W1,"")