if then else for timestamp

sagarika

New Member
Joined
Sep 11, 2017
Messages
3
=IF(A2<="12:00","Before Noon",IF(AND(A2>"12:00",A2<="15:00"),"After Noon",IF(AND(A2>"15:00",A2<"19:00"),"Evening","Night")))

I have a column of timestamps..i need to create buckets like before noon, post noon etc.
I am using the above formula but its not working. can anyone help me with it?
 

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
Try converting all your "12:00" to Text("12:00", "HH:MM") to compare with, see if it works
=IF(A2<=Text("12:00", "HH:MM),"Before Noon",IF(AND(A2>Text("12:00", "HH:MM),A2<=Text("15:00", "HH:MM)),"After Noon",IF(AND(A2>Text("15:00", "HH:MM),A2<Text("19:00", "HH:MM)),"Evening","Night")))
 
Upvote 0
Try

=IF(A2<=--"12:00","Before Noon",IF(AND(A2>--"12:00",A2<=--"15:00"),"After Noon",IF(AND(A2>--"15:00",A2<--"19:00"),"Evening","Night")))
 
Upvote 0
Hi..its not working. My column has the datatype of timestamp..do I need to convert it into some other type??..it still shows error in the formula
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,511
Members
449,166
Latest member
hokjock

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