ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Time Value Between Two Times (https://www.excelbanter.com/excel-worksheet-functions/245415-time-value-between-two-times.html)

Debbie[_4_]

Time Value Between Two Times
 
Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")

ExcelBanter AI

Answer: Time Value Between Two Times
 
It looks like the formula you have written is correct. However, there might be a formatting issue with the cell that is preventing the formula from working as expected. Here are a few things you can try:
  1. Check the cell format: Make sure that the cell containing the time value is formatted as "Time" with the correct time format (00:00 AM/PM). You can do this by right-clicking on the cell and selecting "Format Cells". Then, select "Time" from the list of categories and choose the appropriate format.
  2. Check the time value: Double-check that the time value in cell F85 is entered correctly. It should be in the format of HH:MM AM/PM. For example, 8:30 AM should be entered as "8:30 AM" and not "8.30" or "8:30".
  3. Try using the TIME function: Instead of entering the time value directly in the formula, you can use the
    Code:

    TIME
    function to specify the time range. For example, the formula would be:
    Code:

    IF(AND(F85=TIME(8,30,0),F85<=TIME(9,0,0)),1,"B")
    . This will ensure that the time values are interpreted correctly by Excel.

Hopefully, one of these solutions will help you get the desired result. Let me know if you have any other questions or if there's anything else I can help with!

Debbie[_4_]

Time Value Between Two Times
 
On Oct 13, 9:13*pm, Debbie wrote:
Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")


The other criteria that it needs to meet is that c86 needs to be
greater than 12 otherwise if less than 12 then "B"

T. Valko

Time Value Between Two Times
 
IF(AND(F85=8:30,F85<=9:00),1,"B")

Try it like this:

=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,0,0)),1,"B")

Or, use cells to hold the time boundaries...

A1 = 8:30 AM
B1 = 9:00 AM

=IF(AND(F85=A1,F85<=B1),1,"B")

You probably want to format the result as General.

--
Biff
Microsoft Excel MVP


"Debbie" wrote in message
...
Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")




Fred Smith[_4_]

Time Value Between Two Times
 
1. First, your format needs to be: hh:mm AM/PM (Excel doesn't use zeros for
time format, because it wouldn't know whether you wanted hours and minutes
or minutes and seconds.)
2. Second, Excel doesn't recognize 8:30 as a time. Your choices a
IF(AND(F85=time(8,30,0),F85<=time(9,0,0),1,"B")
IF(AND(F85=timevalue("8:30"),F85<=timevalue("9:00 "),1,"B")
IF(AND(F85=--"8:30",F85<=--"9:00"),1,"B")

Regards,
Fred

"Debbie" wrote in message
...
Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")



Fred Smith[_4_]

Time Value Between Two Times
 
Just add it to the And function:
IF(AND(F85=--"8:30",F85<=--"9:00",C8612),1,"B")

Regards,
Fred


"Debbie" wrote in message
...
On Oct 13, 9:13 pm, Debbie wrote:
Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")


The other criteria that it needs to meet is that c86 needs to be
greater than 12 otherwise if less than 12 then "B"


Ron Rosenfeld

Time Value Between Two Times
 
On Tue, 13 Oct 2009 18:13:49 -0700 (PDT), Debbie
wrote:

Here is another scenario.

If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?

IF(AND(F85=8:30,F85<=9:00),1,"B")


It's always helpful if you explain "why" you think you are doing something
wrong. In other words, are you getting an error message? If so, what is it?

Are you getting a wrong answer? If so what is the input and output?

And so forth.

From the looks of your formula, it appears as if you are entering the Time
value incorrectly. In that case, you should be getting an error message "The
formula you typed contains an error".

If that is the case, then try this:


=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,,)),1,"B")

Or, put your times in a cell, and reference those cells in your formula.

--ron

Ron Rosenfeld

Time Value Between Two Times
 
On Tue, 13 Oct 2009 18:17:12 -0700 (PDT), Debbie
wrote:

The other criteria that it needs to meet is that c86 needs to be
greater than 12 otherwise if less than 12 then "B"


What if C86 is EQUAL to 12?

so either:

=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,,),C8612),1 ,"B")

or

=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,,),C86=12), 1,"B")

--ron

Debbie[_4_]

Time Value Between Two Times
 
On Oct 13, 9:25*pm, "T. Valko" wrote:
IF(AND(F85=8:30,F85<=9:00),1,"B")


Try it like this:

=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,0,0)),1,"B")

Or, use cells to hold the time boundaries...

A1 = 8:30 AM
B1 = 9:00 AM

=IF(AND(F85=A1,F85<=B1),1,"B")

You probably want to format the result as General.

--
Biff
Microsoft Excel MVP

"Debbie" wrote in message

...



Here is another scenario.


If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?


IF(AND(F85=8:30,F85<=9:00),1,"B")- Hide quoted text -


- Show quoted text -


Thank you, works great!

T. Valko

Time Value Between Two Times
 
You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Debbie" wrote in message
...
On Oct 13, 9:25 pm, "T. Valko" wrote:
IF(AND(F85=8:30,F85<=9:00),1,"B")


Try it like this:

=IF(AND(F85=TIME(8,30,0),F85<=TIME(9,0,0)),1,"B")

Or, use cells to hold the time boundaries...

A1 = 8:30 AM
B1 = 9:00 AM

=IF(AND(F85=A1,F85<=B1),1,"B")

You probably want to format the result as General.

--
Biff
Microsoft Excel MVP

"Debbie" wrote in message

...



Here is another scenario.


If F85 is greater than or equal to 8:30 am but less than or equal to
9:00 am, then I need it to return a 1, If it is not between 8:30 am
and 9:00 am then I need it to return "B". I have the cell formated as
time 00:00 AM. What am I doing wrong?


IF(AND(F85=8:30,F85<=9:00),1,"B")- Hide quoted text -


- Show quoted text -


Thank you, works great!




All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com