Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2017, 01:09 PM
waqas17 waqas17 is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2013
Novice
How to categorize time into Day/Night?
 
Join Date: Dec 2017
Posts: 4
waqas17 is on a distinguished road
Default How to categorize time into Day/Night?

Hi All

How can I categorize time as Day or Night?
For example, I have accidents data with the time of occurring of the accident.
If I set that 7:00 PM - 6:00 AM as NIGHT and 6:01 AM - 6:59 PM as DAY, then how can I categorize that the accident occurred during day or night.

The sample of data is as such:


Accident Time Day/Night
0:00 Night
0:35
0:50
0:14
0:02
0:30
1:52
1:28
1:01
1:50
1:30
1:25
1:20
1:39
2:20
2:30
2:17
2:30

I have a large set of data (about 800 entries). Please help me with the formula to use to organize the data.

Thanking you in anticipation.

Waqas
Reply With Quote
  #2  
Old 12-22-2017, 01:36 PM
ProudLiberal's Avatar
ProudLiberal ProudLiberal is offline How to categorize time into Day/Night? Windows 7 64bit How to categorize time into Day/Night? Office 2010 64bit
Novice
 
Join Date: Jun 2017
Location: suburban Chicago
Posts: 28
ProudLiberal is on a distinguished road
Default

=if(and(a1>(6/24),a1<(19/24)),"day","night")
Reply With Quote
  #3  
Old 12-22-2017, 02:54 PM
waqas17 waqas17 is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2013
Novice
How to categorize time into Day/Night?
 
Join Date: Dec 2017
Posts: 4
waqas17 is on a distinguished road
Default

I'm sorry I've tried the "if" function already and it is not working.
Reply With Quote
  #4  
Old 12-23-2017, 01:23 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline How to categorize time into Day/Night? Windows 7 64bit How to categorize time into Day/Night? Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,943
Pecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond repute
Default

Could you tell us what is not working?
Are they real times or text looking like time ( left aligned if no forced alignment) ?
If so try TIMEVALUE(A1) instead of A1
__________________
Using O365 v2503 - Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #5  
Old 12-23-2017, 11:09 AM
waqas17 waqas17 is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2013
Novice
How to categorize time into Day/Night?
 
Join Date: Dec 2017
Posts: 4
waqas17 is on a distinguished road
Default

The problem is that it is giving the same output for every entry and doesn't return the value as "DAY" as specified by the conditions.

Yes, accident time is actual time (cell format is set to time).
Reply With Quote
  #6  
Old 12-23-2017, 12:56 PM
Logit Logit is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Assuming your time data begins in F2 :

Code:
=IF(AND(F2>=TIMEVALUE("6:00:00"))*(F2<=TIMEVALUE("19:00:00")),"Day","Night")
Reply With Quote
  #7  
Old 12-23-2017, 03:51 PM
waqas17 waqas17 is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2013
Novice
How to categorize time into Day/Night?
 
Join Date: Dec 2017
Posts: 4
waqas17 is on a distinguished road
Default

Sorted!

Thank you for the help!
Reply With Quote
  #8  
Old 12-23-2017, 06:00 PM
Logit Logit is offline How to categorize time into Day/Night? Windows 10 How to categorize time into Day/Night? Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

You are welcome.
Reply With Quote
  #9  
Old 12-24-2017, 01:19 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline How to categorize time into Day/Night? Windows 7 64bit How to categorize time into Day/Night? Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,943
Pecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond repute
Default

Quote:
Originally Posted by waqas17 View Post
Yes, accident time is actual time (cell format is set to time).
It is not because the cell format is set to time that the contents are real time.
Read this about how Excel sees Dates and times
__________________
Using O365 v2503 - Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum Categorize shortcuts in Outlook 2010? King Mustard Outlook 0 11-20-2017 04:13 AM
Calculate time from midnight on (Weekend hours, Fri-Sat night shift problem) stormrider2230 Excel 1 01-20-2016 01:41 PM
Can we categorize and filter texts in Microsoft Word AAl-mutahr Word VBA 1 09-01-2014 07:15 AM
categorize gone! paascal Outlook 3 07-26-2012 03:17 PM
Best practice to categorize my tasks? LoveOffice Project 0 03-08-2010 01:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft