If / And formula issues

kod2th3e

Board Regular
Joined
Apr 2, 2008
Messages
87
I am trying to use a formula to determine if the current time is between two set times (6:30 AM & 3:30 PM), if it is I would like the cell to display "1st" else I would like it to display "2nd". I have the following formula in cell C1 and I have the Now() function in cell K1 with the format of h:mm AM/PM.

Formula: =IF(AND(K1>"6:30 AM",K1<"3:30 PM"),"1st","2nd")

Any/All help would be greatly appreciated, thanks for looking.

I am using MS Office 2007 on XP Professional.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You need to convert you text criteria into serial times:

=IF(AND(K1 > TIMEVALUE("6:30 AM"),K1 < TIMEVALUE("3:30 PM")),"1st","2nd")
 
Upvote 0
You need to convert you text criteria into serial times:

=IF(AND(K1 > TIMEVALUE("6:30 AM"),K1 < TIMEVALUE("3:30 PM")),"1st","2nd")

I'm not sure what I am doing wrong but when I do that it processes the first part of the and statement as true, then the second part of the and statement as false and displays "2nd" eventhough 9:26 AM is between 6:30 AM and 3:30 PM. THoughts?
 
Upvote 0
For 9:26 AM both tests return TRUE. Are you sure that you have a serial time in K1 (it will appear as 0.393056 when formatted as General)?
 
Upvote 0
I used the =now() formula in K1 to retrieve the most current time and it turns into 40357.4 when I format it as general.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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