time calculation

rami79

New Member
Joined
May 8, 2005
Messages
47
I want to calculate the difference in time.
example:
col a= time sent and col b= time replied.

what i want to do is : if b-a is less than 1 hour and col C=1, then OK, OR if b-a is less than 4 hours and C=2 then Ok...

I tried to use this :=IF(OR(AND(B1-A1<TIMEVALUE("1:00"),C1=1),AND(B1-A1<TIMEVALUE("4:00"),C1=2)),"OK","Not OK?")

But it seems that it is not calcultating the time correctly, the formula is fine, i may think that it is a format issue. can you help

thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How's this work for you.

=IF(AND(HOUR(B2)-HOUR(A2)<1,C2=1),"OK",IF(AND(HOUR(B2)-HOUR(A2)<4,C2=2),"OK","NOT OK"))
 
Upvote 0
Probably, your problem is using hours as a number, as in
B1-A1<1. Since Excel calculates time based on days, one hour must e expressed as 1/24, that is, as 1/24 of a day. Thus, the following formula works fine for:
A1=10:20
B1=11:10
C1=IF(OR(AND(B1-A1<1/24,C1=1),AND(B1-A1<4/24,C1=2)),1,0)


D1=
 
Upvote 0
Your B1-A1 code would work if you multiply the result by 24 (=(+B1-A1)*24), or divide the corresponding evaluator by 24, as indicated by RalphA.

Otherwise, if you are not interested in minutes being a part of the evaluation, then WWBWB's post works. It should be noted that WWBWB's post will evaluate 4:01-3:59 as 1 hour, and is therefore Not OK, even though it was only 2 minutes of actual time.

HTH,
Colbymack
 
Upvote 0
hey guys,
you are great, but it is still not working for a reason.

I have 4 columns
A - priority that could be 1 to 4
B - time submitted
C- time replied
D- where the formula should be.

Depends on the priority there is a delay in replying:
example, if it is priority 1, the delay should be 1 hour max
if it is priority 2 , the delay is 6 hours
if it is priority 3 the delay is 24 h.

I need In column D to have the result OK, if there criateris are met for priority 1, 2 and 3.

I tried all of them, but i think that i miss somethig

thanks
 
Upvote 0

Forum statistics

Threads
1,213,507
Messages
6,114,029
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top