View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex Alex is offline
external usenet poster
 
Posts: 6
Default Finding times between 6pm and Midnight...

Hello,

I have a column which contains a full date and time, for example
2007-02-03 19:01:03. I need to create another column which will just
have 1 if it's after 6PM or 0 if before. I created a column called
Hour and using a Custom Format with just 'h' now have the hour in 24
hour format. I then created an if statement with this:
=IF(R217,1,0)

R2 is where the Hour field is. Problem is every field is 1. How can
I calculate the hour in a date field? Obviously the custom format is
only for display, and all calculations are still looking at the full
date. I'm using MS SQL 2007, but I assume any solution would work on
prior versions of Excel.

Thanks --

Alex