Calculating a Formula only is 2 cells have values

D

dwalsh77

I currently have a formuala that subtracts 2 cells which both contain times.
(i.e. 23:30 and 04:30 would give an answer of 5). The formula looks like this:
=ROUND((C2-B2+(B2>C2))*24,1) --> it rounds the answer to 1 decimal place.

But, I do not want to make this calculation occur until both times (B2 & C2)
have a time. If 1 or both are empty, i want a message to say that they need 2
times before it can be calculated. Somewhat of an IF function I guess.

I also have another formula that uses the previous calculation. So if that
1st calculation does not occur due to empty values in B2 or C2, I do not want
formula to take place either until the previous formula (time subtraction
formula) has an ANSWER.

Thanks and sorry for the length of the question.
 
F

Frank Kabel

Hi
try
=IF(COUNT(B2:C2)<>2,"",ROUND((C2-B2+(B2>C2))*24,1))

And in your next cell try
=IF(D2="","",your_formula)
 
A

Aladin Akyurek

1.

=IF(COUNT(B2:C2)=2,ROUND((C2-B2+(B2>C2))*24,1),"")

2.

Assuming that (1) is in D1...

=IF(D1="","",Calculation)
 
Top