Between Time range return Days, Afternoon, Night

kevin440red

New Member
Joined
May 23, 2011
Messages
26
Office Version
  1. 2019
I have different times in Column (A), what i and trying to do is.

If the Time is between 6:37am and 2:36pm return Days
If the Time is between 2:37pm and 10:36pm return Afternoon
If the Time is between 10:37pm and 6:36am return Nights

Can someone help?

thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi, here is one option you could try:


Excel 2013/2016
AB
106:36Nights
206:37Days
314:36Days
414:37Afternoon
522:36Afternoon
622:37Nights
705:00Nights
Sheet1
Cell Formulas
RangeFormula
B1=LOOKUP(A1,0+{"00:00","06:37","14:37","22:37"},{"Nights","Days","Afternoon","Nights"})
 
Upvote 0
Slightly different:

=LOOKUP(MOD(A1,1),{-1E-99,"6:36:59","14:36:59","22:36:59"}+1E-99,{"Nights","Days","Afternoons","Nights"})
 
Upvote 0
An alternative to the above if you prefer not to do a lookup would be a nested IF/AND formula like this:

=IF(AND(A2>=TIME(6,37,0),A2<TIME(2,36,0)),”Day”,IF(AND( etc...
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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