# IF and NOW() together in formula

#### liquid25

##### Board Regular
I want a formula to return zero if the current time is after 6PM and 1 if not. Is there a formula that can acheive this?

Cheers

### Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

#### nbrcrunch

##### Well-known Member
So from zero-hundred hours to 1800 is value 1 and
from 1801 to 2400 is value zero?

If A1 houses your time, then:

=IF(TIME(HOUR(A1),MINUTE(A1),0)>0.75,0,1)

Useful Reading: (Scroll down to Date & Time Serials)
http://www.mvps.org/dmcritchie/excel/datetime.htm

=IF(A1>0.75,0,1)

Hope that helps,

Smitty

#### liquid25

##### Board Regular
cheers, that's great.

in what format does the time need to be in cell A1?

can it be the function NOW()?

#### Smitty

##### Legend
can it be the function NOW()?
That should work just fine.

Smitty

#### nbrcrunch

##### Well-known Member
please try it before asking. it is so much easier to try something like this than wait for answer.

#### Nimrod

##### MrExcel MVP
I tried PennySavers solution with a now() and it worked fine !

=IF(NOW()>0.75,0,1)

#### Brian from Maui

##### MrExcel MVP
nbrcrunch said:
please try it before asking. it is so much easier to try something like this than wait for answer.

Why not?

Edit,

Where's the other remark you made?

#### nbrcrunch

##### Well-known Member
Brian:

I deleted it. the first time I tried it, it didn't work (for some unknown reason). But when I saw the 2nd post, I went back and tried it again.

Every so often either it must be my install of Excel or (more likely) I typed something different than what I thought I typed (as a formula). Sometimes I will try so many variations of a formula that I can't remember what I have & haven't tried. Either during my sleep or fresh the next day, it comes to me what I need to do.

#### Brian from Maui

##### MrExcel MVP
nbrcrunch said:
Brian:

I deleted it. the first time I tried it, it didn't work (for some unknown reason). But when I saw the 2nd post, I went back and tried it again.

Every so often either it must be my install of Excel or (more likely) I typed something different than what I thought I typed (as a formula). Sometimes I will try so many variations of a formula that I can't remember what I have & haven't tried. Either during my sleep or fresh the next day, it comes to me what I need to do.

Not a problem....

Happens to me ALL the time!

Replies
4
Views
209
Replies
4
Views
211
Replies
6
Views
121
Replies
2
Views
213
Replies
3
Views
87

1,195,858
Messages
6,011,979
Members
441,661
Latest member
Pammie007

### 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.

### Which adblocker are you using?

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

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