working with hh:mm:ss formats and IF statements

anotherrachel

New Member
Joined
Mar 8, 2010
Messages
5
Hello
I am trying to write an IF statement using date/time/hh:mm:ss data and would appreciate some help.
I have ~ 150,000 rows of data so am keen not to review line by line.

I have an extract of data with a date time stamp and I have calculated the difference between two times.
eg:
I have subtracted the first time stamp 29/10/2019 7:14:57 AM from the second time stamp 2
9/10/2019 7:20:00 AM.
The answer with the format h:mm:ss is 0:05:03 (eg in cell c10)

In another cell, I would like to have an IF statement to group the time into 3 buckets
anything > 20 minutes = "long break", anything < 5 minutes = "working", all other = short break

=IF(c10<5,"working",IF(c10>20,"long break","short break"))
In the example above, I would expect the result would be "short break" but it does not seem to work.
I assume because the numbers 20 and 5 are incompatible with the 5:03 minutes above.

Does anyone how I can make the IF statement work?

Thank you!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Maybe (untested)…

=IF(C10<TIMEVALUE("00:05:00"),"working",IF(C10>TIMEVALUE("00:20:00"),"long break","short break"))
 
Upvote 0
No problem and welcome to the board :cool:
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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