If fomula

  • Thread starter Thread starter Joe Perez
  • Start date Start date
J

Joe Perez

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,
 
Yes, but had no luck.

Don Guillett said:
Have you looked in the help index for IF

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
Joe Perez said:
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 -----
 
=if(a1="hi there",INT((D13-C13)*24)+((D14-C14)*24),INT((H14-G13)*24))

This combines the two into a single formula, but I doubt that this is what you
want.
 
Joe Perez said:
so, here's an example of what i'm shooting for..

Wow! I'm surprised that the MS newserver does not strip embedded uuencoded
text, which OE seems to recognize as an attachment. (Biting tongue ;->.)

Your worksheet had the following explanation, which I think you could have
simply written in your posting: "The formula should read If H13 is nothing
G15 is equal to H14-G13, otherwise G15 is equal to H13-G13+H14-G14".

"Nothing" is ambiguous. I think the following will probaby work for you,
entered into G15:

=IF(H13="", INT((H14-G13)*24)), INT((H13-G13 + H14-G14)*24))

The examples in your worksheet do not clarify how you want to truncate the
addition of two elapsed time periods added when H13<>"". I believe the one
above is the more appropriate method. But that really depends on your
policies.


----- original message -----
 
Back
Top