Thread: If fomula
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default If fomula


"Joe Perez" wrote:
I want to combine the 2 formulas using the IF function.


Needless to say, you would get a more helpful response if you explained the
condition for selecting one formula or the other. The following may or may
not be helpful.

The general form of the IF expression might be:

=if(condition, INT((D13-C13)*24)+(D14-C14)*24, INT((H14-G13)*24))

What is "condition"? That's for you to answer. It might be something like:

=if(A1="two shifts", INT((D13-C13)*24)+(D14-C14)*24, INT((H14-G13)*24))


By the way, I suspect the first of your original formulas is incorrect. I
suspect it should be one of the following, depending on your intention:

1. INT((D13-C13)*24) + INT((D14-C14)*24)

2. INT((D13-C13)*24 + (D14-C14)*24)

3. INT((D13-C13 + (D14-C14))*24)

In #1, two elapsed times are truncated to hours and added; for example, 1.6
+ 2.7 = 3.

In #2, two elapsed times in hours and fractions of an hour are added, then
truncated; for example, 1.6 + 2.7 = 4.

#3 should be equivalent to #2, but it is more efficient. "(D14-C14)" could
be written simply as "D14-C14" without parentheses if D14 and C14 contain
only time (e.g. hh:mm) instead of date and time (e.g. m/d/yyyy h:mm).


----- original message -----

"Joe Perez" wrote in message
...
Hello,

I want to combine the 2 formulas using the IF function. Each scenario has
its own formula but I want to integrate them into one formula. I'll
appreciate if you could do it for me.

=INT((D13-C13)*24)+((D14-C14)*24)
=INT((H14-G13)*24)

Thanks,